有时在繁忙的Pressflow网站上,我注意到未authentication的用户超时,而服务器的端口远未饱和,有大量未使用的内存,服务器负载很低。
除此之外,自从我转移到采用新configuration的新的Varnish驱动的服务器以来,该网站的带宽使用量下降了大约30%。 所以我怀疑这个下降可能是因为Varnish的错误configuration。
这里有一些相关的参数:
DAEMON_OPTS="-a :80 \ -T localhost:6082 \ -b localhost:8080 \ -u varnish -g varnish \ -S /etc/varnish/secret \ -p thread_pools=14 \ -p thread_pool_min=200 \ -p thread_pool_max=5000 \ -p listen_depth=128 \ -p thread_pool_add_delay=2\ -p lru_interval=20 \ -h classic,72227 \ -p session_linger=120 \ -p sess_workspace=32768 \ -p connect_timeout=600 \ -s malloc,15G"
#这里是varnishstat的最新输出:
1+21:07:54 Hitrate ratio: 10 13 13 Hitrate avg: 0.8405 0.8408 0.8408 21003013 158.92 129.32 Client connections accepted 35390015 283.85 217.91 Client requests received 4696051 26.99 28.92 Cache hits 79 0.00 0.00 Cache hits for pass 939223 4.00 5.78 Cache misses 10041628 89.95 61.83 Backend conn. success 108 0.00 0.00 Backend conn. failures 20651750 162.92 127.16 Backend conn. reuses 3202624 22.99 19.72 Backend conn. was closed 23854404 187.90 146.88 Backend conn. recycles 17397 0.00 0.11 Fetch head 20499527 189.90 126.22 Fetch with Length 6536900 37.98 40.25 Fetch chunked 2410249 15.99 14.84 Fetch wanted close 4 0.00 0.00 Fetch failed 2261 . . N struct sess_mem 1728 . . N struct sess 263703 . . N struct object 264848 . . N struct objectcore 138282 . . N struct objecthead 116 . . N struct vbe_conn 2800 . . N worker threads 2801 0.00 0.02 N worker threads created 2889 0.00 0.02 N worker threads limited 832 0.00 0.01 N overflowed work requests 1 . . N backends 658946 . . N expired objects 6948 . . N LRU nuked objects 3425448 . . N LRU moved objects 31922006 257.87 196.56 Objects sent with write 21002526 160.92 129.32 Total Sessions 35390015 283.85 217.91 Total Requests 750 0.00 0.00 Total pipe 29752808 252.87 183.20 Total pass
所以,这里是我的问题:我应该怎么知道清漆线程是否饱和? 我应该如何操纵参数来增加吞吐量? 谢谢
我主要是推荐调整thread_pool_min和thread_pool_max,其他的值不用太多。 -p thread_pools = 2 \ -p thread_pool_min = 500 \ -p thread_pool_max = 5000 \
特别是将thread_pools设置为CPU的数量根本没有帮助,并且可能会降低您的机器速度。 这只是一个猜测,但也许已经解决了你的问题! 🙂
你会在这里find很好的解释: http : //book.varnish-software.com/4.0/chapters/Tuning.html