netcraft wrote:
hi all:
We use squid to accelerate our dynamic pages(resin/jsp), some pages
are setting to very short expiry time(2min). and some are one day. It works
good at the beginning, But I meet a strange problem: when squid start, it use
about 8% of cpu time. the speed is fast. after 2 or 3 days, the cpu usage grows up to 49%, and the speed is slow. since the system is using hyperthread feature of cpu, so I think the actual cpu usage is about 99%. below is the
configuration file and some information.
thanks
squid.conf:
http_port 80
acl CACHABLE_PAGES urlpath_regex ^/page1.jsp
acl CACHABLE_PAGES urlpath_regex ^/page2.jsp
acl NONE_CACHABLE_PAGES urlpath_regex \.jsp
no_cache allow CACHABLE_PAGES
no_cache deny NONE_CACHABLE_PAGES
maximum_object_size_in_memory 256 KB
cache_mem 128 MB
cache_dir diskd /data/squid/var/cache 1024 16 256
cache_log /data/squid/var/logs/cache.log
cache_store_log none
emulate_httpd_log off
dns_children 5
redirect_children 20
auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
refresh_pattern -i \.jpg$ 1440 50% 10080 reload-into-ims
refresh_pattern -i \.gif$ 1440 50% 10080 reload-into-ims
refresh_pattern -i \.png$ 1440 50% 10080 reload-into-ims
refresh_pattern -i \.bmp$ 1440 50% 10080 reload-into-ims
refresh_pattern -i \.css$ 10 50% 60 reload-into-ims
refresh_pattern -i \.js$ 10 50% 60 reload-into-ims
refresh_pattern -i \.htm$ 10 50% 60 reload-into-ims
refresh_pattern -i \.html$ 10 50% 60 reload-into-ims
refresh_pattern ^http://host1/page1\.jsp 1440 0% 1440 ignore-reload
refresh_pattern ^http://host1/ 1440 0% 1440 ignore-reload
refresh_pattern ^http://host1/page2\.jsp 2 0% 2 ignore-reload
refresh_pattern . 0 0% 0
...
some acl
...
visible_hostname squid1
httpd_accel_port 80
httpd_accel_host host1
httpd_accel_single_host on
httpd_accel_with_proxy off
httpd_accel_uses_host_header on
coredump_dir /data/squid/var/cache
client_db off
half_closed_clients off
client_persistent_connections off
server_persistent_connections off
some information: client_http.requests = 23.248488/sec client_http.hits = 11.862562/sec server.all.requests = 11.339263/sec page_faults = 0.003333/sec select_loops = 246.597295/sec select_fds = 214.716036/sec
Hi
I don't know what thing hitting your cache however your post solved my problem, I added these two tags from your post and my squid cpu load come down to 99% to 34% :)
client_persistent_connections off server_persistent_connections off
Thanks and regards