Section 15.4. Application-Level Shared Memory


15.4. Application-Level Shared Memory

DB2 only allocates application-level shared memory in a partitioned database environment, or when intra-partition parallelism or the connection concentrator is enabled. DB2 uses the application shared memory:

  • For coordinating and sending messages between the DB2 agent processes that are working on behalf of an application

  • To keep the state of the application when it gets moved to a logical agent when the connection concentrator is being used

15.4.1. Application Group Shared Memory

To facilitate easier and more efficient messaging and coordination of the agents working for the same application, DB2 arranges agents into application groups so that they can communicate using the application group shared memory. The application group memory is allocated in a database-level shared memory set, and the configuration parameter APPGROUP_MEM_SZ specifies its size.

Although this memory is used to speed up communication between agents working on the same application, DB2 does not create one application group for every application. DB2 can assign multiple applications to the same application group; the number of applications that can be assigned to an application group is calculated using:

 appgroup_mem_sz / app_ctl_heap_sz 

Within an application group, each application has its own application control heap. In addition, a portion of the application group shared memory is reserved for the application group shared heap. Figure 15.4 illustrates this.

Figure 15.4. Application group shared memory


Given the following database configuration:

 Max size of appl. group mem set (4KB) (APPGROUP_MEM_SZ) = 40000 Max appl. control heap size (4KB)     (APP_CTL_HEAP_SZ) = 512 Percent of mem for appl. group heap   (GROUPHEAP_RATIO) = 70 

let's examine the memory usage for applications connecting to this database.

  • If the application group shared memory set is approximately 160MB:

    40,000 pages x 4K per page = 160MB

  • If the size of the application group shared heap is approximately 114MB:

    40,000 x 70%= 28,000 4K pages = 114MB

  • If the number of applications that can fit into this application group is 78:

    40,000/512 = 78

  • If the application control heap for each of the applications is approximately 600K:

    (10070)% x 512 = 153 4K pages = 0.6MB

The APP_CTRL_HEAP_SZ parameter is not the size of the individual application control heap for each application in the application group; it is only used to calculate the number of applications that can fit into an application group. The real application control heap size of each application is calculated using the formula:

((100 GROUPHEAP_RATIO)% x APP_CTRL_HEAP_SZ)

As this formula shows, the larger that you set the GROUPHEAP_RATIO, the larger the application group shared heap will be and the smaller the application control heap for each application will be.

For the example configuration above, there are 400 applications connected to the database during the busiest time of the day. Since each application group can hold 78 applications, you will need 400/78, or 6 application groups, to be able to hold all 400 applications. Make sure that your system has enough memory to handle this; otherwise you may receive out of memory errors.



Understanding DB2(R. Learning Visually with Examples)
Understanding DB2: Learning Visually with Examples (2nd Edition)
ISBN: 0131580183
EAN: 2147483647
Year: 2004
Pages: 313

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net