zongji
zongji copied to clipboard
Support for MySQL Compressed Protocol
Zongji should support the MySQL compressed protocol when connecting to a MySQL database.
This greatly reduces bandwidth usage when Zongji is connecting over a network to a remote MySQL server as the binlog is a continuous stream and contains lots of redundant information, so it compresses very well.
This is not supported right now because Zongji relies on mysqljs:mysql which does not support the compressed protocol.
The newer, faster and almost 100% compatible library sidorares:node-mysql2 does support the compressed protocol, as well as SSL and other cool things.
Unfortunately, the current Zongji code is not compatible because of this line in lib/json_decode.js:
https://github.com/nevill/zongji/blob/73f18664ba6c975070373907e139ecc17d98a346/lib/json_decode.js#L2
The file mysql/lib/protocol/Parser.js that contains the definition of that Parser object does not exist in sidorares:node-mysql2.
A simple workaround may be to include both mysqljs:mysql and sidorares:node-mysql2 but this would not be elegant.
Have you done any work to get this going? Like I've mentioned before, send me an email if you want me to spend time working on new features.
@vlasky I am working to support mysql2. as I don't want my project to install both two mysql and mysql2 packages. Also, ZongJi use single connection for both connection and control connection. I think we should make it work on connectionPool for both.
I confirm that Zongji can support the MySQL compressed protocol if you modify it to use the compression branch of the mysqljs module:
https://github.com/mysqljs/mysql/tree/compression
Any news on this?
shtse8 Have you managed to make ZongJi work with mysql2?