mozilla / chronicle

find everything you've ever found
http://mozillachronicle.tumblr.com/
Mozilla Public License 2.0
16 stars 6 forks source link

is __heartbeat__ leaking memory via unclosed elasticsearch clients? #361

Open jaredhirsch opened 9 years ago

jaredhirsch commented 9 years ago

We found out recently that elasticsearch doesn't terminate clients by default. I suspect this endpoint might leak memory. Hopefully setting keepAlive: false and doing an explicit client.close() will be enough. Failing that, we probably need to separately manage a pool of clients for the app as a whole.

  1. Measure how much memory is actually being leaked by pinging the process every n seconds for a large number of hours/days. Maybe it's not a problem at all.
  2. If it really is a problem, try just closing the connections for each heartbeat.
  3. Measure again.
  4. If it's still a problem, we probably should try pooling elasticsearch connections, or having one that's dedicated to the heartbeat endpoint (maybe we can register it on the server at startup).
  5. Measure again...