2011/04/21

バースティング性能 その3 (Performance of the bursting function. Part 3)

これまでの検証で、1ファイルへの出力においてはCPUの1コアに負荷が集中し、処理のボトルネックが発生する傾向を確認しました。

特定のコア以外に負荷はかかっておらず、メモリやディスクにも余裕があると考えられます。このような状況下においては、処理速度の向上を図ってCPUのプロセッサを追加(コアを増加)しても意味はありません。
ここでは処理の並列実行(マルチスレッド実行)を検証します。BI Publisher 11g では、バースティングの際に自動的に並列処理を行ってくれます(10gまでは、「構成」メニューでバースティング時の並列度を手動で定義する必要がありました)。


【準備】
データモデル:
データソースのSQLは以下の通りです。各行のreport_id には0または1が設定されます。
select t.*,
       trunc(t.pageno/5001) as report_id
  from emp2 t
 order by 
       pageno, deptno, empno


バースティング定義:
5000ページ以前と、5001ページ以後の2つのファイルに分割して出力する定義です。分割、配信元にはともに report_id を指定します。
select distinct
       trunc(pageno/5001)     as key,
       'Layout1'              as template,
       'ja-JP'                as locale,
       'RTF'                  as template_format,
       'PDF'                  as output_format,
       'FILE'                 as del_channel,
       'false'                as save_output,
       'c:\workspace\'        as parameter1,
       'rp_' || to_char(trunc(pageno/5001)) || '.pdf'
                              as parameter2
from emp2





【結果】
処理時間はほぼ半減(123.6秒→67.2秒)しました。1秒あたりの出力ページ数も81.0枚から148.7枚と比例して増加しています。並列処理の効果は高いといえます。


所要時間(秒)
秒間出力ページ数
1回目
67.7
147.6
2回目
67.3
148.7
3回目
66.7
149.8
平均
67.2
148.7



【検証時のOSの挙動】
BIサーバ(ゲストマシン2)の挙動を確認します。確認は、平均時間に近い3回目の実行時の統計情報をサンプルとします。

CPU:
開始後20秒間は1コアでの処理が行われています。この部分の動きは前回と変わりませんが、その後、2つのコア(Processor(2), Processor(4))に処理が分散されていることが確認できます。
Figure 1: CPU


メモリ:
前回同様、メモリには余裕のある状態です。
Figure 2: Memory

ディスク:
CPUへの負荷が1コアから2コアに切り替わるタイミングでスパイクが見られますが、大きな問題にはなっていません。
Figure 3: physical disk i/o


Figure 4: physical disk disk time(%)
※なお、前回は検証に %Disk Timeの値を使用していましたが、今回から「100 - %Idle Time」の値を使用します。これらの値については別途、説明します。



リソースに余裕のある状況では、バースティングの並列処理の効果が高いと考えられます。



[ Summary ]
It seems that a particular CPU core had been the bottleneck in the last test. BI Publisher was mainly working in a single thread.
You may suppose the other CPU cores, the memory and the physical disk can afford more load.
In the situation like this, adding another CPU processors does not mean anything.


This time, we see the parallel processing in a bursting job. BI Publisher 11g automatically performs multi thread.


[Settings]
Burst into two files. The data would be devided based on page number.


Data model:

select t.*,
       trunc(t.pageno/5001) as report_id
  from emp2 t
 order by 
       pageno, deptno, empno

Bursting:
Set "report_id" for Split by and Deliver by.

select distinct
       trunc(pageno/5001)     as key,
       'Layout1'              as template,
       'ja-JP'                as locale,
       'RTF'                  as template_format,
       'PDF'                  as output_format,
       'FILE'                 as del_channel,
       'false'                as save_output,
       'c:\workspace\'        as parameter1,
       'rp_' || to_char(trunc(pageno/5001)) || '.pdf'
                              as parameter2
from emp2


[Result]
The elapsed time is cut into 67.2 seconds, almost a half.



Elapsed Time(sec)
pages / sec
1st
67.7
147.6
2nd
67.3
148.7
3rd
66.7
149.8
average
67.2
148.7



[OS statistics]
CPU:
It runs on a single core in the first 20 seconds. Then, two cores start to work (Figure 1).


Memory:
No problem (Figure 2).


Disk:
The disk spikes right before the second core starts to work - same as last time, not a big problem (Figure 3 and 4).
Note: This time, the value of disk time is "100 - %Idle Time" instead of %Disk Time.




[Conclusion]
When you have certain amount of available resources, it's worth to consider the parallel processing.



2011/04/20

バースティング性能 その2 (Performance of the bursting function. Part 2)

VMと実機の比較として、前回と同様の性能検証をサーバ機にて行いました。
BI Publisherのバージョンが前回と異なりますが、参考まで記載します。

【検証環境】

BIサーバ:
筐体:IBM eServer BladeCenter HS21
CPU: Intel Xeon E5450 (3.0GHz) x 2 (8コア)
メモリ: 4GB
ストレージ: SAS 73.4GB x 4, Raid5
OS: Windows 2003 Server, 32bit
BIP: Oracle BI Publisher 10g, 10.1.3.4

DBサーバ:
DB: Oracle DB 11.1.1.7
(*)その他のスペックはBIサーバに同じ



【検証結果】
結果は以下の通りです。検証は3回実施しました。

所要時間(秒)
秒間出力ページ数
1回目
115.2
86.8
2回目
115.4
86.7
3回目
113.6
88.0
平均
114.7
87.2

平均で秒間約87ページの出力性能となりました。



サーバ機は個人所有ではないため、OS統計ログの分析等をここに記載することはできませんが、前回のVMでの検証と同様の傾向が見られました。

ソフトウェア環境も異なるため、比較対象としてはあまり好ましくないのが実情ですが、処理性能が10%程向上している点について、CPUのクロック周波数の差(2.6GHz / 3.0GHz)とほぼ等しいと見ることもできます。



[ Summary ]
Performance test on the (physical) server machine.




[Environment]
BI Server:
Model: IBM eServer BladeCenter
CPU: Intel Xeon E5450 (3.0GHz) x 2 processors (8 cores)
Memory: 4GB
Storage: SAS 73.4GB x 4, Raid5
OS:  Windows 2008 Server SP2, 32bit
BIP:  Oracle BI Publisher 10g, 10.1.3.4


DB Server:
Database: Oracle 11g R1 11.1.0.7
(*)Other specs are same as the BI server.


[Result]

The results are:

Elapsed Time(sec)
pages / sec
1st
115.2
86.8
2nd
115.4
86.7
3rd
113.6
88.0
Average
114.7
87.2



I cannot put OS statistics on this blog, since it is prohibited to bring out the server logs.
Anyway, the OS log files tells almost the same result as the last test on my VM environment.  The bottleneck is CPU in this test case.

2011/04/19

バースティング性能(Performance of the bursting function)

BI PublisherのPDF出力性能を検証します。

【検証環境】
検証は手元のデスクトップPC上にVMを2つ起動した環境で行います。

ホストマシン:
CPU: Intel Core i7 920 (2.6GHz) w/HT
メモリ: 12GB
OS: Windows7 Ult. 64bit
VMM: VirtualBox 3.2.12

ゲストマシン1(DBサーバ):
CPU: 1コア
メモリ: 2GB
OS: Windows 2003 Server, 32bit
DB: Oracle DB 11g R2
ストレージ: VMイメージはHDD上に配置

ゲストマシン2(BIサーバ):
CPU: 6コア
メモリ: 4GB
OS: Windows 2003 Server, 32bit
BIEE: Oracle BIEE 11g
ストレージ: VMイメージはSSD上に配置


【検証に使用するデータ】
scott.emp表を基に、10,000ページ分のデータを生成します。1ページあたり12件、12万件のデータを準備します。スクリプトは以下の通りです。
-- ----------------------
-- create table
-- ----------------------

create table emp2 (
  empno     number(4),
  ename     varchar2(10),
  job       varchar2(9),
  mgr       number(4),
  hiredate  date,
  sal       number(7,2),
  comm      number(7,2),
  deptno    number(2),
  pageno    number(10,0),    -- page number 1..10000
  dummycol  number(10,0)     -- always 1
);


-- ----------------------
-- insert data
-- ----------------------

declare
  cursor c is select * from emp order by deptno, empno;
  i pls_integer;
begin
  for i in 1..10000 loop
    for r in c loop
      insert into emp2 values (r.empno, r.ename, r.job, r.mgr, r.hiredate, r.sal, r.comm, r.deptno, i, 1);
    end loop;
  end loop;
  commit;
end;
/


-- ----------------------
-- add index
-- ----------------------

create index ix_emp2_1 on emp2 (pageno, deptno, empno);




【出力イメージ】
出力されるPDFは以下の通りです。1ページあたりのレコードは12レコード。10,000ページを1つのファイルに出力します。各ページのヘッダには6KBのロゴ画像を含めました。
Figure 1: Output PDF





【バースティング定義】
上記のデータを、ローカルにファイル形式でバースティングします。
バースティングの定義は以下の通りです。
select distinct
       1                                        as key,
       'Layout1'                                as template,
       'ja-JP'                                  as locale,
       'RTF'                                    as template_format,
       'PDF'                                    as output_format,
       'FILE'                                   as del_channel,
       'false'                                  as save_output,
       'c:\workspace\'                          as parameter1,
       'rp_00001.pdf'                           as parameter2
  from dual



【検証結果】
結果は以下の通りです。検証は3回実施しました。

所要時間(秒)
秒間出力ページ数
1回目
123.5
81.0
2回目
119.9
83.4
3回目
127.3
78.5
平均
123.6
81.0

平均で秒間約81ページの出力性能となりました。



【検証時のOSの挙動】
BIサーバ(ゲストマシン2)の挙動を確認します。確認は、平均時間に近い1回目の実行時の統計情報をサンプルとします。
※DBサーバ(ゲストマシン1)は凪であったため割愛します。


CPU:
1つのコアが振り切れています。グラフは割愛しますが、CPU待ち(キュー)は発生していません。シングルスレッドのプログラムがコアを占有している様子が確認できます。
Figure 2: CPU statistics



メモリ:
余裕のある状態です。以下に状況を示します。
Figure 3: Memory statistics


ディスク:
処理の初めにディスク書き込みの負荷が高まっていますが、その後の負荷は低い状態で推移しています。
Figure 4: Physical disk statistics

Figure 5: Physical disk queue statistics



今回の検証結果から、1ファイルへの出力性能はCPUの処理性能(クロック数)に依存する傾向がより高いと考えられます。



[Summary]
You may want to see the result of BI Publisher performance test.




[Environment]
Two virtual machines on the ordinary desktop PC


Host Machine:
CPU: Intel Core i7 920 (2.6GHz) w/HT
Memory: 12GB
OS: Windows7 Ult. 64bit
VMM: VirtualBox 3.2.12


Guest Machine #1(DB server):
CPU: 1 core
Memory: 2GB
OS: Windows 2003 Server, 32bit
DB: Oracle DB 11g, 11.2.0.1
Storage: the VM image is on ordinary HDD


Guest Machine #2(BI server):
CPU: 6 cores
Memory: 4GB
OS: Windows 2003 Server, 32bit
BIEE: Oracle BIEE 11g, 11.1.1.3
Storage: the VM image is on SSD





[Data]
The following script duplicates the records in scott.emp 10,000 times.  i.e. 120,.000 records in total.
-- ----------------------


-- create table
-- ----------------------
create table emp2 (
  empno     number(4),
  ename     varchar2(10),
  job       varchar2(9),
  mgr       number(4),
  hiredate  date,
  sal       number(7,2),
  comm      number(7,2),
  deptno    number(2),
  pageno    number(10,0),    -- page number 1..10000
  dummycol  number(10,0)     -- always 1
);

-- ----------------------
-- insert data
-- ----------------------
declare
  cursor c is select * from emp order by deptno, empno;
  i pls_integer;
begin
  for i in 1..10000 loop
    for r in c loop
      insert into emp2 values (r.empno, r.ename, r.job, r.mgr, r.hiredate, r.sal, r.comm, r.deptno, i, 1);
    end loop;
  end loop;
  commit;
end;
/


-- ----------------------
-- add index
-- ----------------------
create index ix_emp2_1 on emp2 (pageno, deptno, empno);



[Output PDF]
The output PDF is shown in figure 1.  Whole data is in one PDF file that consists of 10,000 pages.  Each page has 12 records.
The logo image (adobe PDF image) in each page is 6KB.



[Bursting definition]
Set dummycol for Split by and Deliver by.  The Bursting definition is as follow: 
select distinct
       1                                        as key,
       'Layout1'                                as template,
       'ja-JP'                                  as locale,
       'RTF'                                    as template_format,
       'PDF'                                    as output_format,
       'FILE'                                   as del_channel,
       'false'                                  as save_output,
       'c:\workspace\'                          as parameter1,
       'rp_00001.pdf'                           as parameter2
  from dual



[Result]
I executed three times.  The results are:

Elapsed Time(sec)
pages / sec
1st
123.5
81.0
2nd
119.9
83.4
3rd
127.3
78.5
Average
123.6
81.0



[OS statistics]
The OS statistics are shown in Figure 2 to Figure 5.  They are the statistics of Guest Machine #2 in the first shot.  The statistics interval is 2 seconds.
(*) DB server (Guest Machine #1) had been very calm.

CPU:
You can see one core (Processor(2), Processor(0)) is occupied 100% by a single thread program.
There was no processor queue waiting (graph omitted).


Memory:
No problem.


Physical Disk:
write/sec spikes in the beginning though, not a big problem.





[Conclusion]
When you burst data into a single file, the performance of BI server depends on CPU power, rather than memory or disk.