- 论坛徽章:
- 0
|
这台服务器主要用来做图片的缓存,流量达到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参数。 |
|