Web-Serving Benchmark — Apache-bench
We setup an apache webserver that serves HTTP requests received from several HTTP clients. Each HTTP request loads one PHP script (modeling a webpage). The PHP scripts is interfaced with a mysql database and randomly loads different rows of a tabled from the database.
Here we explain how to prepare the benchmark on single node gem5 and on dist-gem5.
Note: the following instructions and the binaries are prepared for aarch64 ISA.
Please visit http://www.m5sim.org/Disk_images if you are new to modifying disk-image with qemu.
Feel free to ask questions in gem5 mailing list or contact us individually.
1- Preparing the dataset
Clone a copy of apach-bench:
git clone https://github.com/alianmohammad/benchmarks.git cd benchmarks/apache-bench
generate dataset. The generated filename is “benchmark_tbl.ini”
./generate-dataset.sh <size of database in MB>
2- Get/Prepare disk-image
We provide a disk-image that has all necessary stuff installed in it and also it has an 8GB prepared data-set. You can download it from here. The uncompressed disk-image size is ~45GB.
If you wish to setup apache-bench on your own disk-image, then you should follow the rest, otherwise please move forward to step 3 to run apache-bench on single node OR step 4 to run apache-bench on multi-node.
Mount disk image
sudo mount -o loop,offset=32256 $DISK_IMAGE /mnt sudo cp /etc/resolv.conf /mnt/etc
Copy stuff into disk-image
sudo mkdir /mnt/root/apache-bench sudo cp benchmark_tbl.ini /mnt/root/apache-bench sudo cp create-db-tbl.php /mnt/root/apache-bench sudo cp -r httperf-0.9.0 /mnt/root/
Copy index.php into disk-image – accessable by apache-server
sudo cp index.php /mnt/root/var/www/html
Chroot into the disk-image
sudo chroot /mnt
Install mysql server
apt-get update apt-get install mysql-server
You can leave the password field empty when prompted. If while installing mysql-sever, it stuck for a while at “mysql stop/waiting” and didn’t proceed, you may kill the apt-get process (press ctrl+c) and re-install it again by “apt-get install mysql-server”
Stop mysql server. Also change permissions for /tmp directory.
service mysql stop chmod 777 /tmp
Install apache2
apt-get install apache2
Install php
apt-get install php5-mysql apt-get install php5 libapache2-mod-php5
Install bc. We use it in the rcS scripts.
apt-get install bc
Prepare httperf client. You can build httperf as follows.
cd /root/apache-bench/httperf-0.9.0 ./configure --build=arm make make install
We annotate httperf source code with gem5 pseudo instruction and added work-item to measure per request latency at the client side without perturbing the system under test.
Exit chroot and unmount the disk-image
exit
sudo umount /mnt
From here, if you wish to deploy benchmark on a single node gem5, please go to step 3, if you wish to have a more distributed and more realistic setup on dist-gem5, please move to step 4
3- Single-node deployment
We provide a sample script to boot gem5 in FS mode and take a checkpoint. It’s a very simple script. Please take a look at it before you launch the simulation. We assume that you put the disk-image under “$M5_PATH/disks”. You can change the scripts to satisfy your needs.
Note: if you do not use the given disk-image, then you should create a database and load the dataset into the mysql server. This can be done by un-commenting two lines in the boot-ab.rcS.
cd run-scripts/single-node ./ckpt.sh
After it finished and you got the checkpoint successfully, you can run apache-bench. We have provided a simple run script for that. Again, please look at the script before you run. You can change the load on the server (rate of sending http requests) by changing parameters in “run-scripts/single-node/run-ab.rcS”
./run.sh
Because we have annotated httperf client source code with gem5 pseudo instructions, by enabling “–debug-flags=WorkItems”, gem5 prints end-to-end response time for each HTTP request.
4- Multi-node (dist-gem5) deployment
We have provided scripts for dist-gem5 deployment under run-scripts/dist-gem5. Please read step 3 “single-node deployment” for some useful information.
cd run-scripts/dist-gem5 ./ckpt.sh
When the checkpoint is taken, you can run the apache-bench in a multi-node setup. Please note that these scripts are just sample scripts and you may need to change them based on your need.
./run.sh
Memcached
TBD.