Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate performance degradation with compression #4721

Open
renecannao opened this issue Oct 17, 2024 · 6 comments
Open

Investigate performance degradation with compression #4721

renecannao opened this issue Oct 17, 2024 · 6 comments

Comments

@renecannao
Copy link
Contributor

There is a severe performance degradation when clients connect to ProxySQL using compression.

Some example with this query:

QUERY="SELECT t1.id id1, t1.k k1, t1.c c1, t1.pad pad1, t2.id id2, t2.k k2, t2.c c2, t2.pad pad2 FROM sbtest.sbtest1 t1 JOIN sbtest.sbtest1 t2 LIMIT 10000000"

Direct connection without compression:

$ time mysql --quick -u sbtest -psbtest -h 127.0.0.1 -P3306 -e "$QUERY" > /dev/null
real    0m25.040s
user    0m24.070s
sys     0m0.967s

Direct connection with compression:

$ time mysql --quick -u sbtest -psbtest -h 127.0.0.1 -P3306 -e "$QUERY" -C > /dev/null
real    0m59.931s
user    0m34.521s
sys     0m0.921s

Using ProxySQL without compression:

$ time mysql --quick -u sbtest -psbtest -h 127.0.0.1 -P6033 -e "$QUERY" > /dev/null
real    0m25.307s
user    0m24.276s
sys     0m0.989s

Using ProxySQL with compression:

$ time mysql --quick -u sbtest -psbtest -h 127.0.0.1 -P6033 -e "$QUERY" -C > /dev/null
real    2m0.343s
user    0m30.441s
sys     0m0.455s

It seems that compression is a big performance penalty for both MySQL and ProxySQL , but it seems that ProxySQL is twice as slow than MySQL.

ProxySQL uses compress() instead of lower level zlib functions, and this uses Z_DEFAULT_COMPRESSION that is 6 (on a scale from 1 to 9).
So I guess it is "just" a matter of compression level.

@dankow
Copy link

dankow commented Oct 17, 2024

In our experience, a query with a large result set being run on a compressed connection affected the performance of ProxySQL in general, not just for that query. We saw a general drop in throughput for the whole ProxySQL server (shown by an increase in backend connections in use) which makes it a more serious bug than if it only affected performance for that one query.

@MichalisDBA
Copy link

@renecannao

Sorry to post here but there is a similar problem that makes the queries slow if you set mysql-threshold_resultset_size to a value of 536870912 and greater.

#4707

@renecannao
Copy link
Contributor Author

@MichalisDBA : it is unlikely related.
But we will try to look into it as soon as we finalize some high priority deadlines

@ThomasVerhoeven1998
Copy link

What is the expected ETA for a fix? Or do you recommend disabling compression if you have this currently enabled?

@renecannao
Copy link
Contributor Author

@ThomasVerhoeven1998 : this issue was observed with an exceptional large resultset, and probably shouldn't be noticeable with smaller resultset.
If you are affected, right now the only solution is to completely disable compression, setting mysql-have_compress=false

@charles-001
Copy link

We encountered this issue and turning off compression like Rene suggested mitigated the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants