본문 바로가기

Database/Oracle Database

처음 사용자를 위한 Oracle Database In-Memory 사용 가이드 - #11. In-Memory 테스트 – RAC DB: Distribute For Service 테스트

"처음 사용자를 위한 Oracle Database In-Memory 가이드" 시리즈를 통해 Swingbench의 분석 업무 스키마 ‘SH’ 데이터를 이용해서 오라클 21c Single 인스턴스 데이터베이스와 RAC 데이터베이스에서 간단한 In-memory 옵션 사용 방법을 살펴봅니다.

 

글 순서

#1. Introduction

#2. 테스트 환경 준비

#3. In-Memory Advisor

#4. In-Memory 테스트 – Single 인스턴스 DB: In-Memory 설정 & Population

#5. In-Memory 테스트 – Single 인스턴스 DB: In-Memory 수행 확인

#6. 참고. 칼럼 레벨 In-Memory 설정 및 In-Memory hybrid scan

#7. 참고. IM FastStart 수행 확인

#8. In-Memory 테스트 – RAC DB: In-Memory 설정 & Population

#9. In-Memory 테스트 – RAC DB: In-Memory 수행 확인

#10. In-Memory 테스트 – RAC DB: Auto DOP 적용 테스트

#11. In-Memory 테스트 – RAC DB: Distribute For Service 테스트

 

참고. DISTRIBUTE FOR SERVICE 수행

참고문서. How to control where objects are populated into memory on RAC

오라클 데이터베이스 12c R2부터 RAC 환경에서 오브젝트를 특정 IM Column Store에 선택적으로 보다 쉽게 INMEMORY 속성의 부가 구문인 DISTRIBUTE FOR SERVICE 옵션을 이용해서 population 할 수 있게 되었다. 이는 서비스가 실행되는 위치에 기반하여 오브젝트를 어느 메모리에 population 시킬 것인지를 컨트롤 한다. 해당 서비스가 중지되면, distribution 되어 있던 그 오브젝트는 IM Column Store에서 자동으로 제거된다.

 

DISTRIBUTE FOR SERVICE 수행하기 전에 먼저 현재 In-Memory 설정 상태를 확인한다. 사이즈가 In-Memory 테이블들의 경우, RAC 두개 노드에 distribution 되어 있다.

SQL> show con_name
CON_NAME
------------------------------
DB0622_PDB1
 
SQL> select * from gv$inmemory_area order by inst_id,con_id;
   INST_ID POOL                       ALLOC_BYTES USED_BYTES POPULATE_STATUS                CON_ID
---------- -------------------------- ----------- ---------- -------------------------- ----------
         1 1MB POOL                    8248098816 1801453568 DONE                                3
         1 64KB POOL                   3534487552   25231360 DONE                                3
         2 1MB POOL                    8248098816 2196766720 DONE                                3
         2 64KB POOL                   3534487552   29949952 DONE                                3
 
SQL> select
             inst_id,
             decode(partition_name,null,segment_name,partition_name) as segment_name,
             bytes,
            (bytes - bytes_not_populated) as bytes_populated,
            bytes_not_populated,
            inmemory_size,
            populate_status
from gv$im_segments
order by segment_name, inst_id;
   INST_ID SEGMENT_NAME                        BYTES BYTES_POPULATED BYTES_NOT_POPULATED INMEMORY_SIZE POPULATE_STAT
---------- ------------------------------ ---------- --------------- ------------------- ------------- -------------
         1 CHANNELS                          1015808         1015808                   0       1310720 COMPLETED
         1 COUNTRIES                         1015808         1015808                   0       1310720 COMPLETED
         1 CUSTOMERS                      2839076864      1281949696          1557127168     336723968 COMPLETED
         2 CUSTOMERS                      2839076864      1557127168          1281949696     408616960 COMPLETED
         1 PRODUCTS                          1015808         1015808                   0       1310720 COMPLETED
         1 PROMOTIONS                        1015808         1015808                   0       1310720 COMPLETED
         1 SALES                          7578124288      3461095424          4117028864    1313210368 COMPLETED
         2 SALES                          7578124288      4117028864          3461095424    1541537792 COMPLETED
         1 SUPPLEMENTARY_DEMOGRAPHICS     1044717568       392724480           651993088     171507712 COMPLETED
         2 SUPPLEMENTARY_DEMOGRAPHICS     1044717568       651993088           392724480     275251200 COMPLETED
         2 TIMES                              483328          483328                   0       1310720 COMPLETED
 
