Compressing MySQL client-server communication with Play Framework

FolderGrid provides a RESTful api that often services requests where over 90% of the entire response time is spent pulling data from a MySQL instance. I was recently working to reduce overall response time for some long running transactions in that bucket.

After optimizing my queries and my database caching - I looked at network transfer time from the dedicated MySQL server to the mysql client on the application server.  Simply enabling MySQL zlib compression resulted in a 3x performance boost for many of the larger resultsets. 

To configure your Play Framework connection pool to enable MySQL client-server zlib compression, you'll need to use the explicitly defined "db.url" instead of the shortcut "db" configuration key. Your key should look something like this:

db.url=jdbc:mysql://remotehost/dbname?useUnicode=yes&characterEncoding=UTF-8&connectionCollation=utf8_general_ci&useCompression=true

 

 

Share Comments