The sys admin's daily grind – Gatling
Apache Under Fire
Western aficionados and sys admin Charly are about to set up a Gatling in a field that is normally home to Apache. Read on to discover why blogger Fefe is to blame.
I admit to watching (too) many westerns as a child; in other words, I'm fully aware of what a Gatling gun is: an automatic weapon with multiple rotating barrels. In old movies, soldiers used its infernal din to send the horses of attacking Apaches galloping mad. And, this always worked until an Apache warrior crept up from behind and torched the ammunition chest.
As a rapid fire weapon, the Gatling lends its name to the web server I will be looking at today. The server's binary file is a lightweight compared with its name giver, weighing in at just 100KB. Its RAM requirements are minimal, too, because Gatling [1] does not fork. On an old PC, Gatling is just as fast as on my Raspberry Pi. The daemon is even included with the plain vanilla Raspbian distribution.
The server is designed for delivering static web pages as quickly as possible. To allow this to happen, its programmer, Felix "Fefe" von Leitner, whose widely read blog [2] naturally also runs on Gatling, gave the server just as many features as the number of shells you could slot into a revolver (IPv6, TLS/SSL, simply equipped virtual hosts, login via the .htaccess
mechanism).
If you want this tool, you need to build it from the source code, but before doing so, remember to install the IO-API library [3], which was also implemented by Fefe. Launched without any parameters, Gatling serves up the data from the current directory, but you can home in on a target like this:
gatling -u nobody -c /var/www
After Gatling has shot its way out of port 80, it drops its root privileges and continues running with the "nobody" account – which is also the name of a character played by actor Terence Hill 42 years ago [4]. The chroot
parameter -c /var/www
helps the sheriff bundle off the data into the county jail. And, -A number
fends off mass attacks by telling Gatling to restrict the number of HTTP requests per minute and client.
This Is the End of the Line, Django!
The log format is exotic (Figure 1), but it does help you understand the timing. An HTTP connection times out after a nerdy 23 seconds (last line). I tend to change this timeout value to 10 or fewer seconds using the -T seconds
paragraph, to release the sockets as quickly as possible. The reason for this change is that I tend to run Gatling on the front line, where access attempts are like a heavy barrage. The web server responds with static HTML, for example, when a server farm enters a maintenance window ("Please try again later") or in the case of blogs that are churned out by static site generators.
Gatling even offers a simple FTP server (which you can disable with the -F
switch). And, if you allow general access to the FTP directory, users can upload files. Conversely, you can only download files that you are allowed to read.
Backed up by a Gatling, "Nobody" can relax and coolly ride off into the sunset as the closing credits roll by.
Infos
- Gatling: http://www.fefe.de/gatling/
- Fefe's blog: http://blog.fefe.de (in German)
- Libowfat: http://www.fefe.de/libowfat/
- My Name is Nobody: https://en.wikipedia.org/wiki/My_Name_Is_Nobody
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.
-
Fedora 41 Released with New Features
If you're a Fedora fan or just looking for a Linux distribution to help you migrate from Windows, Fedora 41 might be just the ticket.
-
AlmaLinux OS Kitten 10 Gives Power Users a Sneak Preview
If you're looking to kick the tires of AlmaLinux's upstream version, the developers have a purrfect solution.
-
Gnome 47.1 Released with a Few Fixes
The latest release of the Gnome desktop is all about fixing a few nagging issues and not about bringing new features into the mix.
-
System76 Unveils an Ampere-Powered Thelio Desktop
If you're looking for a new desktop system for developing autonomous driving and software-defined vehicle solutions. System76 has you covered.
-
VirtualBox 7.1.4 Includes Initial Support for Linux kernel 6.12
The latest version of VirtualBox has arrived and it not only adds initial support for kernel 6.12 but another feature that will make using the virtual machine tool much easier.
-
New Slimbook EVO with Raw AMD Ryzen Power
If you're looking for serious power in a 14" ultrabook that is powered by Linux, Slimbook has just the thing for you.