Please disable your adblock and script blockers to view this page

Linux Applications Performance: Introduction - Unixism

Digital Ocean
the Linux API




No matching tags


No matching tags

Positivity     38.00%   
   Negativity   62.00%
The New York Times
Write a review: Hacker News

Understanding these fundamental constraints and how to work around them will in general make you appreciate what performance and scalability of your web applications or services are up against.I am writing this series in response to the questions I get asked by young developers who want to become well–informed system architects. This is because the audience for this series are web services/application developers and architects who want to understand how Linux or Unix applications work and how to structure these services for high performance. Where I attempt anything Linux-specific, I’ve done my best to point it out.While you can certainly use this knowledge to choose the best possible structure for a new network application you want to write from scratch, you might not be firing up your favorite text editor and writing a web server in C or C++ to solve the problem of having to deliver the next business app in your organization. You will get to understand and appreciate why Nginx performs better than Apache httpd or why a Tornado based Python application might be able to serve more concurrent users compared to a Django based Python application.ZeroHTTPd is a web server I wrote from scratch in C as a teaching tool. We roll our own Redis routines–read more below.While we could talk a whole lot of theory, there is nothing like writing code, running it, benchmarking it to compare each of server architectures we evolve. Having said this, ZeroHTTPd is well-suited for you to understand how to architect your Linux applications for high-performance. So, we discard the return value that Redis returns when we increment the visitor count and read it back in a separate call.We will build ZeroHTTPd, retaining the same functionality, using 7 different architectures: We shall also measure the performance of each architecture loading them each with 10,000 HTTP requests. The prethreaded server architecture giving the epoll-based server a good run for its money is a testament to how well the Linux kernel handles scheduling of a very large number of threads.You can find the source code for ZeroHTTPd here. Each server architecture gets its own directory.In the top level directory, apart from the 7 folders that hold the code for ZeroHTTPd based on the 7 different architectures we discuss, there are 2 other directories there. High-performance applications use resources sparingly in general and are thus efficient at serving more concurrent users per server, driving down costs, which is a good thing.Finally, there are always only two possible types of tasks in computing: I/O bound and CPU bound.

As said here by