Using jemalloc for Sidekiq
I would like to suggest using jemalloc for Sidekiq. I'm not 100% positive about it, but I think one of the reasons of Sidekiq memory consumption is due to memory fragmentation caused by allocator, and jemalloc seems to perform better than glibc's malloc in this regard.
This graph represents Sidekiq processing small continuous pushes, with the memory killer middleware removed. Under jemalloc, the process continues to run for a little over 2 hours without breaking the 1 GB mark, while under glibc's malloc it grew over 1 GB after 8.5 minutes. There's a slight drop in memory after the glibc one reached 2 GB; that's where a GC was triggered manually, nothing was manually triggered for the jemalloc one.
gnuplot script borrowed from https://gitlab.com/gitlab-org/gitlab-ce/issues/20723#note_13829747
cc/ @stanhu