Benchmark: libmysql vs mysqlnd
A few days ago I found out about the existence of the MySQL Native Driver (mysqlnd) that has been introduced in php 5.3, it is a replacement for libmysqlclient and it is licensed under the PHP license, therefore avoiding the need of the FOSS License Exception.
The purpose of this article isn’t explaining what mysqlnd is and what it does, for that you can start by reading the official documentation and this nice blog post.
I did these benchmarks mostly because I couldn’t find any proper comparison between the two drivers and I wanted to know which driver I should be using on all the servers I manage (performance-wise), I then figured that making this public could be useful to someone else, so here it is.
ApacheBench Script
Quoting from Apache Benchmark official website:
ab is a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. It is designed to give you an impression of how your current Apache installation performs.
In order to make sure that a benchmark involving the use of ApacheBench is run without any distortion due to, for example, wait times that could lead to cache expiration I needed a very simple bash script, so here it is:
#!/bin/bash NUM=1250 CONC=3 SLEEP=15 FILENAME=Benchmark URL=http://www.example.com/ echo "a started" ab -n $NUM -c $CONC $URL > $FILENAME-$CONC-$NUM-a.txt echo "a completed" sleep $SLEEP echo "b started" ab -n $NUM -c $CONC $URL > $FILENAME-$CONC-$NUM-b.txt echo "b completed" sleep $SLEEP echo "c started" ab -n $NUM -c $CONC $URL > $FILENAME-$CONC-$NUM-c.txt echo "c completed" sleep $SLEEP echo "d started" ab -n $NUM -c $CONC $URL > $FILENAME-$CONC-$NUM-d.txt echo "d completed" sleep $SLEEP echo "e started" ab -n $NUM -c $CONC $URL > $FILENAME-$CONC-$NUM-e.txt echo "e completed" exit 0
Menu
Cloud Tag
Categories
- Announcements (1)
- Benchmarks (2)
- How-To (5)
- News (1)
- Projects (1)
- Tips (5)
Archive
- June 2011 (1)
- May 2011 (1)
- January 2011 (1)
- October 2010 (1)
- August 2010 (4)
- July 2010 (1)



