免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2384 | 回复: 1
打印 上一主题 下一主题

[proxy] squid服务器CPU100%,请帮忙分析一下 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-05-08 22:47 |只看该作者 |倒序浏览
这台服务器主要用来做图片的缓存,流量达到32M后,CPU就达到100%,流量不能往上跑了,大家帮分析一下瓶颈在哪里?

以下是squid服务器的一些资料:

机器配置:
-----------------------------------------------------------------------------------
CPU:p4 2.8
MEM:1000m DDR
OS:Linux AS4U2
Server: squid/2.5.STABLE13
-----------------------------------------------------------------------------------

# vmstat -n 2
-----------------------------------------------------------------------------------
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
1  3   4112  14308  24700 210252    0    0     9    11   26    11  7 24 49 20
1  0   4112  11424  24984 213072    0    0  1460   406 2578  3144 28 71  1  1
1  1   4112   9368  25156 215072    0    0   998    46 2559  2978 24 73  2  2
1  2   4112   7840  25296 216540    0    0   796    16 2535  2702 25 72  2  0
1  0   4112   5884  25476 218304    0    0   898   476 2556  2756 26 71  2  2
1  0   4112   4604  25576 219568    0    0   676     8 2513  2515 25 73  3  1
1  0   4112   2324  25764 221656    0    0  1108   434 2551  2878 24 73  3  1
1  0   4112   4620  25744 219524    0    0   524     2 2496  2519 24 72  4  1
1  8   4112   2136  26004 221816    0    0  1270     0 2543  2959 24 73  1  1
1  1   4112   3768  25876 220284    0    0   788   392 2508  2798 25 72  2  1
1  0   4112   2240  25996 221648    0    0   738     8 2493  2576 24 72  3  0
1  0   4112   3316  26052 220224    0    0   912   348 2507  2860 26 73  1  1
1  1   4112   4580  26012 218880    0    0  1008     0 2567  2971 25 69  3  4
1  1   4112   3564  26100 219748    0    0   478     0 2499  2885 22 73  4  0
1  6   4112   4692  26080 218744    0    0  1112   458 2525  2866 23 73  3  2
------------------------------------------------------------------------------------


# squidclient -p80 cache_object://localhost/info  信息:
------------------------------------------------------------------------------------

Mime-Version: 1.0
Date: Mon, 08 May 2006 14:30:24 GMT
Content-Type: text/plain
Expires: Mon, 08 May 2006 14:30:24 GMT
Last-Modified: Mon, 08 May 2006 14:30:24 GMT
Proxy-Connection: close

Squid Object Cache: Version 2.5.STABLE13
Start Time:     Sun, 07 May 2006 09:12:11 GMT
Current Time:   Mon, 08 May 2006 14:30:24 GMT
Connection information for squid:
        Number of clients accessing cache:      15614
        Number of HTTP requests received:       3373887
        Number of ICP messages received:        0
        Number of ICP messages sent:    0
        Number of queued ICP replies:   0
        Request failure ratio:   0.00
        Average HTTP requests per minute since start:   1918.9
        Average ICP messages per minute since start:    0.0
        Select loop called: 33805727 times, 3.121 ms avg
Cache information for squid:
        Request Hit Ratios:     5min: 97.4%, 60min: 97.7%
        Byte Hit Ratios:        5min: 99.1%, 60min: 99.3%
        Request Memory Hit Ratios:      5min: 24.2%, 60min: 24.3%
        Request Disk Hit Ratios:        5min: 47.5%, 60min: 46.9%
        Storage Swap size:      28506656 KB
        Storage Mem size:       524260 KB
        Mean Object Size:       34.34 KB
        Requests given to unlinkd:      0
Median Service Times (seconds)  5 min    60 min:
        HTTP Requests (All):   1.91442  1.24267
        Cache Misses:          0.05951  0.04519
        Cache Hits:            4.79440  3.46762
        Near Hits:             0.85130  0.94847
        Not-Modified Replies:  0.00286  0.00286
        DNS Lookups:           0.00000  0.00997
        ICP Queries:           0.00000  0.00000
Resource usage for squid:
        UP Time:        105492.936 seconds
        CPU Time:       70342.071 seconds
        CPU Usage:      66.68%
        CPU Usage, 5 minute avg:        96.89%
        CPU Usage, 60 minute avg:       97.05%
        Process Data Segment Size via sbrk(): 649228 KB
        Maximum Resident Size: 0 KB
        Page faults with physical i/o: 202
Memory usage for squid via mallinfo():
        Total space in arena:  649228 KB
        Ordinary blocks:       644569 KB  11694 blks
        Small blocks:               0 KB      0 blks
        Holding blocks:          2972 KB      3 blks
        Free Small blocks:          0 KB
        Free Ordinary blocks:    4658 KB
        Total in use:          647541 KB 99%
        Total free:              4658 KB 1%
        Total size:            652200 KB
Memory accounted for:
        Total accounted:       619754 KB
        memPoolAlloc calls: 498296387
        memPoolFree calls: 495349492
File descriptor usage for squid:
        Maximum number of file descriptors:   4096
        Largest file desc currently in use:   2807
        Number of file desc currently in use: 2477
        Files queued for open:                   0
        Available number of file descriptors: 1619
        Reserved number of file descriptors:   100
        Store Disk files open:                 520
Internal Data Structures:
        830311 StoreEntries
         13538 StoreEntries with MemObjects
         13103 Hot Object Cache Items
        830228 on-disk objects
----------------------------------------------------------------------------------------------


squid.conf 的一些主要参数:
----------------------------------------------------------------------------------------------
http_port 80
acl all src 0.0.0.0/0.0.0.0
cache_effective_user squid
http_access allow all
httpd_accel_port 80
httpd_accel_host virtual
httpd_accel_single_host off
httpd_accel_with_proxy off
httpd_accel_uses_host_header on

cache_dir aufs /squidcache 81200 16 256
cache_mem 512 MB
cache_swap_low  90
cache_swap_high 95
acl manager proto cache_object
http_access allow manager all
cachemgr_passwd passa all
emulate_httpd_log on
acl mana src 127.0.0.1/255.255.255.255

cache_access_log none
cache_log /squidlogs/cache.log
cache_store_log none
#referer_log referer.log

client_lifetime 8 hours
logfile_rotate 3

half_closed_clients off


maximum_object_size 20480 KB
maximum_object_size_in_memory 1024 KB
----------------------------------------------------------------------------------------------

CACHE目录文件系统格式是ext3,没有加rw,noatime,async参数。

论坛徽章:
0
2 [报告]
发表于 2006-05-10 13:59 |只看该作者

回复 1楼 xsxiaobao 的帖子

我也遇到这样的问题,
client_persistent_connections off
server_persistent_connections off
加上这两行以后,CPU的使用立即下降了,但是用netstat -an 却会看到很多的TIME_WAIT,不知道会不会有别的影响,你可以试一下。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP