[Tibero] 티베로(tibero) - 워커 프로세스(Worker Process)(1) 세션 개수 설정
본문 바로가기
IT/DataBase

[Tibero] 티베로(tibero) - 워커 프로세스(Worker Process)(1) 세션 개수 설정

by 로진김 2021. 7. 21.

 

 워커 프로세스는 클라이언트와 실제 통신하며, 사용자 요구 사항을 처리하는 프로세스입니다. 워커 프로세스는 2가지 타입이 있습니다.

 

  1. Foreground Worker Process : 리스너를 통해 들어온 온라인 요청 처리.
  2. Background Worker Process : Internal Task나 Job Scheduler에 등록된 배치 작업을 수행. 리스너에 의해 처리되지 않음.

 

 ps 명령어를 통해 기동 되고 있는 프로세스를 조회해봅니다. ps -ef | grep tbsvr로 모든 워커 프로세스를 한번에 조회할 수 있습니다.

 

[tibero@T1:/]$ ps -ef | grep tbsvr
tibero   13865     1  8 15:21 pts/1    00:00:00 tbsvr          -t NORMAL -SVR_SID tibero
tibero   13867 13865  0 15:21 pts/1    00:00:00 tbsvr_MGWP     -t NORMAL -SVR_SID tibero
tibero   13868 13865  0 15:21 pts/1    00:00:00 tbsvr_FGWP000  -t NORMAL -SVR_SID tibero
tibero   13869 13865  1 15:21 pts/1    00:00:00 tbsvr_FGWP001  -t NORMAL -SVR_SID tibero
tibero   13870 13865  0 15:21 pts/1    00:00:00 tbsvr_PEWP000  -t NORMAL -SVR_SID tibero
tibero   13871 13865  0 15:21 pts/1    00:00:00 tbsvr_PEWP001  -t NORMAL -SVR_SID tibero
tibero   13872 13865  0 15:21 pts/1    00:00:00 tbsvr_PEWP002  -t NORMAL -SVR_SID tibero
tibero   13873 13865  0 15:21 pts/1    00:00:00 tbsvr_PEWP003  -t NORMAL -SVR_SID tibero
tibero   13874 13865 16 15:21 pts/1    00:00:00 tbsvr_AGNT     -t NORMAL -SVR_SID tibero
tibero   13875 13865  0 15:21 pts/1    00:00:00 tbsvr_DBWR     -t NORMAL -SVR_SID tibero
tibero   13876 13865  2 15:21 pts/1    00:00:00 tbsvr_RCWP     -t NORMAL -SVR_SID tibero
tibero   13983 18629  0 15:21 pts/1    00:00:00 grep --color=auto tbsvr

 

 Foreground Worker Process만 조회하는 방법입니다. ps -ef | grep tbsvr_FGWP 명령어에 의해 FGWP만 출력됩니다. Background Worker Process는 FGWP를 BGWP로 바꾸시면 됩니다.

 

[tibero@T1:/]$ ps -ef | grep tbsvr_FGWP
tibero   13868 13865  0 15:21 pts/1    00:00:00 tbsvr_FGWP000  -t NORMAL -SVR_SID tibero
tibero   13869 13865  0 15:21 pts/1    00:00:00 tbsvr_FGWP001  -t NORMAL -SVR_SID tibero
tibero   14079 18629  0 15:22 pts/1    00:00:00 grep --color=auto tbsvr_FGWP

 


 

 Background Worker Process가 필요한 이유

 

 Background Worker Process를 기동시키는 이유는 티베로 서버가 새벽에 배치 잡을 수행해야 하고 집계되어 정보가 저장되어야하는데 이런 일이 비정상적 작동을 하게 됩니다. 이유는 Worker Thread가 없어서 작업이 정상적으로 불가능하기 때문입니다.

 

 Worker Thread를 늘려서 가능하게 할 수도 있겠지만, 다른 클라이언트들이 Work Thread를 늘려도 사용자들에게 모두 할당되어 새벽에 Job을 수행되지 않을 수 있습니다.

 

 Background Worker Thread를 설정하는 방법으로 이 문제를 피해갈 수 있습니다. .tip파일에서 파라미터를 수정하면 Background Worker Thread를 설정할 수 있습니다.

 

[tibero@T1:/]$ tbcfgv

DB_NAME=tibero
LISTENER_PORT=9629
CONTROL_FILES="/DataDisk/T1/tibero2/tbdata/c1.ctl","/DataDisk/T1/tibero2/tbdata/c2.ctl"
DB_CREATE_FILE_DEST=/DataDisk/T1/tibero2/tbdata
LOG_ARCHIVE_DEST=/DataDisk/T1/tibero2/arch
MAX_SESSION_COUNT=20
TOTAL_SHM_SIZE=1G
MEMORY_TARGET=2G

