Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


LE Varnish?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

LE Varnish?

Steve81Steve81 Member
edited December 2012 in Help

I'm used to use, on my vpses, squid in reverse proxy mode. I decided to give a try to Varnish, but I don't understand how I can limit it's ram usage.

I'm trying to run it on a 64mb vps (squeeze 32bit) and I'd like to limit it's ram usage to 16mb.
I tried with "-l " but I continue to get OOM when I run it (as it allocate 80mb of ram, seems to me):
[8356445.308026] OOM killed process 9593 (varnishd) vm:85904kB, rss:76652kB, swap:0kB

Anyone know how to reduce Varnish memory usage?

Comments

  • LE Varnish

    Why would you....

  • InglarInglar Member
    edited December 2012

    Try this option:

    -s malloc,16MB

  • bigcatbigcat Member
    edited December 2012

    Edit /etc/default/varnish

    -s malloc,256m"

    to whatever value you want. Set it as ~13MB if you want to use only 16MB.
    At least that how I remember it back then

  • Go NGINX :-P

  • kbeeziekbeezie Member
    edited December 2012

    Normally you wouldn't run Varnish on something as small as a 64MB VPS... like trying to run memcachd or PHP + APC on something that size, it simply isn't feasible, your best bet is for high performance with low ram is to go with nginx primarily for static caching.

    Essentially even if you could limit it to fit within a 64MB VPS, it's usefulness wouldn't be worth much, unless your website is merely a dozen or so static HTML pages (in which case a simple nginx setup would have worked).

  • Steve81Steve81 Member
    edited December 2012

    @Inglar said: Try this option:
    -s malloc,16MB

    @bigcat said: Edit /etc/default/varnish
    -s malloc,256m"
    to whatever value you want. Set it as ~13MB if you want to use only 16MB.

    At least that how I remember it back then

    I already did that. I also tried with file cache instead of memory cache. But still it tries to allocate 80mb.

    @klikli said: Go NGINX :-P

    @kbeezie said: Normally you wouldn't run Varnish on something as small as a 64MB VPS... like trying to run memcachd or PHP + APC on something that size, it simply isn't feasible, your best bet is for high performance with low ram is to go with nginx primarily for static caching.

    I use PHP + APC on that vps (very few dynamic pages and a lot of static contents), and squid as reverse proxy. And it works quite good.
    I don't use nginx (and don't want to) and also I'd like to try Varnish.

  • @kbeezie said: or PHP + APC on something that size, it simply isn't feasible

    PHP + APC can be very happy on 64MB.

  • @sleddog said: PHP + APC can be very happy on 64MB.

    Now add Apache, MySQL and Varnish...

  • @kbeezie said: Now add Apache, MySQL and Varnish...

    That is not the point, nor would I want to.

  • Steve81Steve81 Member
    edited December 2012

    @kbeezie said: Now add Apache, MySQL and Varnish...

    I miss the point.
    Did I wrote that I want to install a lamp stack + Varnish on a 64mb vps?

    I simply stated that I use PHP + APC + Squid + Cherokee on my 64mb vps and I'd like to try Varnish instead of Squid.

    The question was "how to limit Varnish memory usage?", rather than "nginx vs varnish on 64mb vps".

    Thank you anyways, however.

  • @sleddog said: @kbeezie said: Now add Apache, MySQL and Varnish...

    That is not the point, nor would I want to.

    It's quite the point if the OP is trying to make Varnish work on a 64MB VPS along side PHP+APC, Apache and Possibly MySQL

  • Steve81Steve81 Member
    edited December 2012

    @kbeezie said: PHP+APC, Apache and Possibly MySQL

    Sorry, no.
    I didn't wrote that I used Apache (!nginx != apache) nor that I want to use MySQL.

  • kbeeziekbeezie Member
    edited December 2012

    @Steve81 said: I simply stated that I use PHP + APC + Squid + Cherokee on my 64mb vps and I'd like to try Varnish instead of Squid.

    The question was "how to limit Varnish memory usage?", rather than "nginx vs varnish on 64mb vps".

    I think it's more a question of why would you want to run Varnish with only 16MB available to it? Doesn't seem like you'd get much more benefit over just straight Cherokee with that limitation.

    You try editing the varnish config file itself?

  • joepie91joepie91 Member, Patron Provider

    @Steve81 If you are using Debian, you're most likely using an old version of Varnish that does not support malloc restrictions. I believe it will silently ignore the size specification. Compiling Varnish from hand from the latest stable version, should do the trick.

  • @kbeezie said: It's quite the point if the OP is trying to make Varnish work on a 64MB VPS along side PHP+APC, Apache and Possibly MySQL

    But that's not what you originally said:

    @kbeezie said: Normally you wouldn't run Varnish on something as small as a 64MB VPS... like trying to run memcachd or PHP + APC on something that size, it simply isn't feasible, ...

    I disagreed with the bit about PHP + APC not being feasible on 64MB. That's it.

    The OP made no mention of Apache, MySQL, memcache... or PHP for that matter.

    You introduced all that... :)

  • Steve81Steve81 Member
    edited December 2012

    @kbeezie said: I think it's more a question of why would you want to run Varnish with only 16MB available to it? Doesn't seem like you'd get much more benefit over just straight Cherokee with that limitation.

    Various reasons. One could be that Cherokee is vulnerable to slowloris, while squid or varnish aren't.
    Or that a static file readed from ram cache is better that a static file readed from disk.

    @kbeezie said: You try editing the varnish config file itself?

    I already tried editing relevant sections.

    @joepie91 said: @Steve81 If you are using Debian, you're most likely using an old version of Varnish that does not support malloc restrictions. I believe it will silently ignore the size specification. Compiling Varnish from hand from the latest stable version, should do the trick.

    Thank you.
    I use Squeeze, so Varnish 2.1.3; I'll try compiling the new version.
    Edit: However I got the same problem with -s file

Sign In or Register to comment.