How to implement a real life benchmark with PHP
To determine the maximum capacity of a web page, Apache ab is often used in the first step. Fetching one URL very often is optimal for caching and gives a best case. To get the worst case for caching, it is necessary to fetch different URLs in a random order.
Here is a PHP script to walk randomly on a web page:
To get the average case concerning caching and response times, we need to choose the most relevant links. For example, we skip links from headers and footers. This can be done by using a different xpath expression in the code:
// fetch all links under...
$xpath = '//div[@id="content"]//a';
// fetch all links underand