> ## Content Index
> Fetch the complete content index at: https://kudithipudi.org/llms.txt
> Use this file to discover other available public pages before exploring further.

# Project Uptime : Progress Report 5 : Getting ready for Reddit and Hacker News
- URL: https://kudithipudi.org/project-uptime-progress-report-5-getting-ready-for-reddit-and-hacker-news/
- Published: 2012-04-03T02:03:30.000Z
- Updated: 2012-04-03T02:03:30.000Z
- Description: A very timely post on Hacker News by Ewan Leith about configuring a low end server to take ~11million hits/per month gave me some more ideas...
- Author: admin
- Tags: Databases, HOWTO, Linux, Technology, Uncategorized, Web, #wp, #wp-post, #Import 2026-08-23 02:32

A very [timely post](http://news.ycombinator.com/item?id=3775715&ref=kudithipudi.org) on [Hacker News](http://news.ycombinator.com/?ref=kudithipudi.org) by [Ewan Leith](http://www.ewanleith.com/?ref=kudithipudi.org) about configuring a low end server to take \~11million hits/per month gave me some more ideas on optimizing the performance of this website. Ewan used a combination of [nginx](htt://nginx.org) and [varnish](https://www.varnish-cache.org/?ref=kudithipudi.org) to get the server to respond to such traffic.

From my [earlier post](https://kudithipudi.org/project-uptime/), you might recall, that I planned on checking out nginx as the web server, but then ended up using [Apache](https://kudithipudi.org/project-uptime-progress-report-3/). My earlier stack looked like this

![](http://farm8.staticflickr.com/7059/6894483670_4f80897e59_n_d.jpg "Stack - Old")

Based on the recommendations from Ewan’s article, I decided to add Varnish to the picture. So here is how the stack looks currently

![](http://farm8.staticflickr.com/7188/6894483686_dbd524fedb_n_d.jpg "Stack - New")

And boy, did the performance improve or what. Here are some before and after performance charts based on a test run from [blitz.io](http://blitz.io/?ref=kudithipudi.org). The test lasted for 60 seconds and was for 250 simultaneous connections.

**BEFORE**

Screenshot of the analysis summary. 84% error rate!!

![](http://farm8.staticflickr.com/7241/7039058741_24785181aa_z_d.jpg "Pre Varnish - 2")

Screenshot of Response times and hit rates. Note that the server essentially stopped responding 25 minutes into the test.

![](http://farm8.staticflickr.com/7085/7039058711_ec1ee1d2de_z_d.jpg "Pre Varnish")

**AFTER**

Screenshot of summary of Analysis. 99.98% success rate!!

![](http://farm8.staticflickr.com/7125/7039058847_26f9765f78_z_d.jpg "Post Varnish - 2")

Screenshot of response times and hit rates

![](http://farm8.staticflickr.com/7126/7039058817_7a2bacb17a_z_d.jpg "Post Varnish - 1")

What a difference!!.. The server in fact stopped responding after the first test and had to be hard rebooted. So how did I achieve it? By mostly copying the ideas from Ewan :). The final configuration for serving the web pages looks like this on the server end

Varnish (listens on TCP 80) –> Apache (listens on TCP 8080)

**NOTE :** All the configuration guides (as with the previous entries of the posts in this series) are specific to Ubuntu.

1. Configure Apache to listen on port 8080
  1. Stop Apache  
  ```  
  sudo service apache2 stop  
  ```
  2. Edit the following files to change the default port from 80 to 8080
    1. /etc/apache2/ports.conf
      1. Change  
      ```  
      NameVirtualHost *:80  
      Listen 80  
      ```
      2. to  
      ```  
      NameVirtualHost *:8080  
      Listen 8080  
      ```
    2. /etc/apache2/sites-available/default.conf (NOTE: This is the default sample site that comes with the package. You can create a new one for your site. If you do so, you need to edit your site specific conf file)
      1. Change  
      ```  
      <VirtualHost *:80>  
      ```
      2. To  
      ```  
      <VirtualHost *:8080>  
      ```
  3. Restart apache and ensure that it is listening on port 8080 by using this [trick](https://kudithipudi.org/how-to-find-out-which-network-port-a-program-is-using-in-linux/).
2. Install Varnish and configure it to listen on port 80
  1. Add the Varnish repository to the system and install the package  
  ```  
  sudo curl http://repo.varnish-cache.org/debian/GPG-key.txt | apt-key add –  
  sudo echo "deb http://repo.varnish-cache.org/ubuntu/ lucid varnish-3.0" >> /etc/apt/sources.list  
  sudo apt-get update  
  sudo apt-get install varnish  
  ```
  2. Configure Varnish to listen on port 80 and use 64Mb of RAM for caching. (**NOTE:** Varnish uses port 8080 to get to the backend, in this case Apache, by default. So there is no need to configure it specifically).
    1. Edit the file /etc/default/varnish
      1. Change  
      ```  
      DAEMON_OPTS="-a :6081 \

-T localhost:6082 \

-f /etc/varnish/default.vcl \

-S /etc/varnish/secret \

-s malloc,256m"  
      ```
      2. To  
      ```  
      DAEMON_OPTS="-a :80 \

-T localhost:6082 \

-f /etc/varnish/default.vcl \

-S /etc/varnish/secret \

-s malloc,64m"  
      ```
  3. Restart Varnish  
  ```  
  sudo service varnish restart  
  ```  
  and you are ready to rock and roll.

There are some issues with this setup in terms of logging. Unlike your typical web server logs, where every request is logged, I noticed that not all the requests were being logged. I guess, that is because varnish is serving the content from cache. I have to figure out how to get that working. But that is for another post :).