mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 09:12:35 +02:00
autoconfig workers, one per core
This commit is contained in:
parent
60e6697529
commit
c5910cde4b
1 changed files with 19 additions and 1 deletions
|
@ -1,9 +1,27 @@
|
|||
def processor_count
|
||||
case RbConfig::CONFIG['host_os']
|
||||
when /darwin9/
|
||||
`hwprefs cpu_count`.to_i
|
||||
when /darwin/
|
||||
((`which hwprefs` != '') ? `hwprefs thread_count` : `sysctl -n hw.ncpu`).to_i
|
||||
when /linux/
|
||||
`cat /proc/cpuinfo | grep processor | wc -l`.to_i
|
||||
when /freebsd/
|
||||
`sysctl -n hw.ncpu`.to_i
|
||||
when /mswin|mingw/
|
||||
require 'win32ole'
|
||||
wmi = WIN32OLE.connect("winmgmts://")
|
||||
cpu = wmi.ExecQuery("select NumberOfCores from Win32_Processor") # TODO count hyper-threaded in this
|
||||
cpu.to_enum.first.NumberOfCores
|
||||
end
|
||||
end
|
||||
|
||||
Rainbows! do
|
||||
use :ThreadPool
|
||||
|
||||
client_max_body_size 100*1024*1024 # 100 Megabytes
|
||||
|
||||
worker_processes 8
|
||||
worker_processes processor_count
|
||||
worker_connections 32
|
||||
timeout 10
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue