Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Other than virtual memory, How about RAM usage for Varnish?

Is it much RAM needed?

share|improve this question

3 Answers 3

http://varnish-cache.org/wiki/FAQ#HowdoIregulatehowmuchmemoryVarnishwilluseforcaching

Which redirects you to here: http://varnish-cache.org/wiki/ArchitectNotes

share|improve this answer
    
+1 for link to interesting article –  sumar Mar 2 '10 at 21:43

Caches obviously thrive on memory. But how much you need depends on your site.

Benchmark varnish+your site using request logs, and see how fast memory use grows. Use a vm to test how many requests you can handle with different ram configurations (enable a ram balloon driver).

share|improve this answer

You can run Varnish in a few different modes. One uses the disk as the cache repository and in this mode, you can safely restart Varnish without losing your cache. This also means you can support a very large cache and let the OS's IO cache keep the most requested content in the server's memory. This mode is configured with the flag -s file,/var/lib/varnish/varnish_storage.bin,1G

The other mode is memory-only - Varnish keeps all cached data only in memory, never writing to disk. This can deliver extremely fast response times, but the cache size is limited to how much memory your server has. Also, if you restart Varnish you lose the cache and suddenly requests will start flooding your backend. Note, however, that Varnish is extremely stable and we only ever restart Varnish when an update is released (every 6 months or so). This mode is configured like -s malloc,3200M

So to answer your question, Varnish performs much better with more RAM. We have a Amazon EC2 instance with 3.5GB RAM and no swap and give Varnish 3GB of RAM for caching. Currently we have almost the entire backend site in cache, including images and PDF files etc. I can definitely recommend this setup.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.