国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數(shù)據(jù)庫 > Oracle > 正文

ORACLE性能診斷―學習statspack筆記(四)[擴展statspack收集服務(wù)器統(tǒng)計]

2024-08-29 13:30:53
字體:
供稿:網(wǎng)友

oracle性能診斷―學習statspack筆記(四)[擴展statspack收集服務(wù)器統(tǒng)計]

 

作者:劉穎博

時間:2004-3-22

mail:[email protected],請指正

 

轉(zhuǎn)載請注明出處及作者

 

說明:由于statspack并不能獲取全面分析性能問題所需要的所有信息,所以需要擴展其收集服務(wù)器的統(tǒng)計信息。(本文環(huán)境redhat linux7.2)

 

vmstat介紹

通過statspack收集服務(wù)器信息,主要通過收集vmstat的信息來展現(xiàn)服務(wù)器狀況。vmstat工具是最常見的unix監(jiān)控工具,可以展現(xiàn)給定時間間隔的服務(wù)器的狀態(tài)值。

       一般vmstat工具的使用是通過兩個數(shù)字參數(shù)來完成的,第一個參數(shù)是采樣的時間間隔數(shù),單位是秒,第二個參數(shù)是采樣的次數(shù)。如:

[[email protected] oracle]$ vmstat 1 2

   procs                      memory    swap         io  system         cpu

 r  b  w   swpd   free   buff  cache   si  so    bi    bo   in    cs  us  sy  id

 1  0  0      0 271844 186052 255852   0   0     2     6  102    10   0   0 100

 0  0  0      0 271844 186052 255852   0   0     0     0  104    11   0   0 100

 

(注:目前系統(tǒng)幾乎空閑,并且不同操作系統(tǒng)vmstat輸出內(nèi)容有所不同)

 

目前說來,對于服務(wù)器監(jiān)控有用處的度量主要有:

r(運行隊列)

pi(頁導(dǎo)入)

us(用戶cpu)

sy(系統(tǒng)cpu)

id(空閑)

 

通過vmstat識別cpu瓶頸

r(運行隊列)展示了正在執(zhí)行和等待cpu資源的任務(wù)個數(shù)。當這個值超過了cpu數(shù)目,就會出現(xiàn)cpu瓶頸了。

獲得cpu個數(shù)的命令(linux環(huán)境):

cat /proc/cpuinfo|grep processor|wc –l

當r值超過了cpu個數(shù),就會出現(xiàn)cpu瓶頸,解決辦法大體幾種:

1.       最簡單的就是增加cpu個數(shù)

2.       通過調(diào)整任務(wù)執(zhí)行時間,如大任務(wù)放到系統(tǒng)不繁忙的情況下進行執(zhí)行,進爾平衡系統(tǒng)任務(wù)

3.       調(diào)整已有任務(wù)的優(yōu)先級

 

通過vmstat識別cpu滿負荷

首先需要聲明一點的是,vmstat中cpu的度量是百分比的。當us+sy的值接近100的時候,表示cpu正在接近滿負荷工作。但要注意的是,cpu滿負荷工作并不能說明什么,unix總是試圖要cpu盡可能的繁忙,使得任務(wù)的吞吐量最大化。唯一能夠確定cpu瓶頸的還是r(運行隊列)的值。

 

通過vmstat識別ram瓶頸

數(shù)據(jù)庫服務(wù)器都只有有限的ram,出現(xiàn)內(nèi)存爭用現(xiàn)象是oracle的常見問題。

首先察看ram的數(shù)量,命令如下(linux環(huán)境):

[[email protected] root]#free

             total       used       free     shared    buffers     cached

mem:       1027348     873312     154036     185736     187496     293964

-/+ buffers/cache:     391852     635496

swap:      2096440          0    2096440

 

當然可以使用top等其他命令來顯示ram。

當內(nèi)存的需求大于ram的數(shù)量,服務(wù)器啟動了虛擬內(nèi)存機制,通過虛擬內(nèi)存,可以將ram段移到swap disk的特殊磁盤段上,這樣會出現(xiàn)虛擬內(nèi)存的頁導(dǎo)出和頁導(dǎo)入現(xiàn)象,頁導(dǎo)出并不能說明ram瓶頸,虛擬內(nèi)存系統(tǒng)經(jīng)常會對內(nèi)存段進行頁導(dǎo)出,但頁導(dǎo)入操作就表明了服務(wù)器需要更多的內(nèi)存了,頁導(dǎo)入需要從swap disk上將內(nèi)存段復(fù)制回ram,導(dǎo)致服務(wù)器速度變慢。

 

解決的辦法有幾種:

