ThinkPart

Andrey's blog

 

mysqlnd and the compressed protocol, again

 

mysqlnd patched for compressed protocol passes almost all tests, but all of the most relevant and those who test with big result sets. I have a few failures due to "Packet out of order" which is due to the crippled packet numbering when com...pressed is turned on-the outter layer has different counter than the inner, compressed one, and it is unknown how the server resets them (for example in the COM_CHANGE_USER tests).

 

I had more failures with Packet out of order, but I decided to disable the checking of packet number for correctness, when compression is enabled, because it is a madness.

As a side note, I never thought that I will use recursion in mysqlnd, well it happened. After I realized that packets can be split between compressed packets I decided to rewrite the patch and add a "real network layer" (like in net_serv.cc - xxx_real_read() :). If compression is enabled data is decompressed in one function (used to be in 3 places) and then fed to the upper layers, which used to be the lowest levels before.

Compression in mysqlnd doesn't only mean more CPU usage but extensive memory usage as buffers are allocated and freed. mysqlnd is tuned to call the allocator as less as possible, but in this situation it won't be case.

I don't know whether the current test suite is sufficient test for this feature (or a bug fix for http://bugs.php.net/47017). I need to consult with Ulf and Johannes to decide whether this needs further testing. Finalizing the patch will take 1-2 more days.

Leave a reply

Comments are disabled for this post.