MAX_BG_SESSION_COUNT=10	#이 부분 추가

 

 기존의 파라미터 아래 MAX_BG_SESSION_COUNT 를 10으로 설정합니다. MAX_SESSION_COUNT가 20으로 설정되어 있기 때문에 Foreground Worker Process 와 Background Worker Process가 각각 10개 세션씩 할당받습니다.

 

 결과를 확인하기 위해서 재기동해야합니다.

 

[tibero@T1:/]$ tbdown

Tibero instance terminated (NORMAL mode).

[tibero@T1:/]$ tbboot
Change core dump dir to /tibero/edu/tibero6/bin/prof.
Listener port = 9629

Tibero 6

TmaxData Corporation Copyright (c) 2008-. All rights reserved.
Tibero instance started up (NORMAL mode).

[tibero@T1:/]$ ps -ef | grep tbsvr_FGWP
tibero   14408 14405  0 15:25 pts/1    00:00:00 tbsvr_FGWP000  -t NORMAL -SVR_SID tibero
tibero   14543 18629  0 15:25 pts/1    00:00:00 grep --color=auto tbsvr_FGWP
[tibero@T1:/]$ ps -ef | grep tbsvr_BGWP
tibero   14409 14405  0 15:25 pts/1    00:00:00 tbsvr_BGWP001  -t NORMAL -SVR_SID tibero
tibero   14548 18629  0 15:25 pts/1    00:00:00 grep --color=auto tbsvr_BGWP

[tibero@T1:/]$ tbsql sys/tibero
SQL> SELECT COUNT(*) FROM V$SESSION;

  COUNT(*)
----------
         1

1 row selected.

 

 세션이 1개만 접속되어 있기 때문에 FGWP와 BGWP가 각각 1개씩 할당된 것을 볼 수 있습니다. Worker Thread는 2개가 돌아가고 있는 것입니다. 쉽게 말해서 FGWP에 10개의 Worker Thread가 있는데 사용자는 최대 10개의 세션만 만들수 있습니다.

 

 V$SESSION 딕션어리에서 조회해도 세션이 1개인 것을 확인할 수 있습니다.

 


 

 세션 늘리기

 

MAX_BG_SESSION_COUNT와 MAX_SESSION_COUNT을 설정한 이후 세션 개수를 늘려보겠습니다.  

 

[tibero@T1:/]$ tbsql tibero/tmax

tbSQL 6

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

Connected to Tibero.

SQL> !tbsql tibero/tmax

tbSQL 6

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

Connected to Tibero.

SQL> !tbsql tibero/tmax

tbSQL 6

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

Connected to Tibero.

SQL> !tbsql tibero/tmax

tbSQL 6

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

Connected to Tibero.

SQL> !tbsql tibero/tmax

tbSQL 6

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

Connected to Tibero.

SQL> !tbsql tibero/tmax

tbSQL 6

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

Connected to Tibero.

SQL> !tbsql tibero/tmax

tbSQL 6

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

Connected to Tibero.

SQL> !tbsql tibero/tmax

tbSQL 6

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

Connected to Tibero.

SQL> !tbsql tibero/tmax

tbSQL 6

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

Connected to Tibero.

SQL> !tbsql tibero/tmax

tbSQL 6

TmaxData Corporation Copyright (c) 2008-. All rights reserved.

TBR-12003: Unable to open a session.

 

 새로운 세션을 더 이상 늘릴 수 없다는 Unable to open a session 에러 메시지가 발생합니다.

 

SQL> SELECT COUNT(*) FROM V$SESSION;

  COUNT(*)
----------
        10

1 row selected.

SQL> SELECT PID FROM V$SESSION;

       PID
----------
     14408
     14408
     14408
     14408
     14408
     14408
     14408
     14408
     14408
     14408

10 rows selected.

 

 V$SESSION을 조회하니 파라미터 파일에서 설정한 최대 값을 확인할 수 있으며, 1개의 터미널에서 계속 세션을 늘려서 PID가 같은 것을 알 수 있습니다. 1개의 Foreground Worker Process는 10개의 Worker Session까지 만들 수 있기 때문에 더 이상의 세션을 늘릴 수 없다는 것입니다.

 

SQL> !ps -ef | grep tbsvr_FGWP
tibero   14408 14405  0 15:25 pts/1    00:00:00 tbsvr_FGWP000  -t NORMAL -SVR_SID tibero
tibero   15071 14672  0 15:32 pts/3    00:00:00 sh -c ps -ef | grep tbsvr_FGWP
tibero   15073 15071  0 15:32 pts/3    00:00:00 grep tbsvr_FGWP
SQL> !ps -ef | grep tbsvr_BGWP
tibero   14409 14405  0 15:25 pts/1    00:00:01 tbsvr_BGWP001  -t NORMAL -SVR_SID tibero
tibero   15084 14672  0 15:32 pts/3    00:00:00 sh -c ps -ef | grep tbsvr_BGWP
tibero   15086 15084  0 15:32 pts/3    00:00:00 grep tbsvr_BGWP

 

 ps 명령어로 확인해보니 FGWP의 PID가 14408인 것을 확인할 수 있습니다. 세션의 PID와 같습니다.

 

 

반응형