Show TOC Start of Content Area

Background documentation CPU Usage and Threads  Locate the document in its SAP Library structure

Like the memory also the CPU is a shared resource. The good news is that the JVM assigns processing time to the different competing applications. Nevertheless processing efficiency is still very important to the performance and scalability of server applications.

Problems may arise when the scheduling system itself is overloaded by creating too many threads. The management of the threads is taking a significant portion of memory and CPU time.

Conventions to ensure system stability and responsiveness:

Make sure that parallel processing brings a benefit in a multi-user scenario. Additional background jobs are useless, when the CPU load is already high,

·        Do not create threads from portal applications.

·        Dedicate parallel processing/background tasks to dedicated services, using Message-Driven Beans.

Performance increases with additional threads in a single user scenario is different to a multi user scenario. A system with high CPU load will not benefit from additional threads.

Recommendation

Do not create Threads yourself.

Thread creation is one of the core responsibilities of the J2EE container and the portal on top of it. It is strongly interconnected with the transaction and context management. Therefore the creation of threads is not allowed for applications.

An application only benefits from parallel processing when the CPU would be idle otherwise. Message Driven Beans is the technology that should be used to parallelize tasks.

Message-Driven Beans

The most common scenario for parallel processing is running a query on multiple external systems like databases or SAP backend systems. For every query i an I/O request is sent to the external system and the CPU is waiting time ti for the response to arrive. Without parallel processing this comes to a total of t1 + … + tk. With concurrency this can be reduced to the maximum of the response times max(t1, …, tk) – a big difference, when the response times can not be ignored.

A message-driven bean is an Enterprise Java Beans (EJB) that is executed asynchronously. A message-driven bean can be used to implement concurrent processing for applications. For parallel task a message-driven bean is created that will process the tasks in incoming order with a adjustable number of concurrent working threads. The results of the tasks are put in a result queue that can be accessed by the client with the JMS API.

 

Process documentation

JLin rule Thread Creation detects the creation of new threads by portal applications.

 

End of Content Area