天天看點

[20160112]存儲還是應用問題.txt

[20160112]存儲還是應用問題.txt

--上個星期在ITPUB論壇裡遇到幾個關于磁盤性能地下的問題.

--主要連結如下:

<a href="http://www.itpub.net/thread-2050157-1-1.html">http://www.itpub.net/thread-2050157-1-1.html</a>

<a href="http://www.itpub.net/thread-2050439-1-1.html">http://www.itpub.net/thread-2050439-1-1.html</a>

<a href="http://www.itpub.net/thread-2050601-1-1.html">http://www.itpub.net/thread-2050601-1-1.html</a>

--都是表現為磁盤IO相關的等待時間比較大.論壇讨論大部分認為是存儲出現問題.

--因為我們舊系統使用的就是該公司的産品,他們的連接配接數比我們小,而應用出現這個嚴重的性能問題.

--log file sync單次8354毫秒.

--如果仔細檢查可以發現大量索引沒有建立,而且看AWR報表發現:

Segments by Physical Reads

    Total Physical Reads: 5,752,157

    Captured Segments account for 94.1% of Total

Owner        Tablespace Name    Object Name        Subobject Name   Obj. Type   Physical Reads        %Total

PHARMACY     TSP_PHARMACY       DRUG_DISPENSE_REC                   TABLE            4,233,164        73.59

OUTPBILL     TSP_OUTPBILL       INVOICE_INFO                        TABLE              763,679        13.28

OUTPBILL     TSP_OUTPBILL       OUTP_BILL_ITEMS                     TABLE              371,704         6.46

OUTPDOCT     TSP_OUTPADM        OUTP_PRESC                          TABLE               18,007         0.31

INPBILL      TSP_INPBILL        INP_BILL_DETAIL                     TABLE                8,609         0.15

Back to Segment Statistics

Back to Top

Segments by Direct Physical Reads

    Total Direct Physical Reads: 5,599,810

    Captured Segments account for 95.8% of Total

Owner        Tablespace Name    Object Name        Subobject Name   Obj. Type   Direct Reads        %Total

PHARMACY     TSP_PHARMACY       DRUG_DISPENSE_REC                   TABLE          4,231,626        75.57

OUTPBILL     TSP_OUTPBILL       INVOICE_INFO                        TABLE            763,584        13.64

OUTPBILL     TSP_OUTPBILL       OUTP_BILL_ITEMS                     TABLE            371,366        6.63

--上下對比問題就很清楚了.

單獨拿DRUG_DISPENSE_REC來看:

Direct Physical Reads =4,231,626

Physical Reads = 4,233,164

-- 4233164-4231626=1538 ,真正的實體讀僅僅1538.

兩者基本相等.我認為Direct Physical Reads算作Physical Reads的一部分.

--看看前面的file IO統計:

Tablespace        Filename                                        Reads        Av Reads/s   Av Rd(ms)     Av Blks/Rd  Writes    Av Writes/s  Buffer Waits  Av Buf Wt(ms)

TSP_PHARMACY      /data/oracle/oradata/orcl/appharmacy.dbf        11,533       3            1593.96        123.35        356              0            2           0.00

TSP_PHARMACY      /data/oracle/oradata/orcl/appharmacy_1.dbf      11,292       3            1563.75        124.17        78               0            9         574.44

TSP_PHARMACY      /data/oracle/oradata/orcl/appharmacy_2.dbf      10,078       3            1519.08        125.44        103              0            3           0.00

TSP_PHARMACY      /data/oracle/oradata/orcl/appharmacy_3.dbf      1,326        0            3546.55        111.28        42               0          141         761.42

--因為檔案系統有緩存,這裡相對很多.更覺得奇怪的是這麼點讀(在1個小時内對于伺服器就是PC機都不算什麼),很明顯這裡記數的讀是真正的實體讀.

--從以上來看就是直接路徑讀造成的問題.而選擇直接路徑讀主要問題是相關語句沒有優化或者建立合适的索引.

--我的建議:關閉直接路徑讀,自己google網上有許多文章.alter system set "_serial_direct_read"=never scope=memory;

--可惜過去有一段時間,對方也沒有回複,希望我的判斷是正确的,也許他使用的存儲也有問題,cache沒打開,電池沒電等等因素.