ruby requests more memory when there are plenty free heap slots

Viewed 729

We have a server running

  • Sidekiq 4.2.9
  • rails 4.2.8
  • MRI 2.1.9

This server periodically produce some amount of importing from external API's, perform some calculations on them and save these values to the database.

About 3 weeks ago server started hanging, as I see from NewRelic (and when ssh'ed to it) - it consumes more and more memory over time, eventually occupying all available RAM, then server hangs.

I've read some articles about how ruby GC works, but still can't understand, why at ~5:30 AM heap size jumps from ~2.3M to 3M , when there's still 1M free heap slots available(GC settings are default)

enter image description here

similar behavior, 3:35PM: enter image description here

So, the questions are:

  1. how to make Ruby fill free heap slots instead of requesting new slots from OS ?
  2. how to make it release free heap slots to the system ?
1 Answers
Related