开发者

How to easily delay Query insertion in Rails 3 app

开发者 https://www.devze.com 2023-02-19 19:03 出处:网络
I have one method that needs to handle large number of requests. I\'m using Rack for it. What it does is that it receive parameters and it creates a delayed_job task:

I have one method that needs to handle large number of requests. I'm using Rack for it.

What it does is that it receive parameters and it creates a delayed_job task:

def self.call(env)
   ...
   Delayed::Job.enqueue(....)

To optimize it further I thought it would be nice to make the line above happen in the Background (maybe caching it in memory to insert the Delayed job entry in DB a bit later and increase responsiveness of the Rack App).

Any easy way to delay queuing Delayed Job task to save few mi开发者_StackOverflow社区lliseconds?

Current Bench mark is 12ms / Request so even couple milliseconds will help.


If you use workling/starling instead of delayed_job, then you can use Memcached instead of the database.

https://github.com/purzelrakete/workling

https://github.com/starling/starling

0

精彩评论

暂无评论...
验证码 换一张
取 消