MySqlConnector: Heavy usage of information schema periodically causing server performance issue
Every hour or so (sorry, despite watching all day not been able to identify exact pattern), we are seeing our MySQL Server Load Average hit 70+ (32CPU box). From looking at innotop, I can see a massive queue of these sort of queries
SELECT ORDINAL_POSITION, PARAMETER_MODE, PARAMETER_NAME, DATA_TYPE, DTD_IDENTIFIER FROM information_schema.parameters WHERE SPECIFIC_SCHEMA = 'plus' AND SPECIFIC_NAME = 'mysp' ORDER BY ORDINAL_POSITION;
These seem to be triggered by the stored procedure cache logic. My original thought was that the Web Server was recycling the app pool, thus disposing the memory area used by the connection pool and thus the stored procedure cache. So I set the Web Server to AlwaysOn and the IdleTimeout to zero. The issue still occurs.
Is there something which triggers a connection pool clean up or recycle on interval? Monitoring reports that the app pool is not restarting within IIS, so seems it’s something on interval within the software.
This is going to be very difficult to simulate in a simple package as we have 8000+ stored procedures and thousands of users on the system at any one point. I wouldn’t know where to start to replicate as this issue has only started occurring recently.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 18 (11 by maintainers)
I’ve been reviewing the Event log for the servers in question around the time of the issue. I think the cache was cleared due to an App Pool recycle. That makes sense. I’ve reconfigured the recycling interval so hopefully the cache will get time to “warm up”. So looks like not an issue with the cache behavior itself, just the performance of these information_schema queries.
Our previous code (with Connector/Net) used mysql.proc to cache, and this did perform well. So I agree that switching over to that for <MySql 8.0 would be a good move. Like many others, there is little prospect of us upgrading to MySql 8.0 in foreseeable.
One other thing we used to do was load the whole cache on start rather than on demand. Even with 3000 sps, this was very quick against mysql.proc. This way you won’t get uncached behaviour during operational hours.
You don’t actually need to use SHOW CREATE PROCURE, as the parameters list is available in mysql.proc. Our previous code just used:
SELECT name, param_list as params FROM mysql.proc WHERE db='plus' AND
type= 'PROCEDURE';
This code handled it: