oracle iops與mbps小記

wisdomone1發表於2013-04-21

---oracle io一些引數----


SQL> select * from v$statname where name like '%phy%IO%' and name not like '%cell%' or name  like '%phy%multi%' order by name;
 
STATISTIC# NAME                                                                  CLASS    STAT_ID
---------- ---------------------------------------------------------------- ---------- ----------
        44 physical read total IO requests                                           8 3343375620 -- 單或多塊讀的io次數
        45 physical read total multi block requests                                  8 2007302071 --多塊讀的io次數
        48 physical write total IO requests                                          8 1315894329 --單或多塊寫的io次數
        49 physical write total multi block requests                                 8 3540174003 --多塊寫的io次數
       


幾個小概念:
   1,iops= read iops +  write iops
  
   2,iops分為單塊讀(寫)的iops及多塊讀(寫)的iops
  
   3,上述引數可以根據上述的統計相減即得
  
   4,測算oracle iops,即跑業務應用壓力測試,上述的統計值根據時間差相減;即可得到各引數的iops
  
   5,mbps 為每秒的讀寫的資料大小,也是分為每秒讀的資料大小 和  每秒寫的資料大小
  
   6,mbps = 測試時間間隔內的讀寫資料大小 /  iops(讀寫),也就是每個每次io到底讀寫了多大的資料大小
  

上述6涉及到一個概念:測試時間間隔內的讀寫資料大小


--由下可獲自上述引數
SQL> select * from v$statname where name like 'phy%%total%byte%';
 
STATISTIC# NAME                                                                  CLASS    STAT_ID
---------- ---------------------------------------------------------------- ---------- ----------
        47 physical read total bytes                                                 8 2572010804 --測試時間間隔的總共讀的資料大小
        50 physical write total bytes                                                8 2495644835   --同上理
       
       

--計算單多塊讀寫的io次數及讀寫資料大小
select sum(decode(name, 'physical read total IO requests', value, 0)) 測試總的讀io次數,
       sum(decode(name,
                  'physical read total multi block requests',
                  value,
                  0)) 測試總的多塊讀io次數,
       sum(decode(name, 'physical read total IO requests', value, 0))-sum(decode(name,
                  'physical read total multi block requests',
                  value,
                  0)) 測試總的單塊讀io次數,
                 
       sum(decode(name, 'physical write total IO requests', value, 0)) 測試總的寫io次數,
       sum(decode(name,
                  'physical write total multi block requests',
                  value,
                  0)) 測試總的多塊寫io次數,
       sum(decode(name, 'physical write total IO requests', value, 0))-sum(decode(name,
                  'physical write total multi block requests',
                  value,
                  0)) 測試總的單塊寫io次數,
      
       sum(decode(name, 'physical read total bytes', value, 0)) 測試總的讀資料大小,
      
       sum(decode(name, 'physical write total bytes', value, 0)) 測試總的寫資料大小,
      
       sum(decode(name, 'physical read total bytes', value, 0))+
       sum(decode(name, 'physical write total bytes', value, 0)) 測試總的讀寫資料大小          
                                        
  from v$sysstat;
 
 
 
SQL> /
 
       測試總的讀IO次數          測試總的多塊讀IO次數          測試總的單塊讀IO次數        測試總的寫IO次數          測試總的多塊寫IO次數          測試總的單塊寫IO次數          測試總的讀資料大小          測試總的寫資料大小           測試總的讀寫資料大小
----------------                --------------------           --------------------        ----------------          --------------------          --------------------          ------------------          ------------------           --------------------
           26663                   66                            26597                      12354                     28                           12326                         440291840                   193326592                    633618432
 
SQL>

----測試程式碼
23:09:03 SQL> begin
23:09:06   2  for i in 1..5000000 loop
23:09:06   3  insert into t_other values(i,i);
23:09:06   4  if mod(i,10000)=0 then
23:09:06   5  commit;
23:09:06   6  end if;
23:09:06   7  end loop;
23:09:06   8  end;
23:09:06   9  /

PL/SQL procedure successfully completed.

Elapsed: 00:10:18.85            

 

SQL> /
 
       測試總的讀IO次數          測試總的多塊讀IO次數          測試總的單塊讀IO次數        測試總的寫IO次數          測試總的多塊寫IO次數          測試總的單塊寫IO次數          測試總的讀資料大小          測試總的寫資料大小           測試總的讀寫資料大小
----------------                --------------------           --------------------        ----------------         --------------------          --------------------            ------------------        ------------------ --------------------
           32429                 1312                            31117                      22537                      5979                          16558                        1807550976                  3349968384           5157519360
 
SQL>     

-----------單塊讀的iops
select (31117 - 26597)/(10*60) from dual; -- 7.53333333333333 差不多是8個單塊讀iops

 

-----------單塊寫的iops
select (16558-12326)/(10*60)  from dual; ---差不多單塊寫的iops 7.05333333333333


---單塊讀寫總的iops
8+7=15 --差不多iops為15

 


----------多塊讀的iops

select (1312 - 66)/(10*60) from dual;-- 2.07666666666667 差不多是3個多塊讀iops


--------多塊寫的iops

select (5979-28)/(10*60)    from dual;-- 9.91833333333333 差不多是10個多塊寫iops

---多塊讀寫的總的iops

3+10=13  --差不多iops為13


---再看下吞吐量

---讀的mbps
select (1807550976-440291840)/(10*60)/(1024*1024) as mbps from dual;-- 2.17319986 差不多2mb多點


---寫的mbps

select   (3349968384-193326592)/(10*60)/(1024*1024) as mbps  from dual;---5.01734700 差不多5mb多


---總的mbps

select (5157519360-633618432)/(10*60)/(1024*1024) from dual;---7.190546875 總的吞吐量為7.190546875 7mb多


---當前儲存的mbps吞吐量

---儲存的效能主要3個指標:iops,mbps,latency即網路延時

 

--壓力測試下的iops及mbps相關
http://blog.chinaunix.net/uid-7812899-id-3200623.html

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-758994/,如需轉載,請註明出處,否則將追究法律責任。

相關文章