mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Add embedded puma example
This commit is contained in:
parent
5f0c9bc7b6
commit
19047b9cd0
3 changed files with 22 additions and 1 deletions
|
@ -41,4 +41,4 @@ The standard Ruby runtime does not scale well with lots of Threads so embedded m
|
|||
|
||||
> RULE OF THUMB: **if you are using embedded mode, you should be monitoring the CPU usage of that process!**
|
||||
|
||||
Note the other Threads enumerated above. The concurrency value controls how many Processor threads will be started but there are also separate threads for heartbeat, poller, manager and other internal services. These threads are relatively CPU-light but they still need regular, predictable access to the CPU for their own work.
|
||||
Note the other Threads enumerated above. The concurrency value controls how many Processor threads will be started but there are also separate threads for heartbeat, scheduler, and other internal services. These threads are relatively CPU-light but they still need regular, predictable access to the CPU for their own work.
|
||||
|
|
|
@ -15,6 +15,10 @@ module Sidekiq
|
|||
fire_event(:startup, reverse: false, reraise: true)
|
||||
@launcher = Sidekiq::Launcher.new(@config)
|
||||
@launcher.run
|
||||
sleep 0.1
|
||||
|
||||
logger.info "Embedded mode running with #{Thread.list.size} threads"
|
||||
logger.debug { Thread.list.map(&:name) }
|
||||
end
|
||||
|
||||
def quiet
|
||||
|
|
17
myapp/config/puma.rb
Normal file
17
myapp/config/puma.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
require "sidekiq/cli"
|
||||
workers 3
|
||||
threads 3, 5
|
||||
|
||||
on_worker_boot do
|
||||
$sidekiq = Sidekiq.configure_embed do |config|
|
||||
config.queues = %w[critical default low]
|
||||
# don't raise this unless you know your app has available CPU time to burn.
|
||||
# it's easy to overload a Ruby process with too many threads.
|
||||
config.concurrency = 2
|
||||
end
|
||||
$sidekiq&.run
|
||||
end
|
||||
|
||||
on_worker_shutdown do
|
||||
$sidekiq&.stop
|
||||
end
|
Loading…
Reference in a new issue