Nightly Builds: Zend PHP Environment Setup
This page describes the details of software environment configuration for the platform used to run Zend PHP based workloads. Information about hardware platform setup can be found here.
Workload execution
Our main intention was to be able to highlight daily performance trends of PHP engine only (usually with deltas <1% from one day to another). We focused strictly on isolating as much as possible PHP in a way ensuring good reproducibility of measurements. In concequence the measurement environment is not really matching production environments as the target is mainly addressing measurements stability and reproducibility.
Content Management Workloads: WordPress, Drupal, MediaWiki
As stated above we tried to reduce the bias caused by the influence and latencies induced by the other components of the LAMP stack, so we used the following setup:
- single thread runs of php-cgi
- optimized lightweight backend database server (MariaDB) running on the same station
- both php-cgi and MariaDB server are assigned to fixed cores using taskset (this reduces run to run variations caused by cache access latency variations when processes migrate from a core to another)
- no HTTP server involved
- IO is quite small (almost no network IO and good caching of SSD storage accesses).
For now we use a simple scenario invoking only the index.php default page of the web site; although we are tempted to think this is a light test the truth is that the default page calls other scores of PHP pages generating quite complex runs. A typical measurement session has the following steps:
- 2 warm-up runs: taskset 4 php-cgi -T1000 /path/to/workload/index.php
- 5 measured runs: taskset 4 php-cgi -T10000 /path/to/workload/index.php
- Average and Relative Standard Deviation (Standard Deviation/Average) are aggregated from the measured performance (expressed in fetches/second)
Synthetic Benchmarks: mandelbrot, bench, micro_bench
These are PHP intensive computing micro-benchmarks:
- bench.php: available in php-src/Zend folder on PHP sources distribution (https://github.com/php/php-src/blob/master/Zend/bench.php on GitHub)
- micro_bench.php: available in php-src/Zend folder on PHP sources distribution(https://github.com/php/php-src/blob/master/Zend/micro_bench.php on GitHub)
- Mandelbrot.php: https://gist.githubusercontent.com/dstogov/12323ad13d3240aee8f1/raw/37fed3beb7e666b70e199bcf361af541b3c30d2d/b.php
The measurements are performed similar to content management workloads runs:
- 2 warm-up runs: taskset 4 php-cgi -T1 /path/to/micro-benchmark.php
- 5 measured runs: taskset 4 php-cgi -T1 /path/to/micro-benchmark.php
- Average and Relative Standard Deviation (Standard Deviation/Average) are aggregated from the measured performance (expressed in seconds)
LAMP Stack configuration
- Linux OS: CentOS 7.1 on 64bits
- Apache/Nginx: not used for now
- MySQL: MariaDB v5.5
- PHP: Zend PHP 7 (sources downloaded from https://github.com/php/php-src)
Enable Huge Pages in CentOS
PHP has good performance benefits if the engine code is loaded in huge pages. Here is a guide on how to configure HugePages in order to have the OS support for Huge pages: https://wiki.debian.org/Hugepages#Enabling_HugeTlbPage (some minor changes are needed for CentOS)
MariaDB Configuration
After default installation my.cnf file was configured according with https://mariadb.com/kb/en/mariadb/configuring-mariadb-for-optimal-performance/#configuring-mariadb-with-mycnfmycnf-files hints from "fast connection + small set of queries + disconnect" section.
Zend PHP 7
This is the procedure we used for building PHP7 from sources (build with GCC 4.8):
./vcsclean ./buildconf ./configure \ --with-apxs2 \ --with-libdir=lib64 \ --enable-fpm \ --disable-phpdbg \ --enable-mbstring \ --enable-zip \ --enable-bcmath \ --enable-pcntl \ --enable-ftp \ --enable-exif \ --enable-calendar \ --enable-sysvmsg \ --enable-sysvsem \ --enable-sysvshm \ --enable-wddx \ --enable-soap \ --enable-shmop \ --enable-sockets \ --with-curl \ --with-mcrypt \ --with-iconv \ --with-gmp \ --with-gd \ --with-pdo-pgsql \ --with-jpeg-dir=/usr \ --with-png-dir=/usr \ --with-zlib-dir=/usr \ --with-xpm-dir=/usr \ --with-freetype-dir=/usr \ --enable-gd-native-ttf \ --enable-gd-jis-conv \ --with-openssl \ --with-pdo-mysql=mysqlnd \ --with-gettext=/usr \ --with-zlib=/usr \ --with-bz2=/usr \ --with-recode=/usr \ --with-mysqli=mysqlnd make make install
Specific PHP tunings in php.ini file:
; Enable opcache extension zend_extension=opcache.so opcache.enable=1 opcache.enable_cli=1 opcache.enable_file_override=1 opcache.validate_timestamps=0 opcache.consistency_checks=0 opcache.max_accelerated_files=100000 opcache.fast_shutdown=1 opcache.huge_code_pages=1 ; Reduce error reporting overhead error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT display_errors = Off ; This is needed for running Drupal via php-cgi cgi.force_redirect = 0
Workloads Setup
WordPress 4.2.2: After downloading the package follow default setup rules as documented here: http://codex.wordpress.org/Installing_WordPress#Famous_5-Minute_Install
MediaWiki 1.23.9: Default setup was obtained based on these indications: https://www.mediawiki.org/wiki/Manual:Installation_guide#Summarized_installation_guide
Drupal 7.36: We followed default installation steps (from 1 to 4) for Drupal with MySQL as described here: https://www.drupal.org/documentation/install.
Random content was added based on the steps bellow:
1. Install drush (http://docs.drush.org/en/master/install/)
2. Install drush extensions in Drupal
cd /path/to/drupal # web site folder sudo drush en devel sudo drush en devel_generate
sudo drush genc 10 10 --kill # Warning: --kill will delete all existing content
__________________________________________________________________
Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration.