barbados's People
Forkers
isabella232barbados's Issues
Settle on Workers & Panic-ing behavior
There is in general two approaches to workers:
- start worker tasks ahead of time
- 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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.