program buffer handling

11
Program Buffer Handling Created on: January 19, 1997 Revised on: January 19, 1997 From R/3 Release: 30C,40 A t o: 31Z,4 0B OS Platform: Independent DB System: Independent Table of Contents Summary Overview o Program Buffer During Startup and Shutdown o Program Buffer Structure o Files pxanew and pxastat o Monitoring o Parameters Recommendations o Limitations Related Information Copyright Summary This article describes the behavior of program buffers when an R/3 instance is started and stopped, and what causes objects to be displaced from the buffer. Overview When you start an R/3 instance, you can influence the performance of the program buffers by using appropriate parameter settings. You can also optimize the time needed by the R/3 System to attain stable operation after start up. The following description is for the program buffer. [ Back to Top ] /home/website/convert/temp/convert_html/ 55cf94e8550346f57ba53cd6/document.doc Page 1 of 11

Upload: papusaha

Post on 27-Dec-2015

18 views

Category:

Documents


0 download

DESCRIPTION

buffering

TRANSCRIPT

Page 1: Program Buffer Handling

Program Buffer HandlingCreated on:  January 19, 1997Revised on:  January 19, 1997From R/3 Release: 30C,40A to: 31Z,40BOS Platform:  IndependentDB System:  Independent

Table of Contents

Summary Overview

o Program Buffer During Startup and Shutdown o Program Buffer Structure o Files pxanew and pxastat o Monitoring o Parameters

Recommendations o Limitations

Related Information Copyright

Summary

This article describes the behavior of program buffers when an R/3 instance is started and stopped, and what causes objects to be displaced from the buffer.

Overview

When you start an R/3 instance, you can influence the performance of the program buffers by using appropriate parameter settings. You can also optimize the time needed by the R/3 System to attain stable operation after start up. The following description is for the program buffer.

[ Back to Top ]

Program Buffer During Startup and Shutdown

Starting the R/3 instance

1. The R/3 instance reads file pxanew and then pxastat from the instance work directory \usr\sap\<SID>\<Instance>\work.

2. The second dialog work process (DIA 1) fills the program buffer (PXA) up to a maximum fill level of 60%. See also: parameter abap/pxa_preload in this article. If the fill level is reached, no more data is loaded into the buffer. You can view

/tt/file_convert/55cf94e8550346f57ba53cd6/document.doc Page 1 of 8

Page 2: Program Buffer Handling

a message in the trace file of the work process (dev_w1) (as of Release 3.0F).

3. File pxanew is renamed pxastat.

Normal R/3 operation

1. The system is now up. When further programs are called, these programs are loaded into the program buffer. Each program is assigned a counter, which increases by one for each access.

2. Now, further programs are loaded in the buffer, as needed. Programs can now be displaced from the buffer. See also: Physical View in this article.

3. Using Transaction ST02, you can display the current program buffer contents. See also Monitoring in this article.

Stopping the R/3 instance

1. During shutdown of the R/3 instance, the program buffer contents are written to file pxanew. However, not all buffer entries are selected. See also: Files pxanew and pxastat: Selection criteria in this article

[ Back to Top ]

Program Buffer Structure

Logical View

For each program that is loaded, a directory entry is also written, which points to the start address (sector and offset) of the program in the buffer.

Physical View

One directory entry is reserved for every 8 KB of data in the buffer.

Default setting: for each 8KB of data in the buffer one directory entry is reserved. Otherwise the following formula is used:

/tt/file_convert/55cf94e8550346f57ba53cd6/document.doc Page 2 of 8

Page 3: Program Buffer Handling

X = abap/buffersize DIV abap/programs (where X=8KB is set, if the formula returns the value X>8KB)

The data area of the program buffer is subdivided into 4KB blocks. Therefore, a program always fills N*4KB of freespace in the data area.

Sectors in the Program Buffer

Programs are allocated according to the size of specific sectors (PX1, PX2, PX3). Prior to Release 3.1H, the length of a program determined its total size. As of Release 3.1H, the size is reduced to the length that is relevant to the runtime object. In the following table, size is used instead of length.

Directory Section

Number of Entries in the Directory

Offset in the Data Area of the Program Buffer(Unit: 4 Byte Word)

1st Sector type (PX1)(3 bit for session)

Max. 2048 references to programs (11 bit)

