varnish优化选项

Vvarnish settings

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.

VCL Setting

Enable grace period (varnish serves stale (but cacheable) objects while retriving object from backend)

in vcl_recv:

set req.grace = 30s;

in vcl_fetch:

set obj.grace = 30s;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值