Percona is glad to announce the release of Percona Playback 0.5 on November 26th, 2012. Downloads are available from our download site and Percona Software Repositories.
Percona Playback is a tool for replaying the load of one database server to another. Currently it can read queries from MySQL query-log and tcpdump files and run them on other MySQL server. With Percona Playback you can measure how a server or database upgrade, change in my.cnf or schema change can affect the overall performance of your database server.
This release should be considered Alpha quality.
- Reports have been extended and now return the list of queries with a response time longer than the ones run on the original. Additional statistics, like the query types (SELECT, UPDATE,…) with the proportion off faster and slower statement for each categories, has been added as well.
- Percona Playback now supports reading the slow query log from standard input (stdin) instead of log file.
- For this release binary packages were prepared, full list is available in our documentation.
- Multi-line queries in the slow query log didn’t work correctly. Bug fixed #1035217 (Stewart Smith).
- Raw tcpdump format wasn’t documented. Bug fixed #1034527 (Hrvoje Matijakovic).
Replaying the load with Percona Playback and tcpdump
Miguel already showed in his post how to use Percona Playback with the query_log plugin. Following example shows how to capture traffic with tcpdump and create a dump file that will be later used with Percona Playback.
On the production server we start the tcpdump with the -w option to collect packets into the raw tcpdump file:
tcpdump -i any port 3306 -w example.dump
After we collect some amount of traffic we can stop the tcpdump and use the dump file to replay the load on the test server. Warning: All the queries will be run with Percona Playback, not just the SELECT but the UPDATE,DELETE and INSERT ones as well. So be sure not to run this on production database unless you don’t need the data anymore.
percona-playback --input-plugin=tcpdump --tcpdump-file=example.dump \
--tcpdump-mode=accurate --db-plugin=libmysqlclient --mysql-host=10.8.2.10 \
--mysql-username=root --mysql-password=passW0rd --mysql-schema=imdb
This example uses accurate tcpdump-mode, which means Percona Playback will preserve query execution times and it will pause between queries to playback the same load that was recorded on production with the same accuracy.
After the dump file has been replayed on the server, Percona Playback will show the playback statistics in the report like:
Executed 1271 queries
Spent 00:00:59.856656 executing queries versus an expected 00:00:47.085301 time.
61 queries were quicker than expected, 21 were slower
A total of 0 queries had errors.
Expected 30298 rows, got 30298 (a difference of 0)
Number of queries where number of rows differed: 0.
We can use this information to decide if the test server needs further tuning or how it will be able to sustain production load.
If you encounter any bugs, please report them to our bug tracking system.