개요
max session count를 얼마나 설정해야 할지 판단이 어려운 경우에 대해 설명합니다.
방법
각 세션은 PGA와 SGA로 메모리를 일부 할당받기 때문에, max session 값을 무한정 크게 설정할 수는 없습니다. 무리하게 값을 높이면 아래와 같은 현상(*장애 예시)이 발생합니다.
Tibero의 경우 max session 값을 기준으로 프로세스 수를 자동 계산합니다.
(기본적으로 1개의 프로세스가 10개의 세션을 처리하도록 구성되어 있으며, 필요에 따라 더 늘릴 수 있습니다)
별도의 상한값 제한은 없지만, 할당된 메모리 크기에 따라 설정 가능한 세션 수가 달라지므로, 실제 시스템 자원을 고려하여 적정 수준으로 설정해야 합니다.
* 장애 예시
SHM 2G
TARGET 3G
MAXSESSION 600
[tibero@rprmdb sql]$ tbdown;tbboot
sess: 71 user: SYS
There are active session(s).
1. [W]ait until sessions are closed.
2. Shutdown [I]mmediately.
3. [Q]uit without shutting down.
Select action. (Default: 3): I
Tibero instance terminated (IMMEDIATE mode).
Listener port = 8629
*****************************************************
* Warning !!!
* Shared memory size is too small.
* Enlarge shared memory size(TOTAL_SHM_SIZE).
* Current size: 2147483648 bytes
* Minimum size: 2666426440 bytes
*****************************************************
Tibero instance startup failed!
Out of memory (unable to allocate 496 bytes of shared pool memory for SLAB_ALLOCATOR).
Out of memory (unable to allocate 496 bytes of shared pool memory for SLAB_ALLOCATOR).
Out of memory (unable to allocate 496 bytes of shared pool memory for SLAB_ALLOCATOR).
SHM 2G
TARGET 3G
MAXSESSION 500
[tibero@rprmdb sql]$ tbboot
"tbdown clean" is executed automatically.
Listener port = 8629
*****************************************************
* Warning !!!
* Shared memory size is too small.
* Enlarge shared memory size(TOTAL_SHM_SIZE).
* Current size: 2147483648 bytes
* Minimum size: 2472394872 bytes
*****************************************************
Tibero instance startup failed!
Out of memory (unable to allocate 496 bytes of shared pool memory for SLAB_ALLOCATOR).
Out of memory (unable to allocate 496 bytes of shared pool memory for SLAB_ALLOCATOR).
Out of memory (unable to allocate 496 bytes of shared pool memory for SLAB_ALLOCATOR).
Out of memory (unable to allocate 496 bytes of shared pool memory for SLAB_ALLOCATOR).
Out of memory (unable to allocate 496 bytes of shared pool memory for SLAB_ALLOCATOR).
Out of memory (unable to allocate 496 bytes of shared pool memory for SLAB_ALLOCATOR).
Out of memory (unable to allocate 496 bytes of shared pool memory for SLAB_ALLOCATOR).
Out of memory (unable to allocate 496 bytes of shared pool memory for SLAB_ALLOCATOR).
SHM 2G
TARGET 3G
MAXSESSION 400
[tibero@rprmdb sql]$ tbboot
"tbdown clean" is executed automatically.
Listener port = 8629
*****************************************************
* Warning !!!
* Shared memory size is too small.
* Enlarge shared memory size(TOTAL_SHM_SIZE).
* Current size: 2147483648 bytes
* Minimum size: 2288397224 bytes
*****************************************************
Tibero instance startup failed!
Out of memory (unable to allocate 496 bytes of shared pool memory for SLAB_ALLOCATOR).
Out of memory (unable to allocate 496 bytes of shared pool memory for SLAB_ALLOCATOR).
Out of memory (unable to allocate 496 bytes of shared pool memory for SLAB_ALLOCATOR).
Out of memory (unable to allocate 496 bytes of shared pool memory for SLAB_ALLOCATOR).
Out of memory (unable to allocate 496 bytes of shared pool memory for SLAB_ALLOCATOR).
SHM 2G
TARGET 3G
MAXSESSION 300
tibero@rprmdb sql]$ tbboot
"tbdown clean" is executed automatically.
Listener port = 8629
Tibero 6
TmaxData Corporation Copyright (c) 2008-. All rights reserved.
Tibero instance started up (NORMAL mode).
[tibero@rprmdb sql]$ free -h
total used free shared buff/cache available
Mem: 3.7G 501M 1.5G 1.2G 1.8G 1.8G
Swap: 3.9G 0B 3.9G
SQL
복사
일반적인 OLTP 환경에서는 세션 하나당 최소 10MB 정도의 PGA가 할당된다고 가정하고 MAX_SESSION_COUNT 값을 결정합니다.
예를 들어, 1GB의 메모리가 있다면 약 100개의 세션을 운용할 수 있다고 봅니다.
DW(데이터 웨어하우스) 형태의 환경이라면 메모리 할당량을 늘리기를 권장합니다.
설정 예시
MAX_SESSION_COUNT=200 #최대 허용 예상치
TOTAL_SHM_SIZE=2G
MEMORY_TARGET=3G
SQL
복사
위와 같이 설정한 경우, 약 2GB 정도가 PGA에 할당 가능한 메모리이므로, 최대 200개 정도의 세션 설정이 가능합니다.
어느 정도 여유를 두고 설정한 뒤, 추후 세션이 부족해질 경우 시스템의 메모리 가용 한도 내에 MAX SESSION 값을 조정할 것을 권장합니다.