Unicorn Memory Usage filling up almost all the RAM

前端 未结 1 522

\"New

There are essentially 3 problems here:

1) Unicorn seems to be steadily filli

相关标签:
1条回答
  • 2021-02-13 01:13

    You appear to have two problems: 1) You have errors in the coordination of graceful restart causing old unicorn workers and the old master to stick around; 2) Your app (not unicorn) is leaking memory.

    For the former, looking at your before_fork code, it appears you're using the memory-constraining approach from the example config However, you have a typo in the .oldbin file name (an extraneous back-tick at the end) which means you never signal the old process because you can't read the pid from a non-existent file.

    For the later, you will have to investigate and drill. Look in your app for caching semantics that accumulate data over time; examine carefully all use of globals, class-vars, and class-instance-vars which can retain data references from request to request. Run some memory profiles to characterize your memory use. You can mitigate memory leakage by killing workers when they grow bigger than some upper limit; unicorn-worker-killer makes this easy.

    0 讨论(0)
  • Use unicorn-worker-killer, this makes it easier to kill workers who consume a lot of RAMs :)

    0 讨论(0)
提交回复
热议问题