Hiển thị các bài đăng có nhãn SAP Workload Analysis. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn SAP Workload Analysis. Hiển thị tất cả bài đăng

Thứ Năm, 2 tháng 2, 2012

SAP Workload Analysis - Chapter 1 Introduction


Logging in:
While logging in, the presentation server connects with the dispatcher for allocating the work processes. When a user tries to run a transaction, the user’s request comes from the presentation server to the dispatcher is put into the local wait queue. When the dispatcher recognizes that the work process is free, it allocates the process to the user’s request taken from the wait queue.

‘Wait time: in milliseconds.’

This is the time when the user’s request sits in the dispatcher queue for allocation of work process. It starts when the user’s request is entered in the dispatcher queue and ends when a process is allocated for the request waiting in the queue.

‘User context data’

When a user is dispatched to a work process, the details such as user’s logon attributes, authorizations and other relevant information is transferred from the roll memory, extended memory or the roll file in to the work process. This transfer of user context data into work process is called as ‘Roll in’.

If data from the database is needed to support transaction processing, then the request for data is sent to the database interface, which in turn sends a request through the network to retrieve information from the database.
When a request is received, the database searches its shared memory buffers. If it is found, it is sent back to the work process. If the data is not found, then it is loaded from the disk into the shared memory buffers. After being located, the data is taken from the shared memory buffers and sent back across the network to the requesting database interface.

When transaction processing is completed, the dispatcher is notified of its completion. The work process then is no longer required; the user context data is rolled out of the work process.

CPU time

CPU time is the amount of time during which a particular work process has active control of the central processing unit.

Response time in milliseconds

Starts when a user request enters the dispatcher queue; ends when the next screen is returned to the user. The response time does not include the time to transfer from the screen to front end.

Roll in time in milliseconds

The amount of time needed to roll user context information into the work process.

Load time in milliseconds

The time needed to load from the database and generate objects like ABAP Source code, CUA and screen information.

Processing time

This is equivalent to response time minus sum of wait time, database request time, load time, roll time and enqueue time.

Database request time

Starts when a database request is put through the database interface; ends when the database interface has delivered the result.



General performance indicating factors: factors indicating good performance.

Wait time < 10% of response time.
Average roll in time < 20 milliseconds.
Average roll wait time < 200 ms.
Average load (& generation time) < 10% of response time(<50 ms)
Average database request time < 40% of (response time – wait time)
Average CPU time < 40% of (response time – wait time)
Average CPU time is not much less than processing time.
Average response time – Depends on customer requirements there is no general rule.


Problems in the above factors and reasons for their problems

Large roll – wait time -> Communication problem with GUI or external system

Large load time -> Program buffer, CUA buffer or screen buffer too small

Large database request times -> CPU/ memory bottleneck on database server, network problems, expensive SQL statements, database locks missing indexes, missing statistics, small buffers

Large CPU times -> Expensive ABAP processing, for example, processing large tables, frequent accessing of R/3 buffers

Processing time much larger than CPU time -> CPU bottlenecks, network problems, communication problems
R/3 Workload monitor (ST03N)

Problem: Wait time > 10% of response time!
Result: General performance problem.

Problem: High database time: database time > 40% of(response time – wait time)
Solution: Detailed analysis of the database.

Problem: Processing time > CPU time * 2
Solution: Detailed analysis of hardware bottlenecks.

Problem: Load time > 50 ms.
Solution: Detailed analysis of R/3 memory configuration (is the program buffer too small?)

Problem: Roll wait time or GUI time > 200 ms.
Solution: Detailed analysis of interfaces and GUI communication.



In the workload monitor, choosing transaction profile enables you to find out:
  • The most used transactions. Tuning these transactions creates the greatest improvements in the overall performance.

  • The average response times for typical R/3 transactions.


To access the statistical record of a specific server:

Transaction :   STAD after Release of 4.5
STAT before Release of 4.5

Transaction profile (Transaction ST03N) sorted by ‘Response time total’

