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

Performance issue with long queue. #18

Open
heaven opened this issue Aug 4, 2012 · 1 comment
Open

Performance issue with long queue. #18

heaven opened this issue Aug 4, 2012 · 1 comment

Comments

@heaven
Copy link

heaven commented Aug 4, 2012

Hi, found that if queue contains a lot of records (in my case ≈250000 items) indexing works incredibly slow. This line cause the troubles:

doc = collection.find_and_modify(:update => {"$set" => {:run_at => Time.now.utc + queue.retry_interval, :error => nil, :lock => lock}}, :query => conditions, :limit => queue.batch_size, :sort => [[:priority, Mongo::DESCENDING], [:run_at, Mongo::ASCENDING]])

It's in Sunspot::IndexQueue::Entry::MongoImpl#next_batch!.

Now it updates each doc separately, think things could be improved if we will set :run_at for the whole batch of records instead of setting it individually for each record.

@heaven
Copy link
Author

heaven commented Aug 6, 2012

Also cause this warning:

Mon Aug  6 08:41:04 [conn13] warning: ClientCursor::yield can't unlock b/c of recursive lock ns:
crm_production.sunspot_index_queue_entries top: {
  opid: 1305,
  active: true,
  lockType: "write",
  waitingForLock: false,
  secs_running: 3,
  op: "query",
  ns: "crm_production",

  query: {
    findandmodify: "sunspot_index_queue_entries",
    update: {
      $set: {
        run_at: new Date(1344242520464),
        error: null,
        lock: 914414234
      }
    },

    query: {
      run_at: {
        $lte: new Date(1344242434611)
      }
    },

    limit: 100,
    sort: { priority: -1, run_at: 1 }
  },

  client: "67.214.219.87:49452",
  desc: "conn",
  threadId: "0x7f38b41be700",
  connectionId: 13,
  numYields: 0 
}

Log grow extremely fast, even log rotating doesn't always help.

heaven added a commit to heaven/sunspot_index_queue that referenced this issue Aug 6, 2012
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

1 participant