2

Sometimes my application return a HTTP 503 error to a client. The only clue I have is that when it happen, Cacti reports a peak of Varnish SMS Allocation requests.

After some research I may have allocated too much RAM to Varnish compared to what my VM had. So I added 2GB. Varnish has been reload since, but not restarted.

Now the error happens rarely, but still.

  • 0 error in application log
  • 0 error in apache log

Here the cacti graph with the SMS peak: http://s29.postimg.org/94bu3vvd3/varnish_SMS.png

varnish-3.0.4 on RHEL 6.3

Varnish start parameters :

/usr/sbin/varnishd -P /var/run/varnish.pid -a :80 -f /etc/varnish/rc_platform.vcl -T xxx.xxx.xx.xxx:6082 -t 120 -w 1,1000,120 -u varnish -g varnish -S /etc/varnish/secret -s malloc,6G

Interesting part of varnishstat

SMA.s0.c_req            14736881         2.26 Allocator requests
SMA.s0.c_fail            4190399         0.64 Allocator failures
SMA.s0.c_bytes      353887517876     54362.00 Bytes allocated
SMA.s0.c_freed      347445180586     53372.37 Bytes freed
SMA.s0.g_alloc            311300          .   Allocations outstanding
SMA.s0.g_bytes        6442337290          .   Bytes outstanding
SMA.s0.g_space            113654          .   Bytes available
SMA.Transient.c_req     15771681         2.42 Allocator requests
SMA.Transient.c_fail           0         0.00 Allocator failures
SMA.Transient.c_bytes 910056978442    139797.31 Bytes allocated
SMA.Transient.c_freed 910056853513    139797.29 Bytes freed
SMA.Transient.g_alloc           52          .   Allocations outstanding
SMA.Transient.g_bytes       124929          .   Bytes outstanding
SMA.Transient.g_space            0          .   Bytes available

I have a 10GB VM and 6 are allocated to Varnish.

Thank you.

0

You have a really high SMA.s0.c_fail count. So, Varnish tries to allocate memory and fails. You can have Varnish be more aggressive by upping the nuke_limit, which is the number of objects Varnish can kill when trying to free memory.

You need to restart for changes to memory settings to take effect. However, I suggest having some more memory available to your server. Giving Varnish more memory is usually cheap and smart.

To avoid failing a request Varnish will allocate transient memory to store an object. The transient memory storage is unbounded, which means it can potentially bring a server down if it being overused. You might limit it if you want to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.