I have a rails app which deployed on ec2 instance with nginx and passenger. For background job, i had used sidekiq with redis. I have 1 gb memory on server. I also have set max_pool_size to 1 for passenger in nginx config, and also set sidekiq concurrency to 1.
when passenger get multiple requests it aquire maximum memory and sidekiq was killed by the reason of out of memory.
Passenger and sidekiq take approx 54% of memory at ideal position and did not free memory after complete the process. below the log at ideal position:
ps aux --sort=-%mem | awk 'NR<=10{print $0}'
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
ubuntu 13975 1.5 24.8 774064 251908 ? Sl 11:04 0:01 Passenger RubyApp: /var/www/dairylac/Quickmilk/current/public (staging)
ubuntu 14108 5.1 21.4 914332 217596 ? Sl 11:04 0:03 sidekiq 4.1.2 Quickmilk [0 of 1 busy]
ubuntu 13858 3.8 19.9 491072 202544 ? Sl 11:03 0:04 Passenger AppPreloader: /var/www/dairylac/Quickmilk/current
postgres 13986 0.2 4.4 192528 45048 ? Ss 11:04 0:00 postgres: enbake quickmilk_dev_one 127.0.0.1(32902) idle
postgres 1489 0.0 3.5 185752 36044 ? Ss Aug29 0:06 postgres: writer process
ubuntu 13952 0.0 1.9 42764 19376 ? Ssl 11:04 0:00 /var/www/dairylac/Quickmilk/shared/bundle/ruby/2.1.0/gems/appsignal-1.2.5/ext/appsignal-agent
root 13811 0.1 1.6 677924 16744 ? Sl 11:03 0:00 Passenger core
postgres 14117 0.0 1.4 187736 14316 ? Ss 11:04 0:00 postgres: enbake quickmilk_dev_one 127.0.0.1(32924) idle
postgres 13959 0.0 1.4 187736 14308 ? Ss 11:04 0:00 postgres: enbake quickmilk_dev_one 127.0.0.1(32900) idle
And when passenger and sidekiq get multiple requests then sidekiq killed by the reason of out of memory.
ps aux --sort=-%mem | awk 'NR<=10{print $0}'
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
ubuntu 27463 3.9 33.8 1045284 343428 ? Sl 13:11 0:05 sidekiq 4.1.2 Quickmilk [1 of 1 busy]
ubuntu 27466 1.5 31.3 841340 317708 ? Sl 13:11 0:02 Passenger RubyApp: /var/www/dairylac/Quickmilk/current/public (staging)
ubuntu 27370 2.8 18.6 492812 189012 ? Sl 13:11 0:04 Passenger AppPreloader: /var/www/dairylac/Quickmilk/current
postgres 27476 0.2 4.0 192540 41344 ? Ss 13:11 0:00 postgres: enbake quickmilk_dev_one 127.0.0.1(33998) idle
postgres 27915 21.0 3.5 189828 36296 ? Ss 13:13 0:03 postgres: enbake quickmilk_dev_one 127.0.0.1(34040) idle in transaction
postgres 1489 0.0 3.4 185752 34680 ? Ss Aug29 0:07 postgres: writer process
ubuntu 27444 0.0 1.5 42764 15228 ? Ssl 13:11 0:00 /var/www/dairylac/Quickmilk/shared/bundle/ruby/2.1.0/gems/appsignal-1.2.5/ext/appsignal-agent
root 1078 0.0 0.9 278696 10040 ? S<sl Aug29 0:01 /usr/lib/snapd/snapd
redis 1069 0.0 0.8 39236 8976 ? Ssl Aug29 0:42 /usr/local/bin/redis-server 127.0.0.1:6379
I did not found why passenger and sidekiq was killed and how can i solve it.
Please give me any suggesstion.
Thanks in advance.