15.4. Application-Level Shared MemoryDB2 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:
15.4.1. Application Group Shared MemoryTo 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 memoryGiven 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.
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:
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. |