1.       最簡單的,加大ram

2.       改小sga,使得對ram需求減少

3.       減少ram的需求(如:減少pga)

 

我們基本的了解了vmstat工作,下面是statspack通過vmstat統(tǒng)計收集服務(wù)器性能數(shù)據(jù)。

 

statspack通過vmstat收集服務(wù)器信息

首先在perfstat用戶下建一個存儲服務(wù)器信息的表:如

建表:

create table stats$vmstat

(

start_date       date,  --系統(tǒng)時間

duration   date,  --時間間隔

server_name       varchar2(20), --服務(wù)器名稱

runque_waits       number, --運行隊列數(shù)據(jù)

page_in          number, --頁導(dǎo)入數(shù)據(jù)

page_out       number, --頁導(dǎo)出數(shù)據(jù)

user_cpu       number, --用戶cpu數(shù)據(jù)

system_cpu       number, --系統(tǒng)cpu數(shù)據(jù)

idle_cpu       number, --空閑cpu數(shù)據(jù)

wait_cpu       number –等待cpu數(shù)據(jù)(只是aix存在)

)

tablespace perfstat;

然后,通過unix/linux的shell變成,利用vmstat的結(jié)果來獲取相應(yīng)的服務(wù)器信息,并且存放到表中。

 

關(guān)于shell編程,可能已經(jīng)超出本文內(nèi)容,并且誠實的說,本人并沒有shell編程的經(jīng)驗,希望那位兄臺可以完成shell編程的內(nèi)容,并勞駕mail給我共享一下,謝了先!!

 

 

 

 

附:

linux上vmstat的幫助手冊:(man vmstat的結(jié)果)

vmstat(8)          linux administrator's manual         vmstat(8)

name

       vmstat - report virtual memory statistics

 

synopsis

       vmstat [-n] [delay [ count]]

       vmstat[-v]

 

description

       vmstat reports information about processes, memory, paging, block io, traps, and cpu activity.

 

       the  first report produced gives averages since the last reboot.  additional reports give information on a sam-

       pling period of length delay.  the process and memory reports are instantaneous in either case.

 

   options

       the -n switch  causes the header to be displayed only once rather than periodically.

 

       delay is the delay between updates in seconds.  if no delay is specified, only one report is printed  with  the

       average values since boot.

 

       count is the number of updates.  if no count is specified and delay is defined, count defaults to infinity.

 

       the -v switch results in displaying version information.

 

field descriptions

   procs

       r: the number of processes waiting for run time.

       b: the number of processes in uninterruptable sleep.

       w: the number of processes swapped out but otherwise runnable.  this

          field is calculated, but linux never desperation swaps.

 

   memory

       swpd: the amount of virtual memory used (kb).

       free: the amount of idle memory (kb).

       buff: the amount of memory used as buffers (kb).

 

   swap

       si: amount of memory swapped in from disk (kb/s).

       so: amount of memory swapped to disk (kb/s).

 

   io

       bi: blocks sent to a block device (blocks/s).

       bo: blocks received from a block device (blocks/s).

 

   system

       in: the number of interrupts per second, including the clock.

       cs: the number of context switches per second.

:   cpu

       these are percentages of total cpu time.

       us: user time

       sy: system time

       id: idle time

 

notes

       vmstat does not require special permissions.

 

       these  reports  are intended to help identify system bottlenecks.  linux vmstat does not count itself as a run-

       ning process.

 

       all linux blocks are currently 1k, except for cd-rom blocks which are 2k.

 

files

       /proc/meminfo

       /proc/stat

       /proc/*/stat

 

see also

       ps(1), top(1), free(1)

 

bugs

       does not tabulate the block io per device or count the number of system calls.

 

author

       written by henry ware <[email protected]>.

 

throatwobbler ginkgo labs 27 july 1994                  vmstat(8)

 

 

(待續(xù))

……………………………………………………………………………………

參考

donald k.burleson《oracle high-performance tuning with statspack》

 

 

 

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 鞍山市| 龙南县| 莆田市| 巢湖市| 贵阳市| 称多县| 甘孜县| 什邡市| 东乌珠穆沁旗| 中卫市| 利津县| 高唐县| 清河县| 澎湖县| 湟源县| 嘉黎县| 宝丰县| 禄劝| 昂仁县| 固原市| 兴国县| 保靖县| 金川县| 屯留县| 垫江县| 融水| 肃北| 阿勒泰市| 株洲县| 美姑县| 安化县| 湖州市| 临猗县| 深州市| 伊通| 东宁县| 潢川县| 修武县| 安仁县| 崇仁县| 临高县|