Feedback

Comparing ANSI C, C#, Java and PHP

People's beliefs and convictions are in almost always gotten at second hand, and without examination. Mark Twain

Note: The test below was made with G-WAN v1.0.6 which was 5-10x slower than G-WAN v2.8+, see the updated test here.

Do the job with 5 million times less servers

First, G-WAN redefined the static Web content hierarchy on Windows and then Linux. Then, G-WAN redefined the standards of dynamic Web content generation (illustrating how much better Linux serves you than Windows).

As the U.S. dept. of Justice ruled that it is no longer illegal to benchmark Microsoft IIS and .Net:

ApacheBench compared[1] G-WAN (200 KB script engine included), IBM Apache + PHP, SUN GlassFish + Java and Microsoft IIS + C#[2]. Result, G-WAN/Linux and C scripts do the job with 5.8 million times[3] less servers than Microsoft IIS + C#:

Calculating loans on: 1 year (2.4 KB) / 10 years (13.8 KB) / 50 years (66.2 KB) / 100 years (131.4 KB)


100-year loan: G-WAN+ANSI C, IIS+C#, GlassFish+Java, Apache+PHP benchmarks

IIS 7.0/Windows is by far slower than all – despite being part of the kernel. G-WAN/Windows does better than Apache/Linux and GlassFish/Linux despite the Windows user-mode overhead which is 6x higher than on Linux. But G-WAN/Linux crunches G-WAN/Windows. Yes, Windows is that lame.

G-WAN's limit is not the CPU, or the network – that's the kernel. By contrast, the limit for other Web Application Servers is their own user-mode code. By the way, on a 50-GFLOP CPU, we should be able to process more loans than this.

Its high-performances with a very low CPU usage allows G-WAN/Linux to:

  • perform better than other servers by not starving the kernel;
  • generate more dynamic contents than all other App. servers;
  • spare resources for database, email, proxy or virtual servers;
  • save energy (CPUs consume much less with moderate loads);
  • save money (use cheaper parts like ARM or Intel Atom CPUs);
  • save space (use many times less servers than Apache or IIS).

Java, C# or PHP's footprint are in the 80-200 MB range. Bloated runtimes and servers (~1 GB for IIS 7.0+C#) limit the resources that remain available to your applications - forcing you to buy more hardware than needed.

With G-WAN/Linux's savings the "hardware is cheap" slogan is no longer true: now you are either efficient or losing money because if you don't use G-WAN then your competitors will do it.


[1] ab and HTTP servers were run on dedicated hosts on a gigabit LAN (using this C code to launch ab) and these [ANSI C] [C#] [Java] [PHP] loan scripts. CLIENT: Intel Core2 Quad X9650 3GHz, 4GB RAM (Ubuntu 8.4 LTS 64-bit). SERVER: Xeon 3580 3.33 GHz, 12GB RAM (Ubuntu 8.10 32-bit, Vista Ultimate 64-bit). NETWORK: 1Gb/s (CPU speed did not make a difference for G-WAN: results were the same at 1.6 GHz). A detailled benchmark how-to is available here.

[2] MICROSOFT IIS stopped to serve loans[5] and reported 503 errors (service unavailable) before dying. Stopping and retarting IIS did not unlock the server. Rebooting worked. To save IIS from dying during each test, ab.c detects and dumps HTTP errors and stops the benchmark.

[3] Set #define STEP 1 in ab.c so you can find how early IIS falls. Divide G-WAN's requests per second (RPS) sum by IIS' sum (sums are found at the bottom of test.txt). For loan/100 years G-WAN serves 1.9 million times more RPS than IIS; loan/150 years: 5.8 million times more; loan/200/500/800 years[4]: infinitely more, as IIS then serves zero RPS).

[4] Because of rounding errors, a 800-year loan is the limit: going further loops forever. While G-WAN automatically stops infinite loops, others are locked up for life. GlassFish is periodically flushing the output, sending GB of data on the network forever (unless it dies from concurrency -there it needs a reboot as 'asadmin stop/start-domain' no longer responds).

[5] Why use loans? The purpose of Web Application servers is to build HTML pages and a loan is small enough to be easily understood and ported in different languages (when a benchmark is long and complex, it's easy to favor any given product by using poor implementations -or an 'independent jury' to reject your tests, like SPECweb2005). In addition, loans generate variable lengths and outputs (by just changing its 'length' and 'interests' parameters). This is therefore, a very pertinent test to compare the ASP.Net C#, Java and PHP script engines and Web servers.

[6] MICROSOFT fans claimed that "Windows Vista 64-bit" is slower than "Windows Server 2008 64-bit". But the *Desktop* edition of Linux AND Windows that was compared - and nobody complained about the fact that Linux was at a (really unfair) disadvantage: Linux 32-bit is (much) slower than Linux 64-bit (while Windows Vista 64-bit was tested against Linux Desktop 32-bit).