Eonblast/Emysql — Issue #21: Feature request: load monitoring
Author: bvdeenen
Created: 2012-02-02 09:06:02+00:00
State: open

Hi all

Since I'm on a roll with emysql, I'd like to talk about a feature we could use. We can probably implement it here (at spilgames.com), but I'd like your thoughts on it.

What I'd like is some kind of emysql load monitor figure, so that I can slow down front end nodes if they start hammering emysql too hard, and also to tell the money guys to buy new hardware when required. I know that during testing I can hit the `connection_lock_timeout` quite easily (just spawn 50k requests at the same time :-). We plan to use emysql in a production environment where dozens of servers running probably 100's of Erlang nodes. I need some sort of load figure in emysql so that I can control the total flow through our cluster.

I was thinking of hooking something to `emysql_conn_mgr:wait_for_connection/1` to count the number of requests that are waiting for a connection, and create an interface function `emysql:install_load_callback` that makes it possible to do something with it.

Is this in your opinion the best way/place to do it? If the code is good, would you like to include it in the eonblast/emysql repository? Any other suggestions?

Bart