LEMP Stack Technology

A LEMP Stack is a group of softwares which is used for development and deployment of web application. It is an open source web platform just like traditionally pervasive LAMP.
LEMP consists Linux, Nginx, MySQL and PHP whereas LAMP consists Linux, Nginx, MySQL and PHP.

LAMP have modular nature and their components can easily be swapped out. With LEMP Apache is replaced because it’s pretty bloated and the model it uses to handle web requests is less good at handling massive web traffic from modern web applications.
So it is replaced by NGINX’s model whose handling requests is very lightweight and thus tends to scale better.

LEMP Compnenents

Linux: Linux operating system is open source and loosely based on Unix. Many Distributions of the OS often have package management systems that make it easy to install the other applications, but you should ideally compile from source so you get the latest version. Two of the most commonly used Linux distributions in LEMP stacks are Debian and Ubuntu.

Nginx: ā€œIt is an open source reverse proxy server for HTTP, HTTPS, SMTP, POP3, and IMAP protocols,ā€ defined in LEMP Stack Info. It is especially designed by considering the performance as it has functions of load balancer and low memory consumption techniques. Also it is fast and doesn’t use a lot of RAM in comaprision to Apache Server.

MySQL: It is a relational database management system and it is second most popular in the world. It is based on the structure query language (SQL), which is used for adding, removing, and modifying information in the database.

PHP: It is a server-side scripting language and it is sometimes set aside in favor of open source competitors Perl or Python.

Why LEMP instead of LNMP?

The E in LEMP Stack defines Nginx and it is beacause of the pronunciation for Nginx: Engine-X (en-juhn-ecks). Also E is used as it lets the technology more pronouncable. LEMP is more easy to pronounce rather than LNMP.

Nginx vs Apache?

Apache: The Apache is well-known, extremely powerful, and still the gold standard for web server daemons. But it’s pretty distended, and the model it uses to handle web requests is only good for the limited web traffic from modern web applications.

It creates processes and threads to handle additional connections. Apache creates new process as a user tries to connect to the server. The configuration of apache server to control the maximum number of allowable processe can be managed by server admin. This configuration varies depending on the available memory on the machine. The performance severely degrades as too many processes exhaust the memory and it can cause the machine to swap memory to disk. Plus, when the limit of processes is reached, Apache refuses additional connections.

The limiting factor in tuning Apache is memory and the potential to dead-locked threads that are contending for the same CPU and memory. If a thread is stopped or any other resources have associated with the thread, then user waits for the web page to appear, until the process makes it free, Thus the deadlock situation appears. It doen’t get the page data and gets stucked.

Nginx: The Nginx is very good server for sites that need fast & efficient reverse proxies or fast & efficient serving of static content. It is acclaimed for having low memory usage. It works differently than Apache because of having different mechanism to handle threads/processes over server. It does not create new processes for each web request whereas Apache does. The administrator configures how many worker processes to create for the main Nginx process. Every process of them is single-threaded and each worker can handle thousands of concurrent connections. It is achieved asynchronously with one thread, instead of using multi-threaded programming.

The Nginx Server also spins off cache loader and cache manager processes to read data from disk and load it into the cache and expire it from the cache when directed, which lets the web page load faster.

Nginx is composed of modules that are included at compile time. That means the user downloads the source code and selects which modules to compile. There are modules for connection to back end application servers, load balancing, proxy server, and others. There is no module for PHP, as Nginx can compile PHP code itself.