[SOA/BPM] Retrieve Performance Data from SOA Infrastructure Database

原文はこちら。
https://blogs.oracle.com/ateamsoab2b/entry/retrieve_performance_data_from_soa

以前以下のエントリで、BPELエンジンの性能統計を抽出、読み取って性能問題を解決するために利用する方法をご紹介しました。
Using BPEL Performance Statistics to Diagnose Performance Bottlenecks
http://thesoaman.blogspot.jp/2012/06/using-bpel-performance-statistics-to.html
Enterprise ManagerのBPELエンジンの統計の強みはリクエスト毎にブレイクダウンできるところにあるのですが、上記エントリでご紹介したようにBPELの性能統計情報には少々制約があります。
  • 統計は永続化されずにメモリに格納されていました。メモリのオーバーフローを避けるため、データはサイズ制限があるバッファに格納されています。統計エントリが上限を超えると、古いデータは消去され新しい情報が追記されます。そのため、最新のX件だけを保持できるのです。5時間前の統計情報は存在しえないでしょう。
  • BPELエンジンの性能統計情報には遅延時間を含むだけであって、スループットは含んでいません。
幸いにして、Oracle SOA SuiteはSOA Infrastructureデータベースと共に実行しており、数多くの性能データが当然そこに永続化されています。メモリ内のBPEL統計情報よりも粗いものではありますが、永続化していることによりその強みを持っています。
ここで、Oracle SOA Suite 11gのSOAインフラストラクチャデータベースに対して実行できる基本的なSQLクエリをご紹介します。これを使うと、特定期間の性能統計情報を取得できます。みなさんの環境に合わせて是非お試し下さい。

1. 非同期/一方向のメッセージの流入率

以下のクエリでは、特定期間中に一方向/非同期BPELプロセスに送信されたメッセージ数を、プロセス名や状態で整理して取得します。
select composite_name composite, state, count(*) Count from dlv_message
       where receive_date >= to_timestamp('2012-10-24 21:00:00','YYYY-MM-DD HH24:MI:SS')
         and receive_date <= to_timestamp('2012-10-24 21:59:59','YYYY-MM-DD HH24:MI:SS')
      group by composite_name, state
      order by Count;

2. BPELプロセスインスタンスのスループット

以下のクエリでは、特定期間中に作成された同期・非同期プロセスインスタンスの個数を取得します。このクエリでは全ての状態(実行中、失敗したものを含む)のインスタンスをリストにします。結果には全てのSOAパーティション全体のコンポジットの情報が含まれます。
select state, count(*) Count, composite_name composite, component_name,componenttype from cube_instance
       where creation_date >= to_timestamp('2012-10-24 21:00:00','YYYY-MM-DD HH24:MI:SS')
          and creation_date <= to_timestamp('2012-10-24 21:59:59','YYYY-MM-DD HH24:MI:SS')
        group by composite_name, component_name, componenttype 
          order by count(*) desc;

3. BPELプロセスインスタンスのスループットと遅延時間

このクエリでは、先ほどご紹介したものを手直しして、スループットだけでなく、BPELプロセスインスタンスの最大・最小・平均経過時間を取得できるようにしています。
select composite_name Composite, component_name Process, componenttype, state,
       count(*) Count,
      trunc(Max(extract(day    from (modify_date-creation_date))*24*60*60 + 
                extract(hour   from (modify_date-creation_date))*60*60 + 
                extract(minute from (modify_date-creation_date))*60 + 
                extract(second from (modify_date-creation_date))),4) MaxTime, 
      trunc(Min(extract(day    from (modify_date-creation_date))*24*60*60 + 
                extract(hour   from (modify_date-creation_date))*60*60 +  
                extract(minute from (modify_date-creation_date))*60 + 
                extract(second from (modify_date-creation_date))),4) MinTime, 
      trunc(AVG(extract(day    from (modify_date-creation_date))*24*60*60 +  
                extract(hour   from (modify_date-creation_date))*60*60 +  
                extract(minute from (modify_date-creation_date))*60 + 
                extract(second from (modify_date-creation_date))),4) AvgTime       
       from cube_instance
       where creation_date >= to_timestamp('2012-10-24 21:00:00','YYYY-MM-DD HH24:MI:SS')
          and creation_date <= to_timestamp('2012-10-24 21:59:59','YYYY-MM-DD HH24:MI:SS')
        group by composite_name, component_name, componenttype, state
          order by count(*) desc; 
4. 全て組み合わせてみる
3個のクエリを全て組み合わせ、さらに指定時間の範囲をパラメータ化してスクリプトをもうちょっと堅牢にしてみました。以下のスクリプトでは、指定時間の範囲をデータベースへのクエリ発行前に尋ねてくるようになっています。
accept startTime prompt 'Enter start time (YYYY-MM-DD HH24:MI:SS)'
accept endTime   prompt 'Enter end time (YYYY-MM-DD HH24:MI:SS)'

Prompt "==== Rejected Messages ====";
REM 2012-10-24 21:00:00
REM 2012-10-24 21:59:59
select count(*), composite_dn from rejected_message
       where created_time >= to_timestamp('&&StartTime','YYYY-MM-DD HH24:MI:SS')
         and created_time <= to_timestamp('&&EndTime','YYYY-MM-DD HH24:MI:SS')
    group by composite_dn;
    
Prompt "   ";
Prompt "==== Throughput of one-way/asynchronous messages ====";
select state, count(*) Count, composite_name composite from dlv_message
       where receive_date >= to_timestamp('&StartTime','YYYY-MM-DD HH24:MI:SS')
         and receive_date <= to_timestamp('&EndTime','YYYY-MM-DD HH24:MI:SS')
      group by composite_name, state
      order by Count;

Prompt "   ";
Prompt "==== Throughput and latency of BPEL process instances ===="
select state,
       count(*) Count,
      trunc(Max(extract(day    from (modify_date-creation_date))*24*60*60 + 
                extract(hour   from (modify_date-creation_date))*60*60 + 
                extract(minute from (modify_date-creation_date))*60 + 
                extract(second from (modify_date-creation_date))),4) MaxTime, 
      trunc(Min(extract(day    from (modify_date-creation_date))*24*60*60 + 
                extract(hour   from (modify_date-creation_date))*60*60 +  
                extract(minute from (modify_date-creation_date))*60 + 
                extract(second from (modify_date-creation_date))),4) MinTime, 
      trunc(AVG(extract(day    from (modify_date-creation_date))*24*60*60 +  
                extract(hour   from (modify_date-creation_date))*60*60 +  
                extract(minute from (modify_date-creation_date))*60 + 
                extract(second from (modify_date-creation_date))),4) AvgTime,
       composite_name Composite, component_name Process, componenttype
       from cube_instance
       where creation_date >= to_timestamp('&StartTime','YYYY-MM-DD HH24:MI:SS')
          and creation_date <= to_timestamp('&EndTime','YYYY-MM-DD HH24:MI:SS')
        group by composite_name, component_name, componenttype, state
          order by count(*) desc; 

0 件のコメント:

コメントを投稿