here is the million dollar questoin! 😀 what is the best web server ? nginx or apache ? if you dig some deep on this, you’ll come around that unless, you have a very big user base or limited hardware resources, it doesn’t matter.
so i wanted to test this with drupal, whether it actually makes a difference in a practical situation. (theoretically it should) thanks to AWS free tier i setup my test environment using AWS as below.
SETTING UP TEST ENVIRONMENT
following are the actions i performed in AWS console and in EC2,
- launched an EC2 instance
- launched RDS instance for mysql (for use as drupal’s DB)
- installed both apache and nginx servers in EC2 instance
- installed drupal and connected it to RBD server
- added some dummy content in drupal site
next i created an image of my EC2 instance (AMI) and launched another instance with the same hardware features as previous EC2 instance in same region from the created AMI.
so the next steps followed are,
- configured one instance to run apache only and another to run nginx only.
- pointed drupal installation as root directory in both servers.
after this, i had two drupal installations with same content running on apache and nginx in same location.
CREATING A TEST PLAN
so the basic thing i wanted to test is,
server performance in limited hardware over a large traffic.
i used jmeter with performance monitor plugin for this. performance monitor plugin will allow you to measure server performance metrics in jmeter.(cool right ? 🙂 )
for the test plan, in jmeter
- added thread group with 1000 threads to simulate 1000 users
- inside thread group added HTTP GET request to root folder to simulate main page access in druapl site
- added a performance monitor metric collector to measure server CPU & memory usage
- added a summary report to get overall statistics
so i performed this same test on both of my EC2 instances. following are the results i obtained.
so so so, here it is! answer for the million dollar question.
under a large traffic with same hardware resources, nginx performs way better than apache.