Apache MPM performance Test : event -prefork

Apache MPM performance Test: event -prefork

As a basic test, I will create a PHP file that checks the existence of another file named,  test.php in the same directory of two CentOS 7 servers with the same hardware characteristics and load but with different MPM. One of them will use event and the other one will use prefork:

Compare-Apache-Event-and-Prefork-Module
Compare-Apache-Event-and-Prefork-Module

This is the PHP code that I’ve saved into a file named checkiffileexists.php:

<?php
$filename = 'test.php';

if (file_exists($filename)) {
    echo "The file $filename exists";
} else {
    echo "The file $filename does not exist";
}
?>

Then we will run the Apache benchmark tool (ab) with 200 simultaneous requests until 2000 requests are completed:

# ab -k -c 100 -n 2000 localhost/checkiffileexists.php

Let’s run the test and compare the results. Pay attention to the performance statistics:

Apache-Performance-Load-Testing
Apache-Performance-Load-Testing

As you can see, the performance of the server with the event is highly superior to its prefork counterpart in every aspect of this test.

Leave a Reply