SHARED_SESSION 프로퍼티를 테스트하며
gserver, balancer, gdispatcher 로직 확인
SHARED_SESSION
shared 모드를 활성화 여부를 설정한다. 이 값을 NO로 설정하면 load-balancer(gbalancer), dispatcher(gdispatcher), shared-server(gserver)가 실행되지 않는다
SHARED_SESSION 모드를 켜야 gserver, gdispatcher, gbalancer 구동 됨.
근데 listener나 odbc 설정은 dedicated가 기본이란말이지?
DA모드로 붙으면 저 10개의 gserver를 쓰는건가?
NO. DA모드로 붙으면 gserver와 아예 상관이없음. 프로세스를 통하지않고 그냥 바로 attach 하는 것.
기본이 YES
select * from v$property where property_name = 'SHARED_SESSION'
gSQL> \\
PROPERTY_NAME # SHARED_SESSION
DESCRIPTION # shared session
DATA_TYPE # BOOLEAN
STARTUP_PHASE # MOUNT BELOW
VALUE_UNIT # NONE
PROPERTY_VALUE # YES
PROPERTY_SOURCE # DEFAULT
INIT_VALUE # YES
INIT_SOURCE # DEFAULT
MIN_VALUE # 0
MAX_VALUE # 1
SES_MODIFIABLE # FALSE
SYS_MODIFIABLE # IMMEDIATE
IS_MODIFIABLE # TRUE
IS_GLOBAL # null
1 row selected.
gserver는 일종의 작업 서버로써 클라이언트에서 요청한 명령을 수행하는 서버이다.
리스너 프로세스는 클라이언트/서버 환경에서 네트워크를 통한 원격 접속을 가능하게 한다.
리스너 프로세스는 LISTEN_PORT로 클라이언트 접속을 기다리며,
클라이언트 접속시 dedicated모드이면 새로운 gserver를 구동하여 클라이언트와 연결시키고
shared 모드이면 load-balancer(gbalancer)를 통하여 부하가 적은 dispatcher(gdispatcher)를 선택하여 클라이언트와 연결시킨다.
glsnr default 모드는 DEDICATED
# default c/s mode : default is selected by the client ( DEDICATED | SHARED )
# DEFAULT_CS_MODE = DEDICATED
odbc
# CS_MODE : [DEFAULT|DEDICATED|SHARED]
# CS_MODE = DEFAULT
STANDALONE에서..
[ SHARED_SESSION = NO 테스트 ]
gSQL> alter system set SHARED_SESSION = no;
ERR-HY000(13014): Unable to change property at this startup phase.(SHARED_SESSION)
gSQL> shutdown
Shutdown success
gSQL> startup nomount
Startup success
gSQL> alter system set SHARED_SESSION = no;
System altered.
gSQL> alter system open database;
ERR-42000(16117): database is not mounted
gSQL> alter system mount database;
System altered.
gSQL> alter system open database;
System altered.
SHARED_SESSION = NO 하면, gserver와 gdispatcher 구동 안됨.
gSQL> select TOP_LAYER, CONNECTION, STATUS, SERVER, PROGRAM from x$session order by PROGRAM;
TOP_LAYER CONNECTION STATUS SERVER PROGRAM
--------- ---------- --------- --------- ------------------------
12 DA CONNECTED DEDICATED gmaster
12 DA CONNECTED DEDICATED gmaster: ager
12 DA CONNECTED DEDICATED gmaster: archiver
12 DA CONNECTED DEDICATED gmaster: checkpoint
12 DA CONNECTED DEDICATED gmaster: cleanup
12 DA CONNECTED DEDICATED gmaster: database writer
12 DA CONNECTED DEDICATED gmaster: i/o slave(0)
12 DA CONNECTED DEDICATED gmaster: log writer
12 DA CONNECTED DEDICATED gmaster: monitor
12 DA CONNECTED DEDICATED gmaster: timer
12 DA CONNECTED DEDICATED gmon
13 DA CONNECTED DEDICATED gsql
12 rows selected.
sunje:~
$ ps -ef | grep sunje
sunje 29253 1 0 14:07 ? 00:00:00 glsnr --start --msgqkey=22581
sunje 30387 1 1 14:15 pts/1 00:00:04 gmaster --msgqkey=22581
sunje 30429 30387 0 14:16 pts/1 00:00:00 gmon --start --no-copyright --silent --msgqkey=22581
SHARED_SESSION = NO로 하고
odbc 설정을 CS_MODE = DEDICATED로 해서 CS로 붙어보면,
DA로 붙으면 gserver 안생기고,
CS로 붙으면 gserver 하나씩 생성됨 (근데 x$session에서는 확인이 안된다!? OK 손현웅수석님께 확인했음!! CS Dedicated 모드로 붙으면, gsqlnet이 곧 그 gserver. gsqlnet = 생성된 gserver)
- SHARED_SESSION = NO, CS_MODE = DEDICATED로 gsqlnet 3개 세션, gsql 2개 세션 붙은 상태
gSQL> select TOP_LAYER, CONNECTION, STATUS, SERVER, PROGRAM from x$session order by PROGRAM;
TOP_LAYER CONNECTION STATUS SERVER PROGRAM
--------- ---------- --------- --------- ------------------------
12 DA CONNECTED DEDICATED gmaster
12 DA CONNECTED DEDICATED gmaster: ager
12 DA CONNECTED DEDICATED gmaster: archiver
12 DA CONNECTED DEDICATED gmaster: checkpoint
12 DA CONNECTED DEDICATED gmaster: cleanup
12 DA CONNECTED DEDICATED gmaster: database writer
12 DA CONNECTED DEDICATED gmaster: i/o slave(0)
12 DA CONNECTED DEDICATED gmaster: log writer
12 DA CONNECTED DEDICATED gmaster: monitor
12 DA CONNECTED DEDICATED gmaster: timer
12 DA CONNECTED DEDICATED gmon
13 DA CONNECTED DEDICATED gsql
13 DA CONNECTED DEDICATED gsql
13 TCP CONNECTED DEDICATED gsqlnet
13 TCP CONNECTED DEDICATED gsqlnet
13 TCP CONNECTED DEDICATED gsqlnet
16 rows selected.
$ ps -ef | grep sunje | grep gserver
sunje 31664 1 0 14:40 pts/0 00:00:00 gserver --dedicated /tmp/unix-glsnr.22581 -x 2
sunje 31814 1 0 14:42 pts/0 00:00:00 gserver --dedicated /tmp/unix-glsnr.22581 -x 3
sunje 31896 1 0 14:42 pts/0 00:00:00 gserver --dedicated /tmp/unix-glsnr.22581 -x 4
sunje 31905 20622 0 14:42 pts/0 00:00:00 grep --color=auto gserver
일단…
SHARED_SESSION 프로퍼티는, CS세션이 SHARED MODE로 붙을 수 있는지 여부만을 설정하는 거라면…
SHARED_SESSION=NO로 하고, odbc CS_MODE=SHARED로 붙어보면 연결 안됨? ㅇㅇ
sunje:~
$ cat .odbc.ini | grep CS_
CS_MODE = SHARED
sunje:~
$ gsqlnet sys gliese
Copyright © 2010 SUNJESOFT Inc. All rights reserved.
Release Venus.3.1.21 revision(26519)
ERR-HY000(45006): Operation timed out
odbc 프로퍼티 중, CS_MODE의 DEFAULT는 listener 프로퍼티 파일의 CS_MODE 모드임.
$ cat $GOLDILOCKS_DATA/conf/goldilocks.listener.conf | grep CS_
# DEFAULT_CS_MODE = DEDICATED
DEFAULT_CS_MODE = SHARED
sunje:~
$ cat .odbc.ini | grep CS_
CS_MODE = DEFAULT
sunje:~
$ gsqlnet sys gliese
Copyright © 2010 SUNJESOFT Inc. All rights reserved.
Release Venus.3.1.21 revision(26519)
ERR-HY000(45006): Operation timed out
STANDALONE에서..
[ SHARED_SESSION = YES 테스트 ]
일단 dispatcher가 두개 구동된건
프로퍼티 DISPATCHERS =2 로 기본 설정되어있기 때문…
gserver가 10개 구동된건
프로퍼티 SHARED_SERVERS = 10 로 기본 설정되어있기 때문…
gSQL> select TOP_LAYER, CONNECTION, STATUS, SERVER, PROGRAM from x$session order by PROGRAM;
TOP_LAYER CONNECTION STATUS SERVER PROGRAM
--------- ---------- --------- --------- ------------------------
12 DA CONNECTED DEDICATED balancer
12 DA CONNECTED DEDICATED dispatcher
12 DA CONNECTED DEDICATED dispatcher
12 DA CONNECTED DEDICATED dispatcher(send thread)
12 DA CONNECTED DEDICATED dispatcher(send thread)
12 DA CONNECTED DEDICATED gmaster
12 DA CONNECTED DEDICATED gmaster: ager
12 DA CONNECTED DEDICATED gmaster: archiver
12 DA CONNECTED DEDICATED gmaster: checkpoint
12 DA CONNECTED DEDICATED gmaster: cleanup
12 DA CONNECTED DEDICATED gmaster: database writer
12 DA CONNECTED DEDICATED gmaster: i/o slave(0)
12 DA CONNECTED DEDICATED gmaster: log writer
12 DA CONNECTED DEDICATED gmaster: monitor
12 DA CONNECTED DEDICATED gmaster: timer
12 DA CONNECTED DEDICATED gmon
13 DA CONNECTED DEDICATED gsql
12 DA CONNECTED DEDICATED shared server(0)
12 DA CONNECTED DEDICATED shared server(1)
12 DA CONNECTED DEDICATED shared server(2)
12 DA CONNECTED DEDICATED shared server(3)
12 DA CONNECTED DEDICATED shared server(4)
12 DA CONNECTED DEDICATED shared server(5)
12 DA CONNECTED DEDICATED shared server(6)
12 DA CONNECTED DEDICATED shared server(7)
12 DA CONNECTED DEDICATED shared server(8)
12 DA CONNECTED DEDICATED shared server(9)
27 rows selected.
$ ps -ef | grep sunje
sunje 31659 1 0 14:40 pts/0 00:00:00 glsnr --start --msgqkey=22581
sunje 32222 1 1 14:47 pts/1 00:00:03 gmaster --msgqkey=22581
sunje 32261 1 0 14:48 pts/1 00:00:00 gbalancer --msgqkey=22581
sunje 32263 1 0 14:48 pts/1 00:00:00 gdispatcher --index 0 --msgqkey=22581
sunje 32266 1 0 14:48 pts/1 00:00:00 gdispatcher --index 1 --msgqkey=22581
sunje 32269 1 0 14:48 pts/1 00:00:00 gserver --shared 0 --msgqkey=22581
sunje 32271 1 0 14:48 pts/1 00:00:00 gserver --shared 1 --msgqkey=22581
sunje 32273 1 0 14:48 pts/1 00:00:00 gserver --shared 2 --msgqkey=22581
sunje 32275 1 0 14:48 pts/1 00:00:00 gserver --shared 3 --msgqkey=22581
sunje 32277 1 0 14:48 pts/1 00:00:00 gserver --shared 4 --msgqkey=22581
sunje 32279 1 0 14:48 pts/1 00:00:00 gserver --shared 5 --msgqkey=22581
sunje 32281 1 0 14:48 pts/1 00:00:00 gserver --shared 6 --msgqkey=22581
sunje 32283 1 0 14:48 pts/1 00:00:00 gserver --shared 7 --msgqkey=22581
sunje 32285 1 0 14:48 pts/1 00:00:00 gserver --shared 8 --msgqkey=22581
sunje 32287 1 0 14:48 pts/1 00:00:00 gserver --shared 9 --msgqkey=22581
sunje 32288 32222 0 14:48 pts/1 00:00:00 gmon --start --no-copyright --silent --msgqkey=22581
- SHARED_SESSION = YES, CS_MODE = DEDICATED로 gsqlnet 3개 세션, gsql 2개 세션 붙은 상태
TOP_LAYER CONNECTION STATUS SERVER PROGRAM
--------- ---------- --------- --------- ------------------------
12 DA CONNECTED DEDICATED balancer
12 DA CONNECTED DEDICATED dispatcher
12 DA CONNECTED DEDICATED dispatcher
12 DA CONNECTED DEDICATED dispatcher(send thread)
12 DA CONNECTED DEDICATED dispatcher(send thread)
12 DA CONNECTED DEDICATED gmaster
12 DA CONNECTED DEDICATED gmaster: ager
12 DA CONNECTED DEDICATED gmaster: archiver
12 DA CONNECTED DEDICATED gmaster: checkpoint
12 DA CONNECTED DEDICATED gmaster: cleanup
12 DA CONNECTED DEDICATED gmaster: database writer
12 DA CONNECTED DEDICATED gmaster: i/o slave(0)
12 DA CONNECTED DEDICATED gmaster: log writer
12 DA CONNECTED DEDICATED gmaster: monitor
12 DA CONNECTED DEDICATED gmaster: timer
12 DA CONNECTED DEDICATED gmon
13 DA CONNECTED DEDICATED gsql
13 DA CONNECTED DEDICATED gsql
13 TCP CONNECTED DEDICATED gsqlnet
13 TCP CONNECTED DEDICATED gsqlnet
13 TCP CONNECTED DEDICATED gsqlnet
12 DA CONNECTED DEDICATED shared server(0)
12 DA CONNECTED DEDICATED shared server(1)
12 DA CONNECTED DEDICATED shared server(2)
12 DA CONNECTED DEDICATED shared server(3)
12 DA CONNECTED DEDICATED shared server(4)
12 DA CONNECTED DEDICATED shared server(5)
12 DA CONNECTED DEDICATED shared server(6)
12 DA CONNECTED DEDICATED shared server(7)
12 DA CONNECTED DEDICATED shared server(8)
12 DA CONNECTED DEDICATED shared server(9)
31 rows selected.
sunje:~
$ ps -ef | grep sunje | grep gserver
sunje 32269 1 0 14:48 pts/1 00:00:00 gserver --shared 0 --msgqkey=22581
sunje 32271 1 0 14:48 pts/1 00:00:00 gserver --shared 1 --msgqkey=22581
sunje 32273 1 0 14:48 pts/1 00:00:00 gserver --shared 2 --msgqkey=22581
sunje 32275 1 0 14:48 pts/1 00:00:00 gserver --shared 3 --msgqkey=22581
sunje 32277 1 0 14:48 pts/1 00:00:00 gserver --shared 4 --msgqkey=22581
sunje 32279 1 0 14:48 pts/1 00:00:00 gserver --shared 5 --msgqkey=22581
sunje 32281 1 0 14:48 pts/1 00:00:00 gserver --shared 6 --msgqkey=22581
sunje 32283 1 0 14:48 pts/1 00:00:00 gserver --shared 7 --msgqkey=22581
sunje 32285 1 0 14:48 pts/1 00:00:00 gserver --shared 8 --msgqkey=22581
sunje 32287 1 0 14:48 pts/1 00:00:00 gserver --shared 9 --msgqkey=22581
sunje 32479 1 0 14:52 pts/0 00:00:00 gserver --dedicated /tmp/unix-glsnr.22581 -x 5
sunje 32558 1 0 14:52 pts/0 00:00:00 gserver --dedicated /tmp/unix-glsnr.22581 -x 6
sunje 32630 1 0 14:52 pts/0 00:00:00 gserver --dedicated /tmp/unix-glsnr.22581 -x 7
sunje 32727 20622 0 14:53 pts/0 00:00:00 grep --color=auto gserver
- SHARED_SESSION = YES 상태에서 CS_MODE = SHARED로 CS세션 붙으면 gserver 구동 안됨.
[결론]
서버프로퍼티인 SHARED_SESSION은 세션이 SHARED 모드로 접속할 수 있는지 여부이다.
SHARED_SESSION=NO이면 세션은 DEDICATED 모드밖에 안되며, 이 경우 CS 세션이 붙을때마다 gserver가 하나씩 구동된다. (DA로 붙으면 gserver 구동 안됨. gserver 통하지않고 바로 붙는애니까.)
SHARED_SESSION=YES 경우, 세션이 DEDICATED 모드로 붙으면 gserver가 하나씩 구동되며, SHARED 모드로 붙으면 gserver는 기본적으로 띄워져있는 gserver(10개)를 발란서에 의해 밸런싱 되어 사용한다. gdispather는 shared 모드에서만 의미가 있다.
DA는 그냥 gserver고 뭐고 지가 그냥 바로 붙는거.
CS는 gserver를 통해서 DB에 붙는건데, 이 gserver에 붙는 모드가 dedicated/shared
shared mode로 gserver에 붙으려면, gbalancer와 gdispatcher를 통해야 한다.
- glsnr 네트워크를 통한 원격 접속을 가능하게 해주는 프로세스
- gbalancer 부하가 적은 gdispatcher 를 선택하여 세션과 연결하는 프로세스
- gdispatcher 다수의 세션을 관리하는 프로세스 (gserver랑 연결해줌?)
- gserver TCP세션 요청을 인스턴스에 처리하는 프로세스
gdispatcher자체가 queue 형태(?)
세션들의 질의가 큐에 하나씩 하나씩 쌓이면서 순차적으로(FIFO) gserver에 요청됨. => 이 일을 하는놈이 gdispatcher
'IT Engineer > Database' 카테고리의 다른 글
alloc에 대한 내용 (0) | 2019.02.14 |
---|---|
coordinator 위치에 따른 성능테스트 (0) | 2019.02.13 |
coordinator 위치에 따른 성능테스트 결과메모 (0) | 2019.02.13 |
database cluster 개념 (1) | 2019.02.13 |
Shared Nothing Disk (0) | 2019.02.13 |