亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
最近訪問(wèn)板塊 發(fā)新帖
查看: 34935 | 回復(fù): 116
打印 上一主題 下一主題

[FreeBSD] 精通polling參數(shù)調(diào)優(yōu)的進(jìn)來(lái)幫幫忙吧 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2006-05-23 18:30 |只看該作者 |倒序?yàn)g覽
我測(cè)試FreeBSD無(wú)丟包網(wǎng)絡(luò)轉(zhuǎn)發(fā)性能。
我現(xiàn)在測(cè)試用的硬件配置:
CPU:奔四2.8G
內(nèi)存:1G DDR333雙通道
網(wǎng)卡:雙Intel千兆網(wǎng)卡用來(lái)做網(wǎng)橋,還有一個(gè)百兆的用來(lái)訪問(wèn)
還有千兆網(wǎng)線和smartbit千兆口


我開(kāi)了polling以后,無(wú)論怎么設(shè)置,轉(zhuǎn)發(fā)性能都上不去,64字節(jié)下雙向到達(dá)18萬(wàn)pps以后,就開(kāi)始丟包,但CPU占用率一直不到1%


我嘗試過(guò)設(shè)置內(nèi)核配置文件的值HZ=1000改為2000也不行,我還設(shè)置過(guò)如下參數(shù),都沒(méi)有能很好的提升性能:
kern.polling.user_frac
kern.polling.each_burst
kern.polling.burst_max


[ 本帖最后由 xfsoul 于 2006-5-23 18:32 編輯 ]

論壇徽章:
0
2 [報(bào)告]
發(fā)表于 2006-05-23 18:45 |只看該作者
而且我在網(wǎng)上看到很多人碰到和我一樣的問(wèn)題:
在FreeBSD6系列中開(kāi)了polling性能會(huì)很差:
http://www.monkey.org/freebsd/ar ... 00501/msg00060.html
http://www.freebsdchina.org/foru ... 70d4b88fede6fedee03

我這里開(kāi)了polling性能比linux差很多。

[ 本帖最后由 xfsoul 于 2006-5-23 18:51 編輯 ]

論壇徽章:
0
3 [報(bào)告]
發(fā)表于 2006-05-23 18:55 |只看該作者
這封郵件你看了沒(méi)有?

http://unix.derkeiler.com/Mailin ... 06-03/msg00142.html

論壇徽章:
0
4 [報(bào)告]
發(fā)表于 2006-05-23 19:05 |只看該作者
沒(méi)有看到。
現(xiàn)在怎么辦呢。
在第一個(gè)硬件平臺(tái)上測(cè)試。FreeBSD網(wǎng)絡(luò)轉(zhuǎn)發(fā)性能貌似不如linux

論壇徽章:
0
5 [報(bào)告]
發(fā)表于 2006-05-23 19:08 |只看該作者
我重新編譯內(nèi)核,徹底去掉polling看看,性能能否比得上linux。

論壇徽章:
0
6 [報(bào)告]
發(fā)表于 2006-05-23 23:24 |只看該作者
1.2.1  全局變量
從第106行開(kāi)始,都是POLLING相關(guān)的全局變量.首先是建立一SYSCTL樹(shù)的節(jié)點(diǎn).下圖中的SYSCTL_NODE宏代表在父節(jié)點(diǎn)_kern下建立一個(gè)_kern_polling節(jié)點(diǎn).
SYSCTL_NODE(_kern, OID_AUTO, polling, CTLFLAG_RW, 0,        "Device polling parameters");
                  下圖中的變量全部可用sysctl來(lái)查看,大部分都可以調(diào)整設(shè)置.這些全局變量都是使用宏SYSCTL_UINT把他們加入到_kern_polling節(jié)點(diǎn)下,成為該節(jié)點(diǎn)的葉子.之所以這樣,是因?yàn)榭梢酝ㄟ^(guò)用戶(hù)區(qū)來(lái)調(diào)整這些參數(shù).

-----------------------------------------------------------------------------------------------------
static u_int32_t poll_burst = 5;                                                                 ------ kern_poll.cstatic u_int32_t poll_each_burst = 5;
static u_int32_t poll_burst_max = 150;
static u_int32_t poll_in_idle_loop=0;
u_int32_t poll_in_trap;
static u_int32_t user_frac = 50;
static u_int32_t reg_frac = 20 ;static u_int32_t short_ticks;
static u_int32_t lost_polls;
static u_int32_t pending_polls;
static int residual_burst = 0;
static u_int32_t poll_handlers;
static int polling = 0;
static u_int32_t phase;

static u_int32_t suspect;
static u_int32_t stalled;
static u_int32_t idlepoll_sleeping;                                                          ------ kern_poll.c
----------------------------圖1-2-2 ----------------------------
在圖1-2-2中.這些變量按功能分可分為  3  大類(lèi).
A.        開(kāi)關(guān)型:
polling: 初始為0,即默認(rèn)為不打開(kāi)輪詢(xún)功能.要打開(kāi)輪詢(xún)功能,必須用:
#sysctl kern.polling=1
poll_in_idle_loop:該參數(shù)用于poll_idle函數(shù),用來(lái)確定是否進(jìn)入一低優(yōu)先權(quán)的循環(huán)輪詢(xún)中.即CPU空閑時(shí)是否來(lái)執(zhí)行輪詢(xún).

poll_in_trap:此參數(shù)不但是在陷入時(shí)是否執(zhí)行輪詢(xún)的開(kāi)關(guān),而且其值也是在陷入(trap)時(shí)執(zhí)行多少次輪詢(xún)
B.        算法參數(shù)
poll_each_burst:一個(gè)基本的輪詢(xún)次數(shù),很多其他變量都來(lái)和他進(jìn)行比較(主要是空閑時(shí)執(zhí)行輪詢(xún)或陷入時(shí)執(zhí)行輪詢(xún)).該值系統(tǒng)默認(rèn)是5,

poll_burst:一個(gè)動(dòng)態(tài)的輪詢(xún)次數(shù),主要用于根據(jù)核心(輪詢(xún))占用的時(shí)間片調(diào)整輪詢(xún)次數(shù),在核心(輪詢(xún))時(shí)間片小于預(yù)定的時(shí)間片時(shí),該值加1,當(dāng)核心(輪詢(xún))時(shí)間片過(guò)長(zhǎng),導(dǎo)致丟失一個(gè)或更多的時(shí)鐘嘀嗒時(shí),該值將減去該值的8分之1.這種算法是FreeBSD中輪詢(xún)技術(shù)的主要算法.當(dāng)然有一定的局限性.當(dāng)網(wǎng)絡(luò)分組快速增加時(shí),此算法只是加1來(lái)增加次數(shù)再來(lái)調(diào)用軟件中斷,從而形成軟中斷暴增的做法并不好.而且在占用時(shí)間片過(guò)長(zhǎng)時(shí)的減8分之1的做法也缺少理論依據(jù).

poll_burst_max:輪訓(xùn)的最大值,該值是用來(lái)限制poll_burst在累加過(guò)程中的最大量.當(dāng)然該值可以調(diào)整.他的調(diào)整范圍在后面講的兩個(gè)宏之內(nèi).

user_frac:用戶(hù)區(qū)占用的CPU時(shí)間片的百分比.該值用來(lái)確定核心(輪詢(xún))所占時(shí)間片是否有剩余,如果有的話就調(diào)整動(dòng)態(tài)值poll_burst,使其加1.

residual_burst:在正常的輪詢(xún)次數(shù)中,都是以poll_each_burst為標(biāo)準(zhǔn)的,而當(dāng)動(dòng)態(tài)的poll_burst>poll_each_burst時(shí)候,就會(huì)產(chǎn)生剩余沒(méi)輪詢(xún)的次數(shù),該次數(shù)就是residual_burst,當(dāng)然其結(jié)果就是繼續(xù)輪詢(xún)完residual_burst.

idlepoll_sleeping:該值的使用前提是poll_in_idle_loop變量開(kāi)關(guān)已經(jīng)打開(kāi),即在CPU空閑時(shí)支持輪詢(xún).系統(tǒng)置該值為0,可以直接進(jìn)入到CPU空閑時(shí)的輪詢(xún)代碼中;如果poll_in_idle_loop變量開(kāi)關(guān)還沒(méi)開(kāi)放,系統(tǒng)會(huì)給該值置1,也就是說(shuō).該值其實(shí)是一個(gè)CPU空閑時(shí)是否進(jìn)入輪詢(xún)代碼的狀態(tài),

reg_frac:在整個(gè)循環(huán)代碼執(zhí)行了該值的次數(shù)之后,就進(jìn)行檢查網(wǎng)卡的狀態(tài)寄存器.看看網(wǎng)卡是否有什么問(wèn)題.

pending_polls:在進(jìn)入輪詢(xún)前(我們有個(gè)時(shí)鐘嘀嗒鉤子函數(shù)),此參數(shù)加1,再輪詢(xún)后會(huì)對(duì)其減1,再次進(jìn)入時(shí)鐘嘀嗒后半部分會(huì)判斷是否平衡,如果由于輪詢(xún)時(shí)間過(guò)長(zhǎng),此次嘀嗒便會(huì)錯(cuò)過(guò).
C.        調(diào)試與參考
short_ticks:每次時(shí)鐘嘀嗒鉤子函數(shù)所花的時(shí)間如果小于5毫秒.那這種間隔時(shí)間太短了.這是以HZ=100來(lái)計(jì)算的.源代碼作者認(rèn)為.在100M卡時(shí),HZ數(shù)調(diào)整到1000比較合適,那么我們的時(shí)鐘嘀嗒鉤子函數(shù)所花時(shí)間在小于0.5毫秒是合適的.
lost_polls: 由于pending_polls的不平衡.記錄一次嘀嗒時(shí)間錯(cuò)過(guò),該值會(huì)不停的累加,給系統(tǒng)管理員提示可以調(diào)整poll_burst_max值小一些.或根據(jù)情況把user_frac(用戶(hù)占用CPU時(shí)間片的百分比)的值調(diào)的更小些.
poll_handlers:有多少個(gè)網(wǎng)絡(luò)設(shè)備支持并注冊(cè)了輪詢(xún).
phase:指示輪詢(xún)進(jìn)行到了哪個(gè)階段.輪詢(xún)代碼共分為6個(gè)階段.
                0階段代表是初始階段或上次輪詢(xún)的結(jié)束.
                1階段時(shí)鐘嘀嗒鉤子函數(shù)在設(shè)置網(wǎng)絡(luò)軟中斷(輪詢(xún)中斷)前
                2階段時(shí)鐘嘀嗒鉤子函數(shù)在設(shè)置網(wǎng)絡(luò)軟中斷(輪詢(xún)中斷)后.
                3階段是進(jìn)入軟中斷netisr_poll前.
                4階段是從軟中斷netisr_poll中出來(lái).
                5階段是進(jìn)入軟中斷netisr_pollmore前
                6階段是從軟中斷netisr_pollmore中出來(lái).
suspect:由于最后的軟中斷netisr_pollmore在處理時(shí)會(huì)再完成時(shí)把階段標(biāo)志phase置為0(即一次POLLING的完成,),或出現(xiàn)其他未完成情況時(shí)進(jìn)入階段5和6.那么就是說(shuō).我們的時(shí)鐘嘀嗒鉤子在最初時(shí)小于2階段的話,一定是在0階段.如果出現(xiàn)1或2階段的話就意味著時(shí)鐘硬件中斷發(fā)生了嵌套.此值在出現(xiàn)這種問(wèn)題時(shí)進(jìn)行記錄.

stalled:由于pending_polls太大(大于100),也就是說(shuō)由于每次輪詢(xún)時(shí)間過(guò)長(zhǎng),以至于輪詢(xún)丟失了太多嘀嗒,當(dāng)?shù)竭_(dá)100次時(shí),該值加1.(源代碼的作者認(rèn)為不會(huì)發(fā)生此類(lèi)事情,除了在網(wǎng)卡激活時(shí))

以上是一些參數(shù)說(shuō)明,你可以參照下.(不過(guò)是基于5.3的)
另外,請(qǐng)開(kāi)空閑HOOK.

論壇徽章:
0
7 [報(bào)告]
發(fā)表于 2006-05-23 23:51 |只看該作者
我想知道調(diào)度器的情況.以下是對(duì)/sys/kern/kern_poll.c中在第106行左右的
SYSCTL_NODE(_kern, OID_AUTO, polling, CTLFLAG_RW, 0,
        "Device polling parameters");
