Git Product home page Git Product logo

barbados's People

Contributors

swatinem avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

isabella232

barbados's Issues

Settle on Workers & Panic-ing behavior

There is in general two approaches to workers:

  1. start worker tasks ahead of time
  2. start worker tasks on demand

We currently use 1. but there should be an experiment with approach 2. in the commit history as well.

There is also a question of how to properly make this panic-safe, meaning that panics from submitted tasks do not interfere with queue operations. For some reason I was fighting with the compiler over being able to use futures_util::future::CatchUnwind. Maybe that was just me not knowing how to properly use that, but the implementation right now is not panic-safe.
A panic in a task will essentially kill that whole worker, making it unavailable from then on.

  • Spawning one tokio task per queued task would solve that halfway, although keeping track of the number of running tasks still needs to be taken care of
  • Having always-running worker tasks is nice because it avoids repeated Arc-ing all the time, but might have overhead imposed by tokio.
  • On the other hand, spawning tasks on demand requires Arc-ing a bunch of stuff each time, and also imposes overhead from tokio for spawning tasks.
  • Spawning on demand can also be done either with a dedicated always running scheduler, or truely on-demand in the enqueue method, and having already started tasks keep servicing the queue.
  • ^ though the above would also require the workers to be panic-safe.

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.