11 rows selected.

 

테스트를 위해 현재 INMEMORY 속성인 테이블들을 NO INMEMORY 변경한다.

SQL> alter table sh.CHANNELS no inmemory;
Table altered.
 
SQL> alter table sh.COUNTRIES no inmemory;
Table altered.
 
SQL> alter table sh.CUSTOMERS no inmemory;
Table altered.
 
SQL> alter table sh.PRODUCTS no inmemory;
Table altered.
 
SQL> alter table sh.PROMOTIONS no inmemory;
Table altered.
 
SQL> alter table sh.SALES no inmemory;
Table altered.
 
SQL> alter table sh.SUPPLEMENTARY_DEMOGRAPHICS no inmemory;
Table altered.
 
SQL> alter table sh.TIMES no inmemory;
Table altered.

 

DB 노드에서 (여기서는 RAC 1 노드에 접속했다) 테스트 중인 PDB “db0622_pdb1” 대해 RAC 1 인스턴스로만 접속하는 별도 서비스를 생성하고, 기동한다. lsnrctl 명령으로 해당 서비스가 생성되었는지도 확인한다.

[oracle@racdb1 ~]$ hostname
racdb1
[oracle@racdb1 ~]$ whoami
oracle
[oracle@racdb1 ~]$ srvctl status database -db db0622_iad3qc -v
Instance DB06221 is running on node racdb1. Instance status: Open.
Instance DB06222 is running on node racdb2. Instance status: Open.
[oracle@racdb1 ~]$ srvctl add service -db db0622_iad3qc -service imnode1 -pdb db0622_pdb1 -preferred "DB06221"
[oracle@racdb1 ~]$ srvctl start service -db db0622_iad3qc -service "imnode1"
[oracle@racdb1 ~]$ srvctl status service -db db0622_iad3qc
Service imnode1 is running on instance(s) DB06221
[oracle@racdb1 ~]$ lsnrctl status
...
Service "imnode1.snpublic.cluster1.oraclevcn.com" has 1 instance(s).
  Instance "DB06221", status READY, has 1 handler(s) for this service...
The command completed successfully

 

이제 PDB 접속해서 테이블을 INMEMORY 속성으로 변경하되, distribute for service 옵션에 앞서 만든 RAC 1 인스턴스에만 연결되는 서비스를 지정하여 해당 테이블이 1 인스턴스에만 population되도록 한다.

SQL> show con_name
CON_NAME
------------------------------
DB0622_PDB1
 
SQL> alter table sh.CHANNELS inmemory distribute for service "imnode1";
Table altered.
 
SQL> alter table sh.COUNTRIES inmemory distribute for service "imnode1";
Table altered.
 
SQL> alter table sh.CUSTOMERS inmemory distribute for service "imnode1";
Table altered.
 
SQL> alter table sh.PROMOTIONS inmemory distribute for service "imnode1";
Table altered.
 
SQL> alter table sh.PRODUCTS inmemory distribute for service "imnode1";
Table altered.
 
SQL> alter table sh.SUPPLEMENTARY_DEMOGRAPHICS inmemory distribute for service "imnode1";
Table altered.
 
SQL> alter table sh.SALES inmemory distribute for service "imnode1";
Table altered.
 
SQL> alter table sh.TIMES inmemory distribute for service "imnode1";
Table altered.

 

이제 population 수행한다.

SQL> execute dbms_inmemory.populate('SH','CHANNELS');
PL/SQL procedure successfully completed.
 
SQL> execute dbms_inmemory.populate('SH','COUNTRIES');
PL/SQL procedure successfully completed.
 
SQL> execute dbms_inmemory.populate('SH','CUSTOMERS');
PL/SQL procedure successfully completed.
 
SQL> execute dbms_inmemory.populate('SH','PROMOTIONS');
PL/SQL procedure successfully completed.
 
SQL> execute dbms_inmemory.populate('SH','PRODUCTS');
PL/SQL procedure successfully completed.
 
SQL> execute dbms_inmemory.populate('SH','SUPPLEMENTARY_DEMOGRAPHICS');
PL/SQL procedure successfully completed.
 
SQL> execute dbms_inmemory.populate('SH','SALES');
PL/SQL procedure successfully completed.
 
SQL> execute dbms_inmemory.populate('SH','TIMES');
PL/SQL procedure successfully completed.

 

잠시 , 확인해 보면 RAC 1 노드에만 population 되어 있음을 확인할   있다.

SQL> select * from gv$inmemory_area order by inst_id,con_id;
   INST_ID POOL                       ALLOC_BYTES USED_BYTES POPULATE_STATUS                CON_ID
---------- -------------------------- ----------- ---------- -------------------------- ----------
         1 1MB POOL                    8248098816 3049259008 DONE                                3
         1 64KB POOL                   3534487552   39256064 DONE                                3
         2 1MB POOL                    8248098816          0 DONE                                3
         2 64KB POOL                   3534487552          0 DONE                                3
 
SQL> select inst_id,
                  decode(partition_name,null,segment_name,partition_name) as segment_name,
                  bytes,
                  (bytes - bytes_not_populated) as bytes_populated,
                  bytes_not_populated,
                  inmemory_size,
                  populate_status
from gv$im_segments
order by segment_name, inst_id;
   INST_ID SEGMENT_NAME                        BYTES BYTES_POPULATED BYTES_NOT_POPULATED INMEMORY_SIZE POPULATE_STAT
---------- ------------------------------ ---------- --------------- ------------------- ------------- -------------
         1 CHANNELS                          1015808         1015808                   0       1310720 COMPLETED
         1 COUNTRIES                         1015808         1015808                   0       1310720 COMPLETED
         1 CUSTOMERS                      2839076864      2839076864                   0     745275392 COMPLETED
         1 PRODUCTS                          1015808         1015808                   0       1310720 COMPLETED
         1 PROMOTIONS                        1015808         1015808                   0       1310720 COMPLETED
         1 SALES                          7578124288      7578124288                   0    2859991040 COMPLETED
         1 SUPPLEMENTARY_DEMOGRAPHICS     1044717568      1044717568                   0     483393536 COMPLETED
         1 TIMES                              483328          483328                   0       1310720 COMPLETED
 
8 rows selected.

 

In-Memory 오브젝트들이 한쪽 노드에 모두 distribution 되어 있기 때문에, 앞서 설정한 AUTO DOP 여기에서는 disable 시켰다.

SQL> alter system set parallel_degree_policy=manual scope=both sid='*';
 
SQL> show parameter parallel_degree_policy
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
parallel_degree_policy               string      MANUAL

 

성능 상의 변화를 확인해 보기 위해 Swingbench VM에서, 지금까지 테스트 해왔던 대로 charbench  유틸리티를 이용해서 8 유저로 10분간 수행한다. , 이번에는 앞서 생성한 RAC 1 인스턴스에 연결되는 서비스로 PDB 접속하여 Swingbench 워크로드를 실행시킨다.

테스트 실행 수행 결과, Single 인스턴스 DB 거의 유사한 트랜잭션 처리량, 평균 초당 트랜잭션 수를 보여주고 있다.

[root@inst-public opc]# cd /home/opc/swingbench/bin/
[root@inst-public bin]# ./charbench -c /home/opc/swingbench/configs/shconfig.xml -cs //racdb-scan.snpublic.cluster1.oraclevcn.com:1521/imnode1.snpublic.cluster1.oraclevcn.com -u sh -p Xxxxxxxxxxxxx -uc 8 -rt 00:10 -min 0 -max 0 -a -v users,tpm,tps
Author  :        Dominic Giles
Version :        2.6.0.1135
 
Results will be written to results.xml.
 
Time     Users       TPM      TPS
06:21:52 [0/8]       0        0
...
06:31:52 [8/8]       85       2
Saved results to results00005.xml
06:31:53 [5/8]       84       0
 
Completed Run.
[root@inst-public bin]# cat results00005.xml | grep TotalCompletedTransactions
        <TotalCompletedTransactions>1082</TotalCompletedTransactions>
[root@inst-public bin]# cat results00005.xml | grep AverageTransactionsPerSecond
        <AverageTransactionsPerSecond>1.8</AverageTransactionsPerSecond>

 

<END>