おっと
@ms2sato 手元のぼっちインスタンスでは、pumaのスレッド数を5から3くらいに少なくしたほうがswapに突っ込んじゃうと可能性が低そうだなあと感じてます。もうすぐ確かめる!
With decreased number of threads (3) on puma process (2):
Web:
- Max total memory: 286 MB
- Mat response time: 107 ms median, 735 ms 95%
- Max throughput: 15 request/min
Worker:
- Max total memory: 228 MB
Seems like I can combine two processes onto one dyno of 512 MB memory.
Plot is memory profile of the web dyno where puma threads are changed from 5 to 3 around 2017-04-21 01:00 UTC. https://mastodon.zunda.ninja/media/sTcqKyAhQbSKCz9fJ5E
https://github.com/zunda/mastodon/wiki/CreateInstanceOnHeroku に、rake mastodon:dailyをHeroku Schedulerに登録する手順を追加しました。
OK. This instance is now running b1d4efc on https://github.com/zunda/mastodon/tree/zunda-ninja-on-heroku with
- heroku config:set MAX_THREADS=3
- heroku ps:scale web=1 worker=0
Let's see if the instance continue running healthy :)
Database status:
$ heroku pg:info DATABASE
=== DATABASE_URL, PG_HOBBY_BASIC_URL
Plan: Hobby-basic
Status: Available
Connections: 7/20
PG Version: 9.6.1
Created: 2017-04-20 18:31 UTC
Data Size: 17.4 MB
Tables: 26
Rows: 10903/10000000 (In compliance)
One-dyno instance instead of web+worker:
Consumes more memory: https://mastodon.zunda.ninja/media/cCYLEcs_4b1n4pKe3uA
Shows negligible CPU load: https://mastodon.zunda.ninja/media/xVx9qov6gy2k4DBslWc
and shows longer tail in service time: https://mastodon.zunda.ninja/media/Tj7g8cLbEbsGWBhiA90
@ms2sato ありがとうございます!
1 dynoにSidekiqを詰めようとするとpumaの2プロセス✕5スレッドでらメモリが512 MBから溢れそう、と書きたかったのでした。
こちらではアカウント1つのインスタンスが、puma 2プロセス✕3スレッドで6時間ほど稼働させてみてしてます。R14をもらうとしたらこれからかもですね…。
pumaとSidekiqを同居させるには、シェルからバックグラウンドに送る方法もありました: https://github.com/zunda/mastodon/blob/zunda-ninja-on-heroku/Procfile
This instance received one R14 for a hobby dyno running puma (2 workers x 3 threads) plus sidekiq but still responding quickly enough.
https://mastodon.zunda.ninja/media/juVpojTq3JbvMO9eoGk https://mastodon.zunda.ninja/media/XEzTm6Jfdkn_oNvIstM https://mastodon.zunda.ninja/media/6_y5G6UcPcW7J_9n8hI