I am running Drupal 6 with pressflow on Ubuntu 11.04. I installed Varnish http accelerator and Varnish Drupal module. The Varnish is running and the Varnish page at admin/settings/varnish confirms this.

I measured the Time per request before and after installing Varnish with apache bench like this:

ab -n 10 http://my-site.local/

Installing varnish actually increases the Time per request from about 1 second to 1.3 seconds so there must be something wrong in my configuration of Varnish http accelerator.

In php.ini I have set a memory_limit of 512M.

While configuring Varnish to talk with Drupal I followed these instructions given in http://groups.drupal.org/node/25425.

Here is the contents of my /etc/default/varnish

 # Configuration file for varnish
    # /etc/init.d/varnish expects the variables $DAEMON_OPTS, $NFILES and $MEMLOCK
    # to be set from this shell script fragment.

    # Should we start varnishd at boot?  Set to "yes" to enable.

# Maximum number of open files (for ulimit -n)

# Maximum locked memory size (for ulimit -l)
# Used for locking the shared memory log in memory.  If you increase log size,
# you need to increase this number as well

# Default varnish instance name is the local nodename.  Can be overridden with
# the -n switch, to have more instances on a single server.

# This file contains 4 alternatives, please use only one.

## Alternative 2, Configuration with VCL
# Listen on port 6081, administration on localhost:6082, and forward to
# one content server selected by the vcl file, based on the request.  Use a 1GB
# fixed-size cache file.

DAEMON_OPTS="-a :80 \
             -T localhost:6082 \
             -f /etc/varnish/default.vcl \
             -u varnish -g varnish \
             -S /etc/varnish/secret \
             -s malloc,256M"

And here is the statistics Varnish module gives after running apache bench few times:

      41  Client connections accepted
      41  Client requests received
      29  Cache hits for pass
      12  Cache misses
      41  Backend conn. success
      12  Backend conn. was closed
      12  Backend conn. recycles
       1  Fetch with Length
      11  Fetch chunked
      29  Fetch wanted close
      11  N struct sess_mem
       2  N struct object
       4  N struct objectcore
       4  N struct objecthead
      10  N worker threads
      10  N worker threads created
       1  N backends
      10  N expired objects
      40  Objects sent with write
      41  Total Sessions
      41  Total Requests
      29  Total pass
      41  Total fetch
   16495  Total header bytes
  645600  Total body bytes
      41  Session Closed
       1  Session Linger
    3776  SHM records
     899  SHM writes
      53  SMA allocator requests
       4  SMA outstanding allocations
   19984  SMA outstanding bytes
 5254284  SMA bytes allocated
 5234300  SMA bytes free
      41  Backend requests made
       1  N vcl total
       1  N vcl available
       1  N total active purges
       1  N new purges added
      41  HCB Lookups without lock
       3  HCB Lookups with lock
       3  HCB Inserts
     922  Client uptime
  • 1
    Can you post your VCL files? – Dylan Tack Oct 6 '11 at 17:10

I cannot comment yet as a new user so here goes my response.

For starters 1 second to 1.3 seconds is not all that much of a difference, and you dont seem to have an overabundance of misses so its doing its thing. Run some tests that simulate a lot of page requests on the same content and watch the hits/misses. Also did you test again without Varnish on the same site?

One other thing is to be sure you've properly sized the Varnish storage to match your servers available resources. This being off too much can drag the system for obvious reasons.

Any reason your not using Drupal 7? Pressflow 7 is available now too.

There is also the option to use Boost + Varnish. http://www.trellon.com/content/blog/boosted-varnish-high-performance-caching-made-easy

| improve this answer | |
  • Do you have any rule-of-thumb measure to assign varnish size? – alfish Jan 6 '12 at 0:32
  • Not particularly, folks use it so differently and in conjunction with other caches, so its pretty much up to preference. – Macronomicus Mar 30 '12 at 6:57
  • 1s to 1.3s is a 30% increase in response time. That's huge when user-perception is in the 150 millisecond level. – Frankie Feb 12 '14 at 14:42

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.