Apache or ngnix ?

Hi,

some weeks ago someone told me that ngnix was better than apache as can handle more users and was more stable with big traffic. as i usually don’t discard the opinions and recommendations i receive, i started researching about this as i didn’t know anything about ngnix. for that, i wanted to write this post so can save you some time looking at the internet :D . for my research i used sources as serverFault.com and other blog post where it benchmark different php scripts (custom and wordpress blogs).

Apache and ngnix, what is the diference?

the main difference between ngnix and apache is that the way both web servers handle the user requests. apache have a multi thread architecture and ngnix have a unique thread architecture to process the user request. this is the main difference between both, the other important difference are the config files and the rewrite rules, where the format is difference from apache and a new user need to learn this new way to format the htaccess and the config files. other than this, both can manage virtual hosts, aliases,  etc..

Define the goal or purpose to choose.

i always say that there is no a complete tool or a ultimate language and technologies, each decision of what tool to use depends of the requirements of the project. in this case is the same, you need to evaluate your project to decide what to use.

after my research  i found that ngnix have a greater performance, in terms of memory needed, when the ngnix is serving static content. static content is called all what are images, videos, flash, files etc.. and optimized and cached dynamic pages, like a wordpress blog with super cache plugin.

in term of speed both are almost equal, having a difference in favor to ngnix at serving static files.

Conclusion

when i started to research this, i have in mind 2 projects, one of them was a non-optimized sites and the other a highly optimized site that doesn’t have a lot of cached pages but have a lot of static content.

then my conclusion was that you need to choose depending of your project requirement, to use apache or ngnix or both (yes, both can be used at the same time).

if you have a crappy php site, don’t bother you,   ngnix don’t going to give you any improvement, better, invest your time to improve the code.

if you have a highly optimized site and cached most of their pages and you don’t bother to rewrite any htaccess or config file in this new format, ngnix will give you a improvement in your server.

if you have a mixed site, highly optimized, but not too cached her pages, you can have both running, ngnix serving static content and apache serving the dynamic content, this will improve in some way your site with a better load balancing proportional of the percentage of static files are serving.

i hope this help you to decide in this matter, i’ll post later a tutorial of how to install ngnix and apache togheter :)

Regards,

Shadow

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Related Post

Still quiet here.sas

Leave a Response