Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8383729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:14:03+00:00 2026-06-09T17:14:03+00:00

I have a Resque job which pulls a csv list of data off of

  • 0

I have a Resque job which pulls a csv list of data off of a remote server and then runs through the +40k entries to add any new items to an existing database table. The job is running fine however it severely slows down the response time of any subsequent requests to the server. In the console which I’ve launched ‘bundle exec rails server’, I see not print statements though the job is running. However once I hit my rails server (via a page referesh), I see multiple SELECT / INSERT statements roll by before the server responds. The SELECT/INSERT statements are clearly generated by my Resque job but oddly they wait to print to the console unit I hit the server through the browser.

It sure feels like I’m doing something wrong or not following the ‘rails way’. Advice?

Here is the code in my Resque job which does the SELECT/INSERTS

# data is an array of hashes formed from parsing csv input. Max size is 1000
ActiveRecord::Base.transaction do
  data.each do |h|
    MyModel.find_or_create_by_X_and_Y( h[:x], h[:y], h )
  end
end

Software Stack

  • Rails 3.2.0
  • postgresql 9.1
  • Resque 1.20.0

EDIT

I’ve finally take the time to debug this a bit more. Even a very simple worker, like below, slows down the next server response. In the console where I’ve launched the rail sever process I see that the delay occurs b/c stdout from the worker is being printed only after I ping the server.

  def perform()
    s = Time.now
    0.upto( 90000 ) do |i|
      Rails.logger.debug  i * i
    end
    e = Time.now
    Rails.logger.info "Start: #{s} ---- End #{e}"
    Rails.logger.info "Total Time: #{e - s }"
  end

I can get the rails server back to its normal responsiveness again if I suppress stdout when I launch rails but it doesn’t seem like that should be necessary… bundle exec rails server > /dev/nul

Any input on a better way to solve this issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:14:04+00:00Added an answer on June 9, 2026 at 5:14 pm

    I think this answer to “Logging issues with Resque” will help.

    The Rails server, in development mode, has the log file open. My understanding — I need to confirm this — is that it flushes the log before writing anything new to it, in order to preserve the order. If you have the Rails server attached to a terminal, it wants to output all of the changes first! This can lead to large delays if your workers have written large quantities to the log.

    Note: this has been happening to me for some time, but I just put my finger on it recently.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Rufus every job that runs periodically, but sometimes it may fail
I have this Class which response to perform to be run by "Resque", I
I have a resque-scheduler delayed job that is queued properly. Everything is working nice
I have a rails 3 app which uses resque to run long running jobs
I'm using Resque workers to process job in a queue, I have a large
Since a few days I'm unable to start resque I have tried debugging this
The resque jobs I have do not depend on anything in Rails, but I'm
We have an API built on Rails, and processing some stuff with resque. After
have written this little class, which generates a UUID every time an object of
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.