など ◦ Rails 標準では puma が入ります • HTTP で受けて Rack の handler を叩くソフトウェアを想定 $ bin/rails server => Booting Puma => Rails 6.1.4.1 application starting in development => Run `bin/rails server --help` for more startup options Puma starting in single mode... * Puma version: 5.4.0 (ruby 3.0.2-p107) ("Super Flight") * Min threads: 5 * Max threads: 5 * Environment: development * PID: 57130 * Listening on http://127.0.0.1:3000 * Listening on http://[::1]:3000 Use Ctrl-C to stop
• worker と thread に関する値 ◦ puma の stats から取得した情報 ◦ `puma -w 2 -t 16:16` で起動した場合 puma のメトリクス出力 # HELP ruby_puma_workers_total Number of puma workers. # TYPE ruby_puma_workers_total gauge ruby_puma_workers_total{phase="0"} 2 # HELP ruby_puma_booted_workers_total Number of puma workers booted. # TYPE ruby_puma_booted_workers_total gauge ruby_puma_booted_workers_total{phase="0"} 2 # HELP ruby_puma_old_workers_total Number of old puma workers. # TYPE ruby_puma_old_workers_total gauge ruby_puma_old_workers_total{phase="0"} 0 # HELP ruby_puma_running_threads_total Number of puma threads currently running. # TYPE ruby_puma_running_threads_total gauge ruby_puma_running_threads_total{phase="0"} 32 # HELP ruby_puma_request_backlog_total Number of requests waiting to be processed by a puma thread. # TYPE ruby_puma_request_backlog_total gauge ruby_puma_request_backlog_total{phase="0"} 0 # HELP ruby_puma_thread_pool_capacity_total Number of puma threads available at current scale. # TYPE ruby_puma_thread_pool_capacity_total gauge ruby_puma_thread_pool_capacity_total{phase="0"} 32 # HELP ruby_puma_max_threads_total Number of puma threads at available at max scale. # TYPE ruby_puma_max_threads_total gauge ruby_puma_max_threads_total{phase="0"} 32
• raindrops から取得した情報 ◦ `worker_processes 4` で設定した場合 ◦ “backlog” は処理待ちで queue に入れらて いるリクエストの数 unicorn のメトリクス出力 # HELP ruby_unicorn_workers_total Number of unicorn workers. # TYPE ruby_unicorn_workers_total gauge ruby_unicorn_workers_total 4 # HELP ruby_unicorn_active_workers_total Number of active unicorn workers # TYPE ruby_unicorn_active_workers_total gauge ruby_unicorn_active_workers_total 0 # HELP ruby_unicorn_request_backlog_total Number of requests waiting to be processed by a unicorn worker. # TYPE ruby_unicorn_request_backlog_total gauge ruby_unicorn_request_backlog_total 0