Contains programs with sizes < 1MB (18 bit)

2nd Sector type (PX2)(3 bit for session)

Max. 32768 references to programs (15 bit)

Contains programs with sizes < 64KB (14 bit)

3rd Sector type (PX3) (3 bit for session) (new in Release

Max. 8192 references to programs (13 bit)

Contains programs with sizes < 256 KB (16 bit)

/tt/file_convert/55cf94e8550346f57ba53cd6/document.doc Page 3 of 8

Page 4: Program Buffer Handling

3.1H)

Fragmentation and Displacement

Programs are displaced according to the LRU algorithm (Last Recently Used).

If a program is loaded in the buffer, an LRU list is updated. When a program is accessed, a program is placed at the top of the list. The longer a program is not called, the further it is pushed down the LRU list.

If the program buffer is too small, the programs at the end of the list are displaced from the buffer to create space for a new program or a program that is to be reloaded.

Since a program at the end of the LRU list may be located in the middle of a buffer, gaps occur during displacement. These gaps can be filled only with programs smaller than or the same size as the gap. The more displacement that occurs, the greater the fragmentation in the program buffer, caused by new gaps.

If the program buffer is divided into sections, the buffer may behave differently. In this example, a displacement occurs even though there is enough free space in the buffer program:

1. The first 2048 directory entries are all filled, but subsequent directory entries are empty.

2. The buffer data area also contains enough free space.

3. Program d, which is greater than 256KB, is called and must now be loaded in the buffer. Due to its size, this program can only be loaded in section PX1.

4. The program is larger than the largest gap in section PX1.

5. Now a large enough gap must be found. The system examines the oldest programs according to the LRU statistics and a maximum of 5 of their (unlocked) successors.

6. In this example, the search was successful and found Program c, a and y. Program d displaces c, a and y from the buffer. The buffer now contains a new gap (Reset) and two directory entries (no. 3 and 4) that can no longer be used.

/tt/file_convert/55cf94e8550346f57ba53cd6/document.doc Page 4 of 8

Page 5: Program Buffer Handling

[ Back to Top ]

Files pxanew and pxastat

These files contain a list of program names that were present in the program buffer the last time the R/3 instance was shut down. This list consists of two columns:

1. Column: x

2. Column: Name of an ABAP report that was contained in the program buffer.

Selection Criteria

The R/3 instance contains a used count counter for each program. When a program is called, the counter increases by one. A low used count indicates that a program has not been called very often, or has not been called for a long time. Programs with a high used count were called very often and were probably also called very recently.

When the R/3 instance is shut down, files pxanew and pxastat are created. However, not all of the programs in the buffer are written to the files. The following selection and sorting criteria are used:

Release 3.0C to 3.1G:

Programs with names that do not begin with a % sign

/tt/file_convert/55cf94e8550346f57ba53cd6/document.doc Page 5 of 8

Page 6: Program Buffer Handling

Programs with a used count greater than 1 The remaining programs are written to file pxanew, and are sorted in descending

order by used count. A maximum of 1024 programs can be written to file pxanew. When the maximum

is reached, the file is closed, and the rest is truncated.

As of Release 3.1H:

Programs with names that do not begin a % sign Programs with a used count greater than 1 The remaining programs are written to file pxanew, and are sorted in descending

order by size class (<64KB, <256KB, >= 256KB). Programs in the same size class are sorted in descending order by used count.

A maximum of 1024 programs can be written to file pxanew. When the maximum is reached, the file is closed, and the rest is truncated.

NOTE: If you sort the list in Transaction ST02 by used count and compare it with file pxanew you will see that the orders are different. This is because when the instance is stopped, several internal system programs are called repeatedly, which changes their used count.

[ Back to Top ]

Monitoring

To display the buffers located in the programs, use Transaction ST02. Choose Detail analysis menu Program Buffered objects.

To display the size, used count and offset for each program in the buffer, choose PXA buffer technical. You can sort this list, and download the sorted list to a file. If the data format is manually adapted to the format of pxanew, you can use your own pxanew files the next time the instance is started.

NOTE: Manual changes to file pxanew can influence the behavior of the program buffer. The sequence of programs in file pxanew determines the initial assignment of buffers, and therefore influence the time and frequency of buffer displacements.

