DB2 is very interesting database product which can grow in size as much you want,
literally from couple MBs
to Multi-Terabytes. Capacity totally depends on a) Disk where the
real data will be stored, b) Memory allocation which is utilized to
process the multi-terabytes
of data to end users.
Lets talk how DB2 manages memory : DB2 memory is allocated in terms of shared memory
Lets talk how DB2 manages memory : DB2 memory is allocated in terms of shared memory
and private memory.
Shared memory is the one which is being shared by all of the db2 agents
and gets allocated
as soon as Instance/database is started. Whereas private memory is the
one which is used by db agents individually.
Let's understand first about the shared memory : This is allocated at 3 different levels :
1. Instance
2. Database
3. Application
Instace level shared memory is allocated when its started, and its de-allocated as soon
Let's understand first about the shared memory : This is allocated at 3 different levels :
1. Instance
2. Database
3. Application
Instace level shared memory is allocated when its started, and its de-allocated as soon
as you stop it. Its been
controlled through following Instance configuration parameters :
MON_HEAP_SZ
AUDIT_BUF_SZ
FCM_NUM_BUFFERS
Database level shared memory is allocated when its either activated explicitly or with the
first db connection, and
de-allocated when its either deactivated explicitly or with the reset
of last db connection.
BUFFERPOOL
PACKAGE CACHE
CATALOG CACHE
LOCKLIST
DATABASE HEAP
UTILITY HEAP
SHARED SORT HEAP (if INTRA_PARALLEL is enabled)
Application level shared memory is not allocated in every situation. It gets allocated when the
PACKAGE CACHE
CATALOG CACHE
LOCKLIST
DATABASE HEAP
UTILITY HEAP
SHARED SORT HEAP (if INTRA_PARALLEL is enabled)
Application level shared memory is not allocated in every situation. It gets allocated when the
database agents need to
coordinate with each other. This happens in a specific scenario when
you have either multi-partitioned database or have enabled the
intra_parallel configuration in a
single partitioned database. In these specific scenario, a
single db agent forks the multiple
subagents to serve the
request in parallel but still share the same application memory which
was allocated to their
parent agent.
APP_GROUP_MEM_SZ
GROUPHEAP_RATIO
APP_CTL_HEAP_SZ
Private memory Its allocated through a database connection when its assigned to a database
agent. Its usage
is very dynamic and totally depends on how long that specific agent is
busy
in processing the request. This memory is utilized to perform
sort,to acquire lock,to build the
access plan of SQL etc.
APPLICATION HEAP
SORTHEAP
STATEMENT HEAP
STATISTICS HEAP
QUERY HEAP
JAVA INTERPRETER HEAP
You can monitor the usage of these memory allocation using db2mtrk or DB2PD
utility and you can keep
re-adjusting based on the database size growth and its utilization.
No comments:
Post a Comment