Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very slow perform_later call on ActiveJob #3837

Closed
elohr opened this issue May 2, 2018 · 2 comments
Closed

Very slow perform_later call on ActiveJob #3837

elohr opened this issue May 2, 2018 · 2 comments

Comments

@elohr
Copy link

elohr commented May 2, 2018

Ruby version: 2.3.3
Sidekiq / Pro / Enterprise version(s): Sidekiq 5.1.0

Initializer:

Sidekiq.configure_server do |config|
  config.redis = ConnectionPool.new(size: Sidekiq.options[:concurrency] + 4, timeout: 1) do
    $REDIS
  end
end

Sidekiq.configure_client do |config|
  config.redis = ConnectionPool.new(size: Sidekiq.options[:concurrency] + 4, timeout: 1) do
    $REDIS
  end
end

I have a SchedulerJob:

class SchedulerJob < ActiveJob::Base
  queue_as :scheduler

  def perform
    logger.debug("Start")
    DelayedJob.set(wait: 10.seconds).perform_later
    logger.debug("After Job 1")
    DelayedJob.set(wait: 20.seconds).perform_later
    logger.debug("After Job 2")
    DelayedJob.set(wait: 30.seconds).perform_later
    logger.debug("End")
  end
end

and a DelayedJob:

class DelayedJob < ActiveJob::Base
  queue_as :delayed_jobs

  def perform
    puts "I'm done"
  end
end

If I call SchedulerJob.new.perform the job runs in just a few milliseconds. If I call SchedulerJob.perform_later to run the job in Sidekiq it takes about 90 seconds to finish, and by looking at the logs I can tell that each of those .perform_later calls takes about 30 seconds each.

Why would this happen?

@mperham
Copy link
Collaborator

mperham commented May 2, 2018 via email

@elohr elohr changed the title Very slow perform_later call on ActiveJob and Sidekiq Very slow perform_later call on ActiveJob May 2, 2018
@elohr
Copy link
Author

elohr commented May 2, 2018

That fixed it. Thank you!

@elohr elohr closed this as completed May 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants