【Rails】bundle install --jobs(-j)に指定するジョブ数を動的に設定するため、最大値について調べた
最大値が 4 だからなのかと思いましたが、 --jobs で指定できるジョブ数の最大値についての記述はドキュメント上にありませんでした。 これなら動的にジョブ数を変えられるのでは? と思い調べていると、 「指定可能なジョブ数はCPU のコア数と使用可能なメモリによって異なる」旨の記述を見つけました。 It all depends on how many cores your CPU has and the available memory. Assuming you have decent memory amount, you can use the number of cores as your -j parameter. If you are on linux, you can run this command to list your cores: CPUのコア数は getconf _NPROCESSORS_ONLN で取れます。 $ echo `getconf _NPROCESSORS_ONLN` => 12 よって、 $ bundle install --jobs `getconf _NPROCESSORS_ONLN` とすれば、 CPUのコア数で動的に bundle install --jobs のジョブ数を設定可能そうです。
2022/08/29 09:24