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

Stmt_Cached grow beyond mysql-max_stmts_cache causing ProxySQL to crash #1198

Closed
KlausOvergaard opened this issue Oct 5, 2017 · 5 comments
Closed
Assignees
Labels
Milestone

Comments

@KlausOvergaard
Copy link

KlausOvergaard commented Oct 5, 2017

We are using ProxySQL 1.4.1. The caching of Prepare statements seems to grow infinitely. Our mysql-max_stmts_cache is set to default 10.000, but Stmt_Cached and Stmt_Max_Stmt_id grow way beyond until all server memory is consumed (12 GB) and eventually ProxySQL crash.
Here is a screnshot of the memory consumption. The busier our servers are, the quicker the stmt cache grows: https://gyazo.com/358232ad78361532eb2131ba2e21c73c

@renecannao
Copy link
Contributor

Issue confirmed

@renecannao renecannao self-assigned this Oct 6, 2017
@renecannao renecannao added the bug label Oct 6, 2017
@renecannao renecannao added this to the v1.4.4 milestone Oct 6, 2017
renecannao added a commit that referenced this issue Oct 6, 2017
In 1.4 the handling of prepared statements were rewritten to solve some design limitations.
The code responsible for `Stmt_Cached` and `Stmt_Max_Stmt_id` wasn't migrated tho.
Fixed now.
@renecannao
Copy link
Contributor

In 1.4 the handling of prepared statements were rewritten to solve some design limitations.
The code responsible for Stmt_Cached and Stmt_Max_Stmt_id wasn't migrated tho.
Now should be fixed, and this is an example of an application generating a lot of unique PS:

Admin> SELECT * FROM stats_mysql_global WHERE variable_name LIKE '%stmt%' AND variable_value;
+---------------------------+----------------+
| Variable_Name             | Variable_Value |
+---------------------------+----------------+
| Com_backend_stmt_prepare  | 3420716        |
| Com_backend_stmt_execute  | 1852050        |
| Com_frontend_stmt_prepare | 1852837        |
| Com_frontend_stmt_execute | 1852065        |
| Com_frontend_stmt_close   | 1851650        |
| Stmt_Client_Active_Total  | 1588           |
| Stmt_Client_Active_Unique | 1167           |
| Stmt_Server_Active_Total  | 256            |
| Stmt_Server_Active_Unique | 256            |
| Stmt_Max_Stmt_id          | 62660          |
| Stmt_Cached               | 9786           |
+---------------------------+----------------+
11 rows in set (0,01 sec)

@renecannao
Copy link
Contributor

Fixed in current branch 1.4.4

@KlausOvergaard
Copy link
Author

KlausOvergaard commented Oct 10, 2017 via email

@eightnoteight
Copy link

Hi @renecannao

This fix is not ported to 2.x, also the mysql-max_stmts_cache documentation is missing from
https://github.com/sysown/proxysql/wiki/Global-variables

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

No branches or pull requests

3 participants