smtc0097 / mysql-cacti-templates

Automatically exported from code.google.com/p/mysql-cacti-templates
GNU General Public License v2.0
0 stars 0 forks source link

Use flock() for locking the cache file #78

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I see problems with the current caching code in ss_get_mysql_stats.php:

- it uses mysql for locking, and this actually shows up as a problem
sometimes in slow query reports, using too many connections, etc.
- it uses the same lock token for all invocations, so getting stats for
server A will block on server B, which is unnecessary
- it uses exclusive locking, when it could use shared locking (and escalate
to exclusive if the cache file needs to be refreshed)

I think it would be much better to use flock() on the cache file itself.

Original issue reported on code.google.com by baron.schwartz on 24 Oct 2009 at 11:56

GoogleCodeExporter commented 8 years ago
Fixed in r251.

Original comment by baron.schwartz on 25 Oct 2009 at 6:51