What does Sidekiq server and client terminology mean?

SideKiq's document says

Sidekiq.configure_server do |config| config.redis = {:namespace => "figs_#{Rails.env}", :size => 25, :url => 'redis://localhost:6379/0'} end Sidekiq.configure_client do |config| config.redis = {:namespace => "figs_#{Rails.env}", :size => 25, :url => 'redis://localhost:6379/0'} end 

I am wondering what this configure_server and configure_client mean here?

  config.redis = {:namespace => "figs_#{Rails.env}", :size => 25, :url => 'redis://localhost:6379/0'} 

Obviously, redis location, queue type, etc.

+6
source share
3 answers

A client is what drives jobs to Redis, usually to your passenger, puma, or unicorn working with Rails or Sinatra. Server is a Sidekiq process that pulls jobs from Redis. One complication: the Sidekiq server process can redirect new jobs to Redis, so it acts like a client!

config/sidekiq.yml designed to allow the same configuration as command line arguments. The initializer is for a more complex configuration that requires Ruby, such as Redis connection information or custom middleware.

+6
source

from railscasts

Sidekiq has client-side middleware that runs before the job is inserted into Redis and server-side that runs before the job is processed. This middleware repeats jobs, logs them, and processes exceptions.

Thus, you can set, for example, size 25 for processing tasks (on the server side) and 10 for adding tasks to the queue (on the client side). This should increase the likelihood of a queue queue.

But I still donโ€™t understand why there is some configuration in config/initializers/sidekiq.rb and another in /config/sidekiq.yml (see Sidekiq: Additional parameters )

0
source

I like to think about it, as it relates to Heroku. There are two main processes (dynos) web and worker.

Speakers of the web type are located where your application (web server) is running, and thus, all connections from the router are delivered to your web dyno so that the application can respond to a response.

Speakers that have the type of worker where your background jobs are processed. This is where Sidekiq performs its method, so that it does not block your web dyno.

In web speakers, Sidekiq.configure_client is launched. It configures how your web dino connects to Sidekiq and submits tasks.

Sidekaq.configure_server works in working speakers. It configures how your working dyno connects to Sidekiq and processes jobs.

0
source

All Articles