Giter Site home page Giter Site logo

mercadolibre / toiler Goto Github PK

View Code? Open in Web Editor NEW
16.0 4.0 10.0 160 KB

Toiler is a AWS SQS long-polling thread-based message processor.

License: GNU Lesser General Public License v3.0

Ruby 100.00%
polling sqs-message workers ruby sqs sqs-poller threaded

toiler's Issues

DB_POOL default value weirdness

It's friday and just had a weird bug in our new kubernetes infrastructure want to capture here because it doesn't make sense to me... but in rails console, database connections were working fine, but in toiler, we were getting 100% only database connection timeouts... normally DB_POOL defaults to 5 in rails if no value set, but somehow in Toiler, without this set it was... I dunno, defaulting to 0 or something... does that make any sense to you @sschepens ? May investigate next week, but seems weird. Also FYI to @gtaschuk to discuss/look into together next week.

Whitelist or specify queues to process in configuration.yml

Shoryuken supports this, and we plan to add this and PR when done, we could have used this last week but we just moved the job we needed to segregate back to DelayedJob for now, but we hope to move all our jobs over to toiler and will want to partition them to different boxes based on kind of work and importance. Think this won't be hard to add, but thought I'd open an issue here first to document need/convention, and if you @sschepens or anyone else has preferred interface, happy to consider, otherwise would probably plan to match Shoryuken's interface as a goal.

Test suite

@sschepens hey so I was looking at maybe starting on the config extension for #7 and thought I'd start by reviewing existing tests, maybe try and even start TDD with a new failing test (I'm not great at TDD but like to try now and then), but I'm not seeing any tests in the repo... any chance you just didn't commit them for some reason? If not, maybe I can adapt some of shoryuken's tests and get a suite running on Travis or something, seems like we'd like at least decent test coverage going forward to enable safe releases.

Concurrency/parallism question/concern

Hey @sschepens ! We got our app using Toiler and it's chugging along nicely in our test environment and it looks to have solved a somewhat severe memory leak problem there! So hooray and thanks for help!

The processing characteristics look plenty fast, but very different from what we see on Shoryuken though, and while not necessarily bad, it wasn't obvious to me and I'm wondering if a) we need better docs, and/or b) if we need to/should add some additional config around the differences.

For context, our worker looks approx like this (split the worker out from creator because of memoize/ivar issue discussed previously to make one object per message), and we have 3 queues at present and concurrency of 25:

class CreationQueueWorker
  Queue = ENV.fetch('SQS_CREATE_QUEUE')
  include Toiler::Worker
  toiler_options queue: Queue,
                 auto_delete: true,
                 parser: :json

  def perform(_body, sqs_hash_message)
    Creator.perform(sqs_hash_message)
  end
end

The surprising thing to me, which I think I understand now but wanted to discuss, is that we only ever see one message in flight from the queue... this makes sense now I think about it because it's one thread per queue at a time, but a) am I right that there's no point having higher concurrency than your number of queues? and b) though this may be desirable where you want to guarantee messages are processed in order, in a lot of cases ordering is unimportant, and it would be nice to be able to specify a queue should have as many threads as are available working on it. I'm not sure how I'd do that now without creating multiple worker classes all naming the same queue or something.

Possibly specifying a pool_size option in worker config would make sense for this, with a default size of 1, for no parallelism per queue, but will use up to pool_size threads in parallel when available?

Do I understand correctly, and what do you think? Nice work though, so far I'm impressed with toiler!

ActiveJob interface

@sschepens we talked about this and I know on the roadmap, but wanted to document here with an issue, we may tackle this at work in a fork and PR it back, or let me know if you've already started. Toiler's working great for us in production now by the way, much better than Shoryuken was, lower memory and faster processing!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.