[ Back to Top ]

Parameters

Abap/pxa = shared (Default setting: do not change)

Parameter abap/programs is automatically calculated.

/tt/file_convert/55cf94e8550346f57ba53cd6/document.doc Page 6 of 8

Page 7: Program Buffer Handling

For parameter abap/pxa=shared, the calculation formula abap/programs = abap/buffersize DIV 8 is used.

If parameter abap/programs is set explicitly in the instance profile, and the calculation formula returns a value larger than 8KB, abap/programs is automatically set to abap/buffersize DIV 8. This ensures that a directory entry exists for every 8KB in the buffer.

Parameter abap/buffersize determines the program buffer size in KB (1024 bytes). In the R/3 System, the program buffer is administered with the SHM key 06. See also: parameter ipc/shm_psize_06.

Parameter abap/pxa_preload (default: 60) determines the fill level of the program buffer when the instance is started. The preload phase is stopped at 60% (default: abap/pxa_preload=60).

NOTE: This parameter can be changed, even if it is not documented. Changing the parameter creates an error message when the profile is checked using the Transaction RZ10. The message displays the change as an unknown parameter.

Using parameter ipc/shm_psize_06, the program buffer can be set for UNIX systems outside of an SHM pool (ipc/shm_psize_06 = 0) or in the SHM pool 10 (ipc/shm_psize_06 = -10). The parameter has no effect on operating systems other than UNIX, because SHM pools are only implemented for UNIX.

Recommendations

The parameters in this article should not be set in DEFAULT.PFL.

The Dispatcher Administration buffer (Key 02) and the program buffer (Key 06) must be in the same SHM pool (only for UNIX). Example:either: ipc/shm_psize_02 = 0 and ipc/shm_psize_06 = 0or: ipc/shm_psize_02 = -10 and ipc/shm_psize_06 = -10

For Windows NT, the parameter settings must not be changed on the operating system level when the system is running. If the R/3 instance stops and then restarts a work process, Windows NT reads the changed profile. This causes memory-access errors because, the work processes are attempting to address areas of different sizes.

Recommendations for abap/pxa_preload:

Background: the value chosen is greater than 60, and on the basis of the sort of file pxanew, many smaller programs are loaded first (size <64KB). Programs may be displaced and reloaded early. (See also: Fragmentation and Displacement).

/tt/file_convert/55cf94e8550346f57ba53cd6/document.doc Page 7 of 8

Page 8: Program Buffer Handling

Solution a): Specify a value for abap/pxa_preload that is smaller than 60. The instance needs more time to reach stable operation (initial loading). However, the displacement occurs later, because large programs are loaded before the limit of 2048 directory entries.

Solution b): Specify a value for abap/pxa_preload that is larger than 60 and sort file pxanew, so that all large programs (>256KB) are loaded before midsize (<64KB) and small programs (<64KB).

Limitations

For the operating system AIX (up to Release 4.1.x), there is a maximum of 256 MB per SHM segment. The program buffer (abap/buffersize) is therefore limited to 262144KB. If the program buffer is in pool 10, the maximum size of SHM pool 10 (ipc/shm_psize_10) is 268435456 bytes.

For other operating systems, the maximum program buffer size is dependent upon the following sizes:

Maximum size of the operating system, approximately 2GB Maximum SHM segment size of the operating system and, for UNIX systems

except AIX, the actual value set in the kernel (UNIX kernel parameter SHMMAX) If the program buffer is in pool 10, these limitations apply to SHM pool 10 (ipc/shm_psize_10)

If the program buffer setting is significantly different from the correct setting, the R/3 instance uses an emergency setup (4000KB buffer, 500 programs). The instance can be started, but due to the permanent displacement in the buffer high-performance operation of is not possible See also OSS Note 77833.

Related Information

BC315, Chapter The Program Buffer as Bottleneck

R/3 Knowledge Product (COE) CD System Monitoring

Online Documentation CD Basis Components CCMS Program Buffer

OSS Notes 23642, 77833

SAP TechNet Knowledge Base ArticleTopic:  System MonitoringSubtopic:  Tuning/PerformanceKeywords: Program Buffer, PXA, ST02   SAP Home Page: http://www.sap.com

/tt/file_convert/55cf94e8550346f57ba53cd6/document.doc Page 8 of 8