Blog: Archive

2011-05-31 - 2011-06-29

Speeding up midcom/midgard with Varnish

Speeding up websites is a part of my work. So here a small thing on what varnish can do for midcom based websites.

I have done this on websites running Tomcat, Wordpress, Drupal on both large installations and smaller ones. And decided to put a sample on how it affects Midcom/Midgard.

I did some preliminary tests on how it would work on this blog using one of my testservers for Varnish. Some small and simple rules made the website almost 3 times as fast. And this Varnish installation is not that optimized.

One of the things todo is to cache images .. we do that in vcl_fetch in the vcl code.

 if (req.url ~ "\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|flv|swf|html|htm)$") {
    if (beresp.status == 200) {
      remove beresp.http.Cache-Control;
      remove beresp.http.Set-Cookie;
      remove beresp.http.expires;
      set beresp.http.magicmarker = "1";
      set beresp.http.Cache-Control = "max-age=604800";
      set beresp.ttl = 1d;
      set beresp.cacheable = true;
    }
  }

 

Im using an unconfigured Siege on /blog for about 20 seconds.

Before Varnish:

Lifting the server siege...      done.
Transactions:		          53 hits
Availability:		      100.00 %
Elapsed time:		       20.28 secs
Data transferred:	        1.53 MB
Response time:		        4.43 secs
Transaction rate:	        2.61 trans/sec
Throughput:		        0.08 MB/sec
Concurrency:		       11.58
Successful transactions:          53
Failed transactions:	           0
Longest transaction:	       12.66
Shortest transaction:	        0.72

After Varnish:

Lifting the server siege...      done.
Transactions:		         170 hits
Availability:		      100.00 %
Elapsed time:		       20.11 secs
Data transferred:	        4.88 MB
Response time:		        1.21 secs
Transaction rate:	        8.45 trans/sec
Throughput:		        0.24 MB/sec
Concurrency:		       10.19
Successful transactions:         170
Failed transactions:	           0
Longest transaction:	        5.58
Shortest transaction:	        0.52
Some insights on what small and simple performance tasks can do for your website. To speed things up more we can use Varnish to fron several midgard enabled backends to spread the load.
Posted on 06/04/11 12:20:42. /blog/speeding_up_midcom-midgard_with_varnish/.


Preliminary test results for varnish on midgard-project.org

This is the preliminary results on running varnish on a larger site than my blog ...

Scaling up some and running Varnish on the main site for the midgard project website show just how much better you can make a website perform.

The data ...

siege -b on http://www.midgard-project.org/documentation/

Without Varnish:

Transactions:                     817 hits
Availability:                 100.00 %
Elapsed time:                   9.69 secs
Data transferred:               3.75 MB
Response time:                  0.18 secs
Transaction rate:              84.31 trans/sec
Throughput:                     0.39 MB/sec
Concurrency:                   14.81
Successful transactions:         817
Failed transactions:               0
Longest transaction:            1.36
Shortest transaction:           0.01

 

With Varnish:

Transactions:                    2951 hits
Availability:                 100.00 %
Elapsed time:                  10.69 secs
Data transferred:              58.38 MB
Response time:                  0.05 secs
Transaction rate:             276.05 trans/sec
Throughput:                     5.46 MB/sec
Concurrency:                   13.50
Successful transactions:        2951
Failed transactions:               0
Longest transaction:            0.43
Shortest transaction:           0.00

 

I guess that says it all. I will try to add some more logic to Varnish so that it doesnt cache logged in users.  After that we can launch it  :)

 

Posted on 06/12/11 18:28:57. /blog/preliminary_test_results_for_varnish_on_midgard-project-org/.


Back