LiteSpeed Web Server is Event-Driven https://litespeedtech.com/images/logos/litespeed/litespeed-logo.png 2018-04-13 13:32:40 LiteSpeed Web Server's event-driven architecture vs. Apache's process-based: Fewer processes means less overhead, more connections, and no hardware upgrade required.

Event-Driven vs. Process-Based Web Servers

Fewer processes means less overhead and more connections with no hardware upgrade required

see it at work
[

Want to see it at work?

Download a trial license or check out our customer testimonials and case studies.

]

The Event-Driven Advantage

The biggest difference between LiteSpeed Web Server and Apache is in the way that they handle connections: LiteSpeed Web Server utilizes an event-driven architecture and Apache is process-based.

  • Apache creates a new process or thread for every connection. This is a model which requires a lot of overhead.
  • LiteSpeed Web Server, with its event-driven architecture, serves all connections with few processes, saving resources.
  • This efficient method allows you to serve significantly more connections, faster, and without upgrading your hardware.

A Detailed Discussion of Event-Driven vs. Process-Based Servers

more overhead

Process-Based = Exponentially More Overhead

LiteSpeed Web Server and Apache are built upon different architectures. Apache comes from an older breed of process-based servers. In essence, Apache starts a new process (or thread) to handle every connection it gets. More connections means more threads. For every connection that requires PHP, Apache must start a new PHP process, increasing memory usage exponentially. As the number of connections rises, so does the burden on your Apache server. Access to your site slows down, and visitors leave, deciding it's not worth it to wait for your pages to load.

light weight and efficient

Event-Driven = Lightweight and Efficient

The antidote to all of this is an event-driven architecture. LiteSpeed handles all the connections it gets with one process (or, in some cases, very few processes). This one process stays open and handles all events that pop up — new requests coming in and new dynamic responses ready to go out. LiteSpeed Web Server concerns itself not with creating new processes to handle every aspect of every connection, but with reacting to events that occur.

all types of content

A Clear Advantage for all Types of Content

For static content (like images, CSS, HTML), the advantage is obvious: instead of consuming the overhead required for a new process for each request, LiteSpeed's event-driven model employs its one process to handle the requests as they come in. This is faster and consumes significantly less CPU and memory than Apache.

For web applications (like PHP) and database processes (like MySQL), the interaction is complex, but is still far more efficient than a process-based model:

  • LiteSpeed Web Server fields requests and forwards them to external processes.
  • LiteSpeed does not wait around for the dynamic responses, but instead continues to field more requests (both static and dynamic)
  • When an external process response is ready, LiteSpeed Web Server gets a callback (a new event to which it must react)
  • LiteSpeed sends the external response back to the requesting client.

During all of this, LSAPI, LiteSpeed's server API, keeps control over the number of processes being created for web applications, and reuses them wherever possible, further increasing CPU and memory efficiency.

low cpu usage

Consistently Low CPU Usage in Heavy Traffic

When dealing with tens of thousands of concurrent connections, would you rather field the requests and responses with a few processes? Or would you rather create a separate process for every one of those connections? The answer is clear. An event-driven server's CPU and memory usage do rise under heavy traffic conditions, but not exponentially like they do with Apache's process-based server. An event-driven model allows for faster content delivery because the server skips the overhead of creating new processes and has more memory left for handling database and external applications. Most importantly, it allows for consistently low CPU (load) and memory usage, even during traffic spikes or DDoS attacks.


Coffee Making

Coffee Making - The Coffee Shop Analogy

  • process based

    The Process-Based Coffee Shop

    Each employee serves one customer; They take the customer's order, fill it, and take payment.

    This is fine if you have a small number of customers or very simple orders like coffee and doughnuts. But what happens when there is a packed house full of customers, each of whom is ordering a complicated drink (venti mocha, two Splenda, half 2%, half soy...)?
    If each of your employees has to take one order, fill the order, and take payment, before they can serve the next customer, you will need a lot of employees and a very, very big shop! Otherwise, potential customers will be frustrated with the wait, and they will leave.
    This is how many hosts deal with more traffic: they just buy lots and lots of hardware.
  • event based

    The Event-Based Coffee Shop

    One employee takes the orders and delegates them to other employees to fill.

    The ideal solution is to make your employees event-driven: to have one person take the orders and have other people in the background filling those orders. The person taking the orders is concerned only with relaying instructions to the baristas on the backend. In this way, one person can do the work of many. You don't need extra counter space, or many people taking orders.
    This solution scales well. You save money on retail space and wages, and your customers get their fancy coffees more quickly.
    In the same way, LiteSpeed Web Server saves you money on hardware and support by requiring less CPU and less memory, and making your servers run more smoothly.

accelerate internet
[

Accelerate Your Internet Now!

]