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

Allcentury async delivery adapter #589

Merged
merged 11 commits into from
Nov 30, 2019
Merged

Conversation

phstc
Copy link
Collaborator

@phstc phstc commented Nov 30, 2019

Minor changes on top of #588

Anthony Ross and others added 9 commits November 22, 2019 23:13
Prior to this change delivering 5000 messages took on average:

    user     system      total        real
6.351633   0.535708   6.887341 ( 42.842282)

After this change, I am able to delivery 5000 messages in:

    user     system      total        real
7.160261   1.237327   8.397588 (  7.676820)

In my rough benchmarks I see a 5-7x increase.  This is valuable for us because we enqueue a large number of jobs at once in a loop, something akin to:

```ruby
MyModel.expensive_query.each { |obj| MyJob.perform_later(obj) }
```

Usable by setting:

```ruby
config.active_job.queue_adapter = ActiveJob::QueueAdapters::ShoryukenConcurrentSendAdapter.new
```

Handlers are available for both success and failure and must respond to
call.

Example:

```ruby
adapter = ActiveJob::QueueAdapters::ShoryukenConcurrentSendAdapter.new
adapter.success_handler = ->(job, options) {
StatsD.increment(job.class.name + "success") }
adapter.error_handler = ->(err, (job, options)) {
StatsD.increment(job.class.name + "failure") }

config.active_job.queue_adapter = adapter
```
@phstc phstc force-pushed the allcentury-async-delivery-adapter branch from 703ce0f to 565874a Compare November 30, 2019 22:21
@phstc phstc merged commit be59f61 into master Nov 30, 2019
@phstc phstc deleted the allcentury-async-delivery-adapter branch November 30, 2019 23:00
@phstc phstc mentioned this pull request Nov 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant