shared_pool_size 결정 방법
작성자 관리자 작성시간 2004-03-04 08:42:01
 

* memory의 설정 --> shared_pool_size 결정 방법

Application이 얼마나 많은 memory를 사용하나? (Global Space Allocation) 를 산정하자.
--> 아래에 기술된 내용을 자세히 보면
  Shared_pool_size는 아래의 (a)+(b)+(c)+(30%정도의 free space추가) 로 잡는다.


먼저 init<SID>.ora에서 shared_pool_size 을 충분히 크게 setting해두고
application을 돌려보고 다음을 조회해 보면

a. shared object에 대한 필요한 공간
SQL> select sum(sharable_mem)
  2  from v$db_object_cache
  3  where owner is not null;

SUM(SHARABLE_MEM)-----------------
          3354299 ---> (a)


참고) 좀 자세히 object type별로 보려면

SQL> select type,sum(sharable_mem)
  2  from  v$db_object_cache
  3  where type='PACKAGE' or type='PACKAGE BODY' or
  4  type='FUNCTION' or type='PROCEDURE'
  5  group by type;

TYPE                        SUM(SHARABLE_MEM)---------------------------- -----------------
PACKAGE                                301274
PACKAGE BODY                            13437


b. 자주 사용되는 memory공간 계산
그리고 자주 사용되는(일반적으로 5회이상) application의 memory를 조회해 보면

SQL> select sum(sharable_mem)
  2  from v$sqlarea where executions > 5;

SUM(SHARABLE_MEM)-----------------
          190765 ---> (b)
         

c. open된 cursor의 수에 따른 memory할당
또 user당 open cursor당 shared pool은 250bytes 정도 할당 하는것을 보통으로 하며
peak time시의 전체 memory는 (open된 cursor갯수 * 250 bytes)로 생각하여 산정한다.

SQL> select sum(250 * users_opening)
  2  from v$sqlarea;

SUM(250*USERS_OPENING)----------------------
                  250 ---> (c)      : 현재는 open된 cursor하 하나뿐이다.

============================================================

* Large Memory Requirements : shared_pool_reserved_size를 사용하기

shared pool 내에 fragmentation이 나지 않은 일정 공간 사용
pl/sql compilation이나 trigger compilation과 같은 large allocation에 사용

init<SID>.ora에
shared_pool_reserved_size를 설정해 주는데 일반적으로 shared_pool_size의 10%정도를 초기값으로
설정하고 필요시 늘려준다. 대신 shared_pool_size 의 50%를 넘을 수 없고 넘으면 startup시
다음과 같은 error가 난다.
SQL> startup
ORA-01078: 시스템 매개변수 처리 오류입니다

v$shared_pool_reserved view는 shared pool 내에 reserved pool을 tuning하는데 도움이 된다.
shared_pool_reserved_size 가 setting되어 있을 경우에만 column들이 유효하다.
중요한 column들을 보면 free_space,avg_free_size,max_free_size,request_misses 등이 있다.

* reserved space를 tuning하기

request_misses=0 으로 하는것이 목적이다.
위에서 언급한 v$shared_pool_reserved view 뿐 아니라
$ORACLE_HOME/rdbms/admin/dbmspool.sql을 돌리고 나서
dbms_shared_pool package내에 , aborted_request_threshold procedure 사용하여 측정

a. shared_pool_reserved_size가 작으면 : - shared_pool_reserved_size, shared_pool_size 늘림
      - reserved list에서 할당된 memory의 수를 줄임


* Library Cache의 Reloads : reloads/pins < 1% 이하이여야 좋다.

-> 1% 이면 LRU list에서 aging out된것, invalidation check  =>shared_pool_size를
  증가시킨다.

a. v$librarycache에서 확인
     
SQL> select sum(pins) "Executions", sum(reloads) "Cache Misses",
  2  sum(reloads/pins)
  3  from v$librarycache
  4  where pins != 0;

Executions Cache Misses SUM(RELOADS/PINS)---------- ------------ -----------------
      8573            7        .000919601 -> 1%이하이므로 상태가 양호
     
b. utlbstat/utlestat후 report.txt에서 확인

LIBRARY              GETS GETHITRATIO      PINS PINHITRATIO    RELOADS        --------------- ---------- ----------- ---------- ----------- ----------       
INVALIDATIONS                                                                  -------------                                                                 
SQL AREA              410        .954      1087        .964          0       
            1                                                                 

위에서 reloads/pins 가 1%보다 크면 init<SID>.ora에서 shared_pool_size 증가시킨다.


* Data Dicitonary Cache Tuning : v$rowcache

Library cache와 함께 Shared pool 의 part인 Data Dicitonary Cache에서의 Tuning 역시
miss율을 줄이는 것이다.
주의해야 할 점은 db startup 직후 이를 측정해 보면 당연히 miss율이 높다.  Data Dicitonary Cache
를 check하기 위해서는 어느시간 사용한 후에 miss율을 측정해본다.

SQL> select parameter, gets, getmisses, getmisses/gets
  2  from v$rowcache
  3  where gets !=0;

PARAMETER                              GETS  GETMISSES GETMISSES/GETS-------------------------------- ---------- ---------- --------------
dc_free_extents                        144        12    .083333333
dc_segments                              29        22      .75862069
dc_tablespaces                            7          1    .142857143
dc_users                              2118          1    .000472144
dc_rollback_segments                    275          8    .029090909
dc_objects                              500        221          .442
dc_object_ids                          189        22    .116402116
dc_sequences                              1          1              1
dc_usernames                            31          3    .096774194

위 값들이 15% 이상이면 shared_pool_size를 늘리는것을 고려해봐라.
여기서는 바로 startup 후 test한것이라 상당히 높은 편이다.

또 utlbstat/utlestat 의 report.txt에서 다음을 참고해도 된다.

NAME                            GET_REQS GET_MISS SCAN_REQS SCAN_MISS MOD_REQS -------------------------------- -------- -------- --------- --------- --------
  COUNT CUR_USAGE                                                              -------- ---------                                                             
dc_objects                            62      20        0        0        0
    342      338                                                             
                                                                               
dc_synonyms                            3        2        0        0        0
      4        2


** MTS  - User Process:Server Process = 1:1
      MTS의 경우 UGA가 Shared Pool 한으로 들어옴
     
      ==> MTS의 경우 동시에 몇개의 process를 운용하는가에 따라 Shared Pool Size를 늘려줘야함

Maximum UGA space used by all MTS users :

SQL> select sum(value) ||' bytes' "Total max memory"
  2  from v$sesstat,v$statname
  3  where name = 'session uga memory max'
  4  and v$sesstat.statistic# = v$statname.statistic#;

Total max memory----------------------------------------------
527040 bytes


목록 | 입력 | 수정 | 답변 | 삭제