Varnish 调优

来源:互联网 发布:传世1.0源码 编辑:程序博客网 时间:2024/04/29 20:22

varnish非常适合做静态服务器,性能超越nginx,一些web静态资源如css,js,图片等可以放进去,以实现在页面之间共享缓存资源。

To see further description of these settings, also check param.show -l in the Varnish management interface.
• -p thread_pool_min=200 (default: 5)
Idle threads are harmless. This number is multipled by the number of thread pools you have available, and the total should be roughly what you need to run on a normal day.
• -p thread_pool_max=4000 (default 1000)
The maximum number of threads is in essence limited by available file descriptors, however, setting it too high does not increase performance. Having a number of idle threads is reasonably harmless, but do not increase this number above roughly 5000 or you risk running into file-descriptor related issues, among other things.
• -p thread_pool_add_delay=2 (default: 20ms, default in master: 2ms)
Reducing the add_delay lets you create threads faster which is essential - specially at startup - to avoid filling up the queue and dropping requests.
• -p session_linger=100 OR MORE (default: 0ms in <= 2.0.4 and 50ms in > 2.0.4)
To avoid too much context switching when you starve your CPU (and in general), letting each thread wait for new requests is essential. The value depends on how long it takes you to deliver the typical object. This will also reduce the amount of threads piling up (which is somewhat counter intuitive).
• -s malloc,(YOURMEMORY-20%)G
Keep data in memory using -s malloc.

0 0