web server written in PHP

Vincent Negrier, also known as sIX, presented to the public the first web server written entirely in PHP. The full name of the product is the aEGiS PHP nano web server, but users, and the author himself, shorten this name to just Nanoweb. In a short README supplied with the server sources, the author explains why we should use this miracle of programming thought. And the first thing he pays attention to is that the server turned out to be nimble and stable. As for sustainability, the report on the project’s website says the following: “For 101 days of uptime, the server did not show a single problem with performance, during this time it served more than 4.1 million requests with a total “weight” of more than 52 gigabytes.” We will talk about performance a little later, but for now we will list the main features of this miracle server:

– compatible with HTTP/1.1;

– simple but rich configuration options;

– modular architecture;

– Support for FastCGI, CGI and Server side includes (SSI);

– virtual hosts, addressable by name or port;

– access control lists (Access control lists, ACLs);

– support for authentication via htpasswd, MySQL, PostgreSQL and LDAP;

– support for themes for server-generated content;

– Apache compatible log format;

– SSL support via external modules;

– protection against DoS attacks;

– support for filters and compression;

– support for RBL blacklists (mail-abuse.org);

– support for HTTP protocol extensions (new methods);

– and much more.

As for performance, the test results are posted on the developer’s website. Here’s a look at the output of the diagnostic program ab (Apache benchmark) after the end of the test, consisting of 500 requests (20 simultaneous) to static and dynamic content. The measurements were carried out on a machine with an AMD Duron 700 processor and one gigabyte of RAM.

Static test:

Server Software: aEGiS_nanoweb/2.0.1-dev

Server Hostname: si.kz

Server Port: 80

Document Path: /six.gif

Document Length: 28352 bytes

Concurrency Level: 20

Time taken for tests: 3.123 seconds

Complete requests: 500

Failed requests: 0

Broken pipe errors: 0

Keep-Alive requests: 497

Total transferred: 14496686 bytes

HTML transferred: 14337322 bytes

Requests per second: 160.10 [#/sec] (mean)

Time per request: 124.92 [ms] (mean)

Time per request: 6.25 [ms] (mean, across all concurrent requests)

Transfer rate: 4641.91 [Kbytes/sec] received

Connnection Times (ms)

min mean[+/-sd] median max

Connect: 0 0 1.9 0 13

Processing: 18 100 276.4 40 2739

Waiting: 1 97 276.9 39 2739

Total: 18 100 277.8 40 2750

Percentage of the requests served within a certain time (ms)

50% 40

66% 49

75% 59

80% 69

90% 146

95% 245

98% 449

99% 1915

100% 2750 (last request)

Dynamic test (PHP 4, CGI):

Server Software: aEGiS_nanoweb/2.0.1-dev

Server Hostname: si.kz

Server Port: 80

Document Path: /index.php

Document Length: 1606 bytes

Concurrency Level: 20

Time taken for tests: 70.509 seconds

Complete requests: 500

Failed requests: 0

Broken pipe errors: 0

Keep-Alive requests: 0

Total transferred: 921500 bytes

HTML transferred: 803000 bytes

Requests per second: 7.09 [#/sec] (mean)

Time per request: 2820.36 [ms] (mean)

Time per request: 141.02 [ms] (mean, across all concurrent requests)

Transfer rate: 13.07 [Kbytes/sec] received

Connnection Times (ms)

min mean[+/-sd] median max

Connect: 0 0 2.1 0 12

Processing: 388 2785 785.6 2779 4860

Waiting: 372 2784 785.7 2779 4859

Total: 388 2785 785.5 2779 4860

Percentage of the requests served within a certain time (ms)

50% 2779

66% 3099

75% 3286

80% 3378

90% 3802

95% 4241

98% 4530

99% 4631

100% 4860 (last request)

Dynamic test (PHP 4, FastCGI):

Server Software: aEGiS_nanoweb/1.8.0-dev

Server Hostname: si.kz

Server Port: 80

Document Path: /index.php

Document Length: 1606 bytes

Concurrency Level: 20

Time taken for tests: 6.817 seconds

Complete requests: 500

Failed requests: 0

Broken pipe errors: 0

Keep-Alive requests: 488

Total transferred: 946925 bytes

HTML transferred: 803000 bytes

Requests per second: 73.35 [#/sec] (mean)

Time per request: 272.68 [ms] (mean)

Time per request: 13.63 [ms] (mean, across all concurrent requests)

Transfer rate: 138.91 [Kbytes/sec] received

Connnection Times (ms)

min mean[+/-sd] median max

Connect: 0 0 0.0 0 1

Processing: 10 246 358.4 125 3588

Waiting: 10 246 358.3 125 3587

Total: 10 246 358.4 125 3588

ERROR: The median and mean for the initial connection time are more than twice the standard deviation apart. These results are NOT reliable.

Percentage of the requests served within a certain time (ms)

50% 125

66% 290

75% 391

80% 426

90% 581

95% 743

98% 1078

99% 1506

100% 3588 (last request)

As you can see, the results are impressive. Whether everything will work so great for end users, or we are dealing with a typical example of fitting results in a laboratory, it is difficult to say. But you can try it yourself! Download the latest version from the developer’s website

(nanoweb.si.kz ) and install it at your place. Download, by the way, just nothing – about 250 kilobytes.

Oh, yes, another undeniably pleasant feature of the product is that it is cross–platform as much as PHP is cross-platform 🙂 That is, wherever PHP works, Nanoweb will also work. However, the developer warns that the performance under Windows will not be as good as under *nix, since PHP does not support process branching (forking) under Windows.

The installation is very simple – for *nix and Windows, installation scripts – install-sh and install are provided directly in the basic delivery.bat accordingly. Do not forget to look into the INSTALL file, from where you will learn such important information as the list of options with which your PHP should be assembled so that Nanoweb works normally on it.

Well, what to do next, you will learn from the documentation, which is both in the archive with Nanoweb, and on the manufacturer’s website.