Programs with high CPU time: CPU time > 40% (response time – wait time)
Detailed analysis with ABAP-TRACE (SE30)
Programs with high database time(database time > 40%(response time – wait time)
Detailed analysis of SQL Statements (ST05)

Problems with high GUI times (>200ms)

Solution: Network check



Workload Monitor

To display the 40 slowest dialog steps by response time, then choose Top time.

Under Goto -> profiles, you can access, for example:

Task type profile – Workload statistics according to work process type
Time profile – Workload statistics according to hour
Transaction profile – Workload statistics according to transaction

The proportion of database calls to database requests gives an indication of efficiency of table buffering. If access to information in a table is buffered in the R/3 pool buffers, then database calls to the database server are not needed and the performance is better. Thus fewer database calls result in database requests, the better.


Using transaction profile of ST03N, you find out:
Which transactions are used most? Tuning these transactions creates the greatest improvements in overall performance.

What are the average response times for typical R/3 transactions?

Thứ Tư, 1 tháng 2, 2012

SAP Workload Analysis - Chapter 2 Performance Analysis Monitors


Chapter 2 – PERFORMANCE analysis MONITORS



Process overview – SM50

Type of work process
Name of the ABAP program running
Operating system PID number
Client being used
Name of the job executing
Current action
Number of detected errors in the work process
Table being utilized
Semaphore resource being used.
CPU accumulation
Time in process accumulation
User holding the resource

If all work processes are being blocked by long running transactions, the above information is also available at the OS level using the program dpmon.

In an R/3 system with more than one instance, you can access global work processes overview using SM66.

Work process overview using SM50 and SM66

Work process in status “running”?
Action : “Dir.Read”, “Seq.Read”, “Insert”, “Update”, “Delete”,
“Commit”.
Solution : Detailed analysis of the database.

Action: “Load Program?”
Solution: Detailed analysis of R/3 memory configuration (program buffer too small?)

Action: “Roll in/Roll out”?
Solution: Detailed analysis of R/3 Memory configuration (problems with extended memory or roll buffer)

Work process in status “stopped”?
Reason: “PRIV”?
Solution: Detailed analysis of R/3 memory configuration (problems with extended memory or roll buffer)
Reason: “CPIC”?
Solutions: Problems with CPIC connections such as “All work processes blocked in destination system?”



ST06 – Operating system monitor

Important statistics displayed in the os monitor include:

è  CPU load average and % CPU utilization.
è  Operating system swapping and % memory utilization.
è  % disk utilization.
è  Operating system configuration parameters.
CPU bottlenecks are indicated during several snapshots by:
* Idle CPU < 10%
* Load Average: N processes waiting in front of the CPU.
Memory bottlenecks are indicated during several snapshots by:
* An increase in page outs for UNIX or page ins for NT.
Go to -> Current data -> Snap shot -> Top CPU users
  • This lists the top processes utilizing the maximum CPU time
  • “ Disp + work” signifies an R/3 work process.
  • “ORACLE80” signifies a database process.
  • “DOC_SYNDER”/”DR.WATSON” ETC., is an external processes which does not belong to an R/3 instance or to the database. External processes may affect performance critically.





Setups / Tune buffers – ST02



The setups/ Tune buffers monitor displays data on:

* Buffer sizes
* Buffer qualities (hit ratios)
  • Bottlenecks may be indicated if buffer swaps occur.
  • Choose detail analysis menu to display other data, such as:
* Memory usage
* Semaphores usage
* Table calls.


Maximum use (in KB) should be less than In Memory (in KB).
The lower part of the setups/Tune buffers monitor displays data on:
* Extended memory size and usage
* Usage and configuration of the roll mechanism
Bottlenecks may be indicated if:
  • For extended memory: Max use = In memory.
  • For roll area: Max. use > In memory.
Performance chart to be maintained for reference
CPU load
Allocated memory       2,087,664 MB
Physical memory                    2 GB
Top 5 Transactions     Related R/3 Modules               Related Response times
1. Session manager      1.  BASIS                                              1. 12
2. Auto ABAP              2. ABAP                                               2. 9
3. SU01                        3. BASIS                                               3. 4
4. ST03N                      4. BASIS                                               4. 3
5. (B) Others                5. Others                                             5. 1
Buffer Swaps:
Buffer:             NTAB                                       Amount: 0
Buffer:             Program                                  Amount: 0
Buffer:             Tables                                      Amount: 8
Buffer:             Export/Import             Amount: 0
Buffer:             Export/Import SHM                Amount: 0
Operating system paging: Yes            Amount:          30 KB/S
Work process overview – SM50
ST03 – Work load monitor
ST02 – Setup/Tune up buffers
An example for poor configuration
The program buffer is set to 110 MB (SAP instance profile parameter Buffer size is set to 110,000) and simulation of 10 users for each of MM, SD and PP is started.
An example for optimal configuration
The program buffer is set to 400 MB (SAP instance profile parameter Buffer size is set to 400,000) and the simulation is started. The program buffer is now big enough to hold all necessary code.
ST03N – workload analysis
ST02 – Tune summary

Thứ Ba, 31 tháng 1, 2012

SAP Workload Analysis - Chapter 3 R/3 Memory Management


R/3 memory areas introduces the various R/3 memory areas, which may be physically located in one or more of the following:
  • Local memory
  • Shared memory
  • File system
R/3 memory allocation explains what the different memory areas are used for.
After the demonstration and exercise, the topic Implementing R/3 extended memory compares memory management for different hardware platforms:
UNIX versus Windows NT
32 bit versus 64 bit architecture
This unit does not explain how large you should make the various memory areas.
R/3 memory areas
Users need two kind of memory:
R/3 buffers
Memory accessible to all users, for:
    • Programs
    • Table and field definitions
    • Customizing tables
User context
Memory attached to individual users, for:
    • Variables, lists, internal tables
    • Administrative data (Such as authorizations)
Physical and Virtual Memory
Maximum virtual memory <= Physical memory + operating system
swap space.
Unlike physical memory, virtual memory can be allocated. The os determines if the allocated memory area resides in the physical memory or in the os swap space.
Depending on the os, the maximum size of the virtual memory may vary between the size of the os swap space and the sum of physical memory and os swap space.
R/3 buffers contain global objects for all users and work processes, such as programs and customizing tables.
Shared memory is associated with all the processes of one instance. It is allocated at instance startup.
Extended memory contains user contexts – that is, objects associated with individual users, such as variables, lists and internal tables.
Heap memory – allocated on demand
Contains user contexts, for example, when extended memory is full
Is allocated and released on demand
R/3 paging memory contains:
ABAP objects such as extracts
Context-independent objects such as exports.
The six R/3 memory areas are
Buffers
Extended memory
Heap memory
Roll memory
R/3 paging memory – not to be confused with os paging!
Local work process memory
R/3 Memory allocation concepts
In and R/3 system, many front end    users are connected to one or more application servers. The work that users request from the system is performed in the work processes. Normally there are fewer work process than front end users.
A work process  is dedicated to a front end user only while a specific dialog step is being processed by the application server. A user can be dispatched to one work process in one dialog step, and to another work process in the following dialog step. Over the course of time, users are dispatched to different work processes.
In course of their work in dialog work process, users accumulate various piece of data, such as pointers to programs they are using. This accumulated data is called the “User context”.
Roll in/ Roll out process
Roll area and paging area.
Roll area in which User context objects such as authorizations, set/get parameters, internal tables and report lists are available.
Paging area stores the application program data that corresponds to specific ABAP commands including EXTRACT, IMPORT TO MEMORY, EXPORT FROM MEMORY and CALL TRANSACTION.
The size of these areas is configurable using R/3 profile parameters.
Where there is buffer space available, the roll area and the paging area are held in the respective buffers in the application servers. When there is not sufficient buffer space, the roll area and the paging area must be stored in the respective physical disk files (roll file and paging file).
The user data processed in the work processes is stored in two areas:
The roll file and its associated buffer.
The page file and its associated buffer
User contexts are not only stored in roll files and the corresponding buffers.
In R/3 extended memory, a large area of memory shared by all available work processes can be accessed through pointers. Using extended memory as well as roll files thus reduces the amount of copying from roll areas that is required during user context switches, and avoids the overload caused by large roll – in or roll-out tasks.
Allocation sequence for dialog work process
To keep the usage of the roll area to a minimum and make more use of extended memory, only a small portion of the roll area is used initially. The size of this portion is set by the parameter ztta/roll_first.
Note : Independent of parameter ztta/roll_first, there is a minimum amount of roll area that is always used. For example, if ztta/roll_first is set to 1, not just one byte is allocated, but the minimum amount required for administrative data.
Extended memory enables the data to be stored in your system, where it is efficiently accessed by pointers rather than a copy process.
The extended memory per user may vary from 1 MB to several 100 MB.
When the extended memory is full or until the user quota is reached…
The user quota defines the maximum amount of R/3 extended memory that can be used by any one user, and is set with the parameter ztta/roll_extension.
The user quota thus prevents one user from occupying all available extended memory.
The remaining portion of the R/3 roll memory is used when the system can no longer allocate R/3 extended memory, either because R/3 extended memory is full or because the quota has been reached.
The reason for using the remaining portion of R/3 roll memory is to avoid using heap memory, which is local memory, and avoid entering PRIV mode.
If the work process requires still more space after using up all available roll area and extended memory, the system is forced to allocate R/3 heap memory locally.
Heap memory allocated by one work process is not accessible to any other work process. This means that a user is unable to continue the transaction in a different work process.
The user is now effectively locked to the work process. This situation is called PRIV mode.
Since R/3 architecture uses a limited number of work processes to satisfy a larger number of front end users, other users suffer when a user goes in to PRIV mode.
If several users go into PRIV mode, they can work well, but other users can hardly work at all.
Data in R/3 roll memory is copied during context switch.
Data in R/3 extended memory is mapped during context switch.
Data in R/3 heap memory can never leave the work process. If heap memory is allocated, the work process is exclusively assigned to one user in PRIV mode.
Note: the sequence in which memory is used by work processes is not determined by the amount memory initially allocated. Thus, while the entire roll memory is allocated on work process start, it is not initially used up completely.
The memory allocation strategy for dialog work processes aims to prevent work processes from allocating R/3 heap memory and thus entering PRIV mode
When a work process enters PRIV mode, it remains connected to the user until the user ends the transaction.
Allocation sequence for non-dialog work process
Freeing heap memory
If the heap memory consumption of a work processes exceeds abap/heaplimit, after ending the transaction, the heap memory is automatically released and the wp restarted to release the swap space.
OS swap space is saved through parameter abap/heaplimit
Memory management parameters
Ztta/roll_first: Defines the first part of the roll area that is allocated to a dialog process.
Ztta/roll_area: Defines the total roll area per work process.
Rdisp/roll_SHM: Defines the size of the roll buffer.
Rdisp/roll_MAXFS: Defines the size of roll buffer and roll file.
Em/initial _size_MB: Defines the fixed size of extended memory.
Ztta/roll_extension: Defines the user quota for extended memory.
Abap/heap_area_dia: Defines the limit for the amount of local memory allocated to dialog work processes.
Abap/heap_area_nondia: defines the limit for the amount of local memory allocated to non-dialog work processes.
Abap/heap_area_total: defines the total amount of heap memory allocated to all work processes.
Here we can see that the extended memory set is completely in use.
Call the Setups/Tune buffers monitor (ST02) and choose detail analysis menu-> SAP memory -> Mode list. Here we can see that several work processes need to allocate R/3 heap memory.
The Work process Overview (SM50) shows that the work processes that need to allocate R/3 heap memory enter PRIV mode. These work processes are locked to one particular user.
Implementing R/3 extended memory
—————————————————————–
Zero Administration Strategy
Since on NT the parameter em/max_size_MB has a default value of 20,000, the size of R/3 extended memory is limited by the size of the address space of the NT paging file.
The parameter em/initial_size_MB is operating system dependent in that it is restricted by the address space of the work process.
For 32 bit architecture, address space is < 4 GB (in some operating systems even smaller).
For 64 bit architecture, the address space is <1.8 * 10 18 bytes.
SAP recommendations
For 32 bit architecture using em/initial_size_MB <=2GB, (even less for some os).
The amount of extended memory should be proportionate to the amount of physical memory.
The default value of ztta/roll_extension is 2 000 000 000 begin_of_the_skype_highlighting 2 000 000 000 end_of_the_skype_highlighting, which effectively deactivates this parameter. The limit for the user quota is given by the parameter em/address_space_MB.
One instance start, the extended memory is allocated by em/initial_size_MB
With NT, the amount of extended memory can increase dynamically upto em/max_size_MB, as long as the maximum virtual memory (that is , physical memory + swap space) is not yet exhausted.
There are no address space restrictions for extended memory, which is restricted only by the maximum virtual memory.
With NT, the recommendations for R/3 extended memory are more generous than under UNIX. However, parameter em/address_space_MB determines the user quota – that is the amount of R/3 extended memory, which may be used by one single user context.
The amount of extended memory should be proportionate to the amount of physical memory.
Hardware Capacity Verification
From Users point of View
Lengthy response time for transactions
From the systems point of view
CPU utilization is nearly 100%
High average number of processes waiting for CPU (load average)
High paging rates
Lengthy disk response times
Lengthy network response times – ping
Analyzing Hardware bottlenecks Road map – 1
Operating System Monitor – ST06
  1. CPU idle < 20% ?
  1. i. Is there CPU capacity on other servers that is idle?
    1. 1. Redistribute R/3 work processes and users.
  2. ii. Operating system monitors – ST06 – Top CPU Processes
    1. 1. R/3 work processes with high CPU utilization?
      1. a. Work process overview – SM50 or Systemwide work  process overview – SM66
        1. i. Detailed analysis of report or transaction
    2. 2. Database processes with high CPU utilization?
      1. a. Database process monitor – ST04
      2. b. Detailed analysis of SQL Statements
    3. 3. External processes with high CPU utilization?
      1. a. Stop or redistribute.
If there is a CPU bottleneck:
  1. If possible, redistribute load to other servers.
  2. To find out which processes are using most CPU, in the OS Monitor choose Detail analysis menu -> Top CPU processes. If the processes have high CPU utilization, proceed as follows:
    1. For R/3 work processes (‘disp + work’): Using the process ID indicated in Top CPU processes, identify the corresponding program name and user name in the Work process overview – SM50.
    2. For database processes – identify corresponding long running SQL statements in the Database Process Monitor. To access this monitor, call transaction ST04 (database overview), and choose Detail analysis menu.
    3. For external processes, find out whether the process can be stopped or redistributed.
Hardware analysis roadmap – 2
  1. Operating system monitor – ST06
    1. High paging rate (>20% of RAM per hour)?
  1. i. Memory capacity free on other servers?
    1. 1. Redistribute R/3 work processes and users
  2. ii. File system cache > 10 % of RAM?
    1. 1. Reduce file system cache
  3. iii. Setups/Tune buffers monitor – ST02 : Mode list
    1. 1. Programs / Transactions with high memory consumption.
      1. a. Detailed analysis of report or transaction.
  1. In the OS monitor – ST06, note the amount of memory indicated beside Physical memory available .
  2. Compare this figure with the paging rate.
    1. To obtain the paging rate, dbl click Pages in/s. The paging rates for the last 24 hours are displayed in the columns Paged in [Kb/h] and Paged out [Kb /h].
    2. If 20% of the total amount  of physical memory is greater than the amounts indicated in these columns, you can normally be sure there is no memory bottleneck.
  3. If there is a memory bottleneck:
    1. If possible, redistribute load to other servers.
    2. Check the size of the file system cache. If  necessary reduce the file system cache to < 10 % of the total physical memory.
    3. To identify users in their programs with high memory consumption, call the mode list for the extended memory. To do this, in the Setups/Tune buffers monitor – ST02, choose Detail analysis menu -> SAP memory -> Mode list.
Hardware Analysis Road map – 3
  1. Work load monitor – ST03N
    1. Wait time > 10% of response time
  1. i. General performance problem
    1. 1. High database time: database time >40% (response time – wait time)
      1. a. Detailed analysis of database
    2. 2. Processing time > CPU time * 2
      1. a. Detailed analysis of hardware bottleneck
    3. 3. Load time > 50 ms
      1. a. Detailed analysis of R/3 memory config. (program buffer too small?)
    4. 4. Roll in/ Roll out time > 20 ms
      1. a. Detailed analysis of R/3 memory configuration (problems with extended memory or roll buffer?)
This part of road map guides you in analyzing workload data when looking for hardware bottlenecks:
  1. Call the workload monitor – ST03N. In expert mode, choose detailed analysis -> last minute load. Select the current application server.
  2. in the statistics displayed, a hardware bottleneck may be indicated if the following figures are significantly high:
    1. Average wait time
    2. Average load time and average roll time
    3. Average database time
A high average wait time means all programs are running slowly and blocking the work process for a longer time. A high average load time and high average roll time mean that loading and rolling are slow. A high average database time means the database is running slowly and may indicate a hardware bottleneck on the database server.
From the statistics displayed, you can calculate the processing time as equivalent to the response time – the sum of wait time, database time, load time, roll time and enqueue time. A large processing time means the work processes are waiting for CPU while processing ABAP programs.
To calculate the processing time :
Processing time = Response time – wait time – Database time – Roll time – load time
= 6073 – 1562 – 2254 – 248 – 169 = 1840 ms
The processing time is thus more than twice the average CPU time:
1840 (processing time) / 546 (average CPU time) = 3.4
This indicates a resource bottleneck. In this example, the CPU bottle neck is caused by external operating system process consuming CPU.
Notice the large wait time, database time and load time.
To check for problems at operating system level, use the operating system monitor (transaction ST06). Notice high % CPU utilization: user 96%, system 4% , idle 0%.
Why is the CPU usage at almost 100% capacity?
From the operating system monitor – ST06, choose detail analysis menu -> Top CPU processes.
The DR_WATSON processes are not related to R/3 system or to the database and therefore are external processes.
One way of tuning the system in this case is to terminate the external processes that are creating an unnecessary load on the CPU.
Verify the solution by terminating the external processes and restarting the workload simulation.
Typically not all external processes but only the following runs on the database server:
R/3 work processes of the central instance.
The database processes required for the database.
These processes have to share the available CPU’s.
As the database server is being accessed from all application servers, the performance associated with the database access is critical for overall system performance.
Optimizing Memory configuration – 1
Memory for database (once per R/3 system)
Rule of thumb: 20% of the total physical memory (of all servers)
Memory of R/3 buffers (once per R/3 instance)
Approx. 500 to 800 MB (depends on applications used)
Memory for R/3 work processes
Approx. 12 MB per work process
R/3 extended memory
Approx. 10 to 20 MB per user
Optimizing Memory configuration – 2
Physical main memory (RAM)
Virtual memory should be < 2* the physical memory
Swap space
3 times physical memory
At least 2 GB
Workload
Number of active users
R/3 applications used
To check R/3 virtual memory allocation for a specific instance, in the Setups/Tune Buffers monitor- ST02, choose Detail analysis menu -> Storage. The total memory allocated for this instance is displayed beside virtual memory allocated. To this figure, add the virtual memory allocated to any other R/3 instance or database running on this server.
Compare the total virtual memory with the total physical memory. If the ratio is less than 3:2, you can normally be sure that there is no memory bottleneck.
If the ratio is greater than 3:2, check how much of the allocated virtual memory is really being used, especially in extended memory and the program buffer. To do this, in the initial screen of the transaction ST02, look at the columns Max. use [ KB] and In memory [KB].
Configuring CPU
For database : Rule of thumb : 10-30% of the total CPU of all servers.
Ensure that there is never a CPU bottleneck on the database server.
For update processing : Rule of thumb : 10 – 20% of the total CPU for all servers.
For dialog/background processing : No general recommendation for CPU per user.
CPU required depends on applications used.
Example on a server with 2GB memory :
R/3 Buffers (without roll and paging) : 700 MB
Program buffer:                                                      500 MB
R/3 table buffers:                                        110 MB.
Extended, roll and paging in shared memory 1500 MB
18 work process                                                                     120 MB
Virtual memory allocated for R/3                              2.3 GB
Memory allocated for database                                   500 MB
The following R/3 parameter settings are configured in the R/3 system used in this course:
Nametab          buffers:
-       rsdb/ntab/entrycount: 30 000
-       rsdb/ntab/ftabsize: 30 000
-       rsdb/ntab/irdbsize: 4000
-       rsdb/ntab/sntabsize: 2500
Program / CUA/ presentation buffers:
-       abap/buffersize: 500 000
-       rsdb/cua/buffersize: 5000
-       zcsa/presentation_buffer_area: 20 000 000
-       sap/bufdir_entries: 4500
Table buffers:
-       zcsa/table_buffer_Area: 70 000 000
-       rtbb/buffer_length: 40 000