Free, Open-source, Cross-platform Web Servers. : Apache Vs Ngix

Apache

  • (+) widely used for many years.
  • (+) lots of modules have been written to expand its functionality.
  • (-) slows down under heavy load because of the need to spawn new processes, thus consuming more computer memory.
  • (-) It creates new threads that must compete with others for access to memory and CPU (may cause deadlocks).
  • (-) It refuses new connections when traffic reaches the limit of processes configured.
  • (-) It relies on processes and threads.

Ngix

  • (+) it was written to address some of the performance and scalability issues associated with Apache.
  • (+) It was written to address the C10K problem (the ability to handle 10.000 connections, given the limitations of the operating systems).
  • (+) It’s event-driven and asynchronous.
  • (+) the use of cache loader and cache manager processes to read data from disk and load it into the cache and expire it from cache when directed.
  • (-) missing modules needed to work with back end application servers and run scripting languages.
  • (-) Things that ‘just work’ out of the box with Apache may need additional research and configuration under nginx. Control panels and automatic configuration tools may not be available for nginx yet.

According to source [1], Apache is known for its power (more modules available to work with back end applications and to run scripting languages)  and Nginx for speed (serves static content quicker). So if your website uses predominately languages such Python or Ruby then Apache should be the choice. Otherwise, if PHP is the main language and high load and speed are two important features and your website serves mainly static content than Ngix is the right choice.Source [2] e [3] chooses Apache because it is a more mature web server, more robust and it has more documentation (therefore, is more easy to learn). Apache provides lot more functionality than Nginx. It supports a much wider range of Operating Systems.Across all sources the right answer is a combination of both or some kind of cluster with multiple web servers, load balancers and the use of cache and its management.

Personally I am going to use Apache, because my aim is to learn how to develop websites using PHP and I will not have (at least for now) the problem of high load and excessive consume of resources. Also, I am choosing Apache over Ngix because currently is the most used in the open-source world and therefore I will have access to more documentation and features.

Sources:

[1]https://anturis.com/blog/nginx-vs-apache/

[2]http://www.itworld.com/article/2695421/consumerization/choosing-a-linux-web-server–nginx-vs–apache.html

[3]http://www.thegeekstuff.com/2013/11/nginx-vs-apache/

(note: Some of this text is extracted directly from the sources).

Advertisements