Sha256: 7f17b2c3cf41a4dcf95f1dff72a8d2792610f87ba8a6fde7a8b1814d4a5cd527
Contents?: true
Size: 676 Bytes
Versions: 2
Compression:
Stored size: 676 Bytes
Contents
class Chef class Recipe def get_resque_worker_count return 1 if node[:instance_role] == 'solo' || node[:instance_role] == 'eylocal' # $ sudo cat /proc/meminfo # MemTotal: 1759228 kB # ... mem_total_kb = `awk '/MemTotal/{print $2}' /proc/meminfo`.strip.to_i mem_total_mb = mem_total_kb / 1024 # Want no more than ((total memory - 300) / est process size) workers + jobs to run # in other words, if all workers on the instance are running jobs, there should # be memory left over result = (mem_total_mb - node[:worker_memory].to_i) / node[:worker_memory].to_i result end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
eycloud-recipe-resque-1.1.1 | libraries/get_resque_worker_count.rb |
eycloud-recipe-resque-1.1.0 | libraries/get_resque_worker_count.rb |