的后面加入以下:(拷貝粘帖就可以了)
SYSCTL_NODE(_kern_polling, OID_AUTO, dbg, CTLFLAG_RW, 0,
        "Device polling node kernel debug");

static uint32_t poll_coun;
SYSCTL_UINT(_kern_polling_dbg, OID_AUTO, poll_coun, CTLFLAG_RD,                &poll_coun,0,"netisr_poll and netisr_pollmore count");

static uint32_t pollmore_coun;
SYSCTL_UINT(_kern_polling_dbg, OID_AUTO, pollmore_coun, CTLFLAG_RD,                &pollmore_coun,0,"netisr_pollmore count");
static struct timeval pollstart_t;
static uint32_t poll_start;
static uint32_t poll_suspect;
SYSCTL_UINT(_kern_polling_dbg, OID_AUTO, poll_suspect, CTLFLAG_RD,                &poll_suspect,0,"poll_suspect count");
static uint32_t poll_invoke;
SYSCTL_UINT(_kern_polling_dbg, OID_AUTO, poll_invoke, CTLFLAG_RD,                &poll_invoke,0,"poll_invoke");
static int32_t net_load;
SYSCTL_INT(_kern_polling_dbg, OID_AUTO, net_load, CTLFLAG_RD,                &net_load,0,"net_load");
static int32_t on_cpu1;
SYSCTL_INT(_kern_polling_dbg, OID_AUTO, on_cpu1, CTLFLAG_RD,&on_cpu1,0,"run on cpu1");
static int32_t on_cpu2;
SYSCTL_INT(_kern_polling_dbg, OID_AUTO, on_cpu2, CTLFLAG_RD,&on_cpu2,0,"run on cpu2");
/*end*/
然后到netisr_pollmore()函數(shù)中的第6,7行左右if (residual_burst > 0) {語(yǔ)句后
加入:
pollmore_coun++;
                if (pollmore_coun>0xfffffffe)
                        pollmore_coun=0;
到netisr_poll()函數(shù)中第一行的大括號(hào)后面加上:
        struct timeval netisr_t;
到6,7行phase = 3;這句后面加入:
        poll_coun++;
        if (poll_coun>0xfffffffe)
                poll_coun=0;
        if (poll_start==0)
                poll_suspect++;
        microuptime(&netisr_t);
        poll_invoke=(poll_invoke+((netisr_t.tv_usec - pollstart_t.tv_usec)+(netisr_t.tv_sec - pollstart_t.tv_sec)*1000000))/2;
其他的你還暫時(shí)用不上.
重新編譯核心.
重啟動(dòng)開(kāi)POLLING后.執(zhí)行:
sysctl kern.polling.
大概每秒執(zhí)行下看看,把數(shù)據(jù)發(fā)上來(lái).

[ 本帖最后由 xie_minix 于 2006-5-23 23:58 編輯 ]

論壇徽章:
0
8 [報(bào)告]
發(fā)表于 2006-05-24 00:08 |只看該作者
目前本人正在做POLLING的NetBSD移植.
對(duì)于POLLING的效率問(wèn)題聽(tīng)過(guò)很多網(wǎng)友
反映,我沒(méi)有條件測(cè)試,移植的目的主要
是想解決SMP上效率問(wèn)題,還有參數(shù)的動(dòng)態(tài)
調(diào)整,希望大家能幫忙一起解決.NetBSD的
POLLING原代碼我爭(zhēng)取在這幾天發(fā)到這.關(guān)于
POLLING的原代碼詳解也將快發(fā)到CNFUG的
期刊上(整整寫(xiě)了一年了,效率和沒(méi)調(diào)優(yōu)的
POLLING一樣).到時(shí)希望大家指正.

[ 本帖最后由 xie_minix 于 2006-5-24 00:10 編輯 ]

論壇徽章:
0
9 [報(bào)告]
發(fā)表于 2006-05-24 06:31 |只看該作者
在FBSD下打開(kāi)Polling的效果并不明顯
尤其是橋+polling

論壇徽章:
0
10 [報(bào)告]
發(fā)表于 2006-05-24 08:37 |只看該作者
多謝xfsoul的測(cè)試和xie_minix的分析!我找到了一篇含有polling性能測(cè)試的文章,并把FreeBSD的net、performance和hackers郵件列表上從2003年到現(xiàn)在的關(guān)于polling的討論話題整理了一下,希望大家能夠一起把這個(gè)問(wèn)題弄明白。^_^

Improving Passive Packet Capture: Beyond Device Polling
    http://luca.ntop.org/Ring.pdf

FreeBSD-net

if_bridge + polling get lower througphts
    http://unix.derkeiler.com/Mailin ... 06-03/msg00142.html

Polling for ath driver
    http://unix.derkeiler.com/Mailin ... 06-02/msg00054.html

dummynet, em driver, device polling issues :-((
    http://unix.derkeiler.com/Mailin ... t/2005-10/0019.html

[REVIEW/TEST] polling(4) changes
    http://unix.derkeiler.com/Mailin ... t/2005-09/0259.html

About guideline of parameters tuning while in polling mode.
    http://unix.derkeiler.com/Mailin ... t/2005-09/0147.html

polling in 4.11 vs 5.4
    http://unix.derkeiler.com/Mailin ... t/2005-08/0183.html

polling and twa coexistence problems under 5.4-PRE
    http://unix.derkeiler.com/Mailin ... t/2005-03/0217.html

Re: Giant-free polling [PATCH]
    http://unix.derkeiler.com/Mailin ... t/2005-03/0011.html

xl(4) & polling
    http://unix.derkeiler.com/Mailin ... t/2005-02/0090.html

freebsd router project. Problems with polling?
    http://unix.derkeiler.com/Mailin ... t/2005-01/0259.html

polling(4) rocks!
    http://unix.derkeiler.com/Mailin ... t/2004-11/0144.html

sf(4) device polling
    http://unix.derkeiler.com/Mailin ... t/2004-11/0067.html

device polling takes more CPU hits??
    http://unix.derkeiler.com/Mailin ... t/2004-07/0158.html

[PATCH] vr(4) locking (and DEVICE_POLLING)
    http://unix.derkeiler.com/Mailin ... t/2004-07/0049.html

[PATCH] rl(4) locking and DEVICE_POLLING
    http://unix.derkeiler.com/Mailin ... t/2004-07/0048.html

Per-interface polling(4) status
    http://unix.derkeiler.com/Mailin ... t/2004-04/0104.html

polling(4) and rl(4)
    http://unix.derkeiler.com/Mailin ... t/2004-04/0095.html

Re: Testers wanted: polling(4) support for vr(4)
    http://unix.derkeiler.com/Mailin ... t/2004-04/0094.html

Device polling, kern.polling.burst_max and gig-e
    http://unix.derkeiler.com/Mailin ... t/2004-01/0380.html

DEVICE_POLLING with SMP
    http://unix.derkeiler.com/Mailin ... t/2004-01/0349.html

Paper on device polling and packet capture performance
    http://unix.derkeiler.com/Mailin ... t/2004-01/0070.html

Re: Polling CPU usage
    http://unix.derkeiler.com/Mailin ... t/2004-01/0027.html

Polling CPU usage
    http://unix.derkeiler.com/Mailin ... t/2003-12/0139.html

DEVICE_POLLING together with link0 interrupt offloading?
    http://unix.derkeiler.com/Mailin ... t/2003-09/0156.html

Device polling support for em and bge
    http://unix.derkeiler.com/Mailin ... t/2003-08/0238.html




FreeBSD-performance

Re: [fbsd] Re: Device polling heavy traffic
    http://unix.derkeiler.com/Mailin ... 06-01/msg00006.html

Device polling heavy traffic
    http://unix.derkeiler.com/Mailin ... 05-12/msg00069.html

polling in 4.11 vs 5.4
    http://unix.derkeiler.com/Mailin ... e/2005-08/0047.html

freebsd router project. Problems with polling?
    http://unix.derkeiler.com/Mailin ... e/2005-01/0061.html



FreeBSD-hackers

em0, polling performance, P4 2.8ghz FSB 800mhz
    http://unix.derkeiler.com/Mailin ... s/2004-02/0389.html

Device polling, with SMP?
    http://unix.derkeiler.com/Mailin ... s/2003-11/0259.html

[ 本帖最后由 雨絲風(fēng)片 于 2006-5-24 09:24 編輯 ]
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專(zhuān)區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過(guò)ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP