日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

oracle加并行变慢,并行设置不当导致数据处理速度变慢

發(fā)布時間:2025/4/5 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle加并行变慢,并行设置不当导致数据处理速度变慢 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

問題描述

系統(tǒng)遷移,由單節(jié)點4cpu服務(wù)器遷移到雙節(jié)點rac,32顆cpu系統(tǒng)中,遷移后對特定數(shù)據(jù)新服務(wù)器的處理速度反而不如老服務(wù)器。

問題分析

出現(xiàn)兩側(cè)代碼相同但執(zhí)行結(jié)果相差很大的原因是表SAVE_POINT_CACHE并行度的設(shè)置

表SAVE_POINT_CACHE中數(shù)據(jù)非常少,只有幾十條

在系統(tǒng)中表SAVE_POINT_CACHE的并行度設(shè)置為default

根據(jù)oracle對并行度的算法

Default = parallel_threads_per_cpu * cpu_count

我們系統(tǒng)中兩邊的設(shè)置都是如下的情況

NAMETYPEVALUE

------------------------------------ ----------- ------------------------------

parallel_threads_per_cpuinteger2

也就是每個cpu的并行度為2

老系統(tǒng)中系統(tǒng)共有4顆cpu

prtdiag -v結(jié)果片段

========================= CPUs

RunE$CPUCPU

BrdCPUMHzMB Impl.Mask

--- ----- ---- ---- ------- ----

A0, 16 1500 32.0 US-IV+2.4

B1, 17 1500 32.0 US-IV+2.4

A2, 18 1500 32.0 US-IV+2.4

B3, 19 1500 32.0 US-IV+2.4

并行度的結(jié)果就是4*2=8

Rac新系統(tǒng)中每個服務(wù)器有32顆cpu,

并行度的結(jié)果就是2*32=64

在并行度設(shè)置為default情況下測試代碼結(jié)果如下:

老系統(tǒng)時間為26.89秒

SQL> set timing on

SQL> BEGIN

2insert into save_point_cache values('dummytask_a',sysdate, 1);

3insert into save_point_cache values('begin_a',sysdate, 1);

4commit;

5

6FOR lc IN 1 .. 1000

7LOOP

8SAVE_POINT.SAVE_TASK ( 'dummytask_a', sysdate, lc );

9COMMIT;

10END LOOP;

11

12insert into save_point_cache values('end_a',sysdate, 1);

13commit;

14END;

15/

PL/SQL procedure successfully completed.

Elapsed: 00:00:26.89

Rac新系統(tǒng)時間為4:32.17

SQL> set timing on

SQL> BEGIN

2insert into save_point_cache values('dummytask_a',sysdate, 1);

3insert into save_point_cache values('begin_a',sysdate, 1);

4commit;

5

6FOR lc IN 1 .. 1000

7LOOP

8SAVE_POINT.SAVE_TASK ( 'dummytask_a', sysdate, lc );

9COMMIT;

10END LOOP;

11

12insert into save_point_cache values('end_a',sysdate, 1);

13commit;

14END;

15/

PL/SQL procedure successfully completed.

Elapsed: 00:04:32.17

并且在代碼運行期間主要的等待事件為

PX Deq Credit: send blkd

PX Deq: reap credit

對于這兩個等待事件,oracle的解釋如下:

PX Deq: reap credit

Waiting Process: Slave

This wait event indicates that we are doing a non-blocking test to see if any channel has returned a message. We should see that although there is a high number of these events, the time accumulated to it should be zero (or really low).

Tips to Reduce Waits for "PX DEQ CREDIT SEND BLKD" at Database Level

The wait events"PX Deq Credit: need buffer"and"PX Deq Credit: send blkd" are occur when data ormessages are exchanged between process that are part of a px query..

There are at least 3 different main area's that can cause this waits.

We see high waits if a lot of data and message are exchanged between parallel processes. The cause can be that the execution plan is bad or there are problem with the parallel execution setup.

There is a problem with the resource like the CPU or the interconnect. As example with a CPU utilization around 100% the process are limited by the CPU and can not send the data fast enough.

If parallel queries are hang where one process waits for "PX Deq Credit: need buffer" as example.

出現(xiàn)問題的主要原因是并行處理sql過程中cpu之間數(shù)據(jù)交換等待導(dǎo)致處理速度變慢

處理方法:

關(guān)閉表save_point_cache的并行

在兩邊同時關(guān)閉表的并行重新測試

SQL> alter table save_point_cache noparallel;

Table altered.

98老系統(tǒng)用時1.60秒

SQL> set timing on

SQL> BEGIN

2insert into save_point_cache values('dummytask_a',sysdate, 1);

3insert into save_point_cache values('begin_a',sysdate, 1);

4commit;

5

6FOR lc IN 1 .. 1000

7LOOP

8SAVE_POINT.SAVE_TASK ( 'dummytask_a', sysdate, lc );

9COMMIT;

10END LOOP;

11

12insert into save_point_cache values('end_a',sysdate, 1);

13commit;

14END;

15/

PL/SQL procedure successfully completed.

Elapsed: 00:00:01.60

Rac新系統(tǒng)用時1.14秒

SQL> set timing on

SQL> BEGIN

2insert into save_point_cache values('dummytask_a',sysdate, 1);

3insert into save_point_cache values('begin_a',sysdate, 1);

4commit;

5

6FOR lc IN 1 .. 1000

7LOOP

8SAVE_POINT.SAVE_TASK ( 'dummytask_a', sysdate, lc );

9COMMIT;

10END LOOP;

11

12insert into save_point_cache values('end_a',sysdate, 1);

13commit;

14END;

15/

PL/SQL procedure successfully completed.

Elapsed: 00:00:01.14

速度都非常理想

總結(jié)

以上是生活随笔為你收集整理的oracle加并行变慢,并行设置不当导致数据处理速度变慢的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。