zongji icon indicating copy to clipboard operation
zongji copied to clipboard

Support for MySQL Compressed Protocol

Open vlasky opened this issue 6 years ago • 5 comments

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.

vlasky avatar Sep 12 '17 13:09 vlasky

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.

numtel avatar Oct 03 '17 21:10 numtel

@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.

shtse8 avatar Nov 20 '17 12:11 shtse8

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

vlasky avatar Oct 21 '19 10:10 vlasky

Any news on this?

vasyas avatar Oct 29 '20 11:10 vasyas

shtse8 Have you managed to make ZongJi work with mysql2?

pire12 avatar Feb 29 '24 15:02 pire12