Comments (4)
Yes, using a separate multicore domain would work for this. However, Eio is currently lacking primitives for communicating easily between domains.
With the io-uring backend, there is an ioprio
field that might be useful (I don't know - I've never used it). It's not exposed in the OCaml API at the moment, though. Apart from that, Linux will do the reads in whatever order it wants.
The easiest way is probably to have each reader (handling one client connection) push the client request onto an Eio.Stream
and have a single fibre pulling the requests off and handling them, doing Fibre.yield
after each request. Then when a high-priority internal message arrives, that doesn't go on the queue and is instead handled immediately. But that assumes that it's the processing of the requests that is slow, rather than merely receiving them.
from eio.
The stream approach should work I think (given limited size streams), but would require that any rpc library to implement that kind of processing.
Is there any way to do prioritisation of the scheduling of fibres themselves?
(since in theory the read will not complete until the fibre is run again)
from eio.
Is this still a problem?
being able to prioritise internal communications over external ones is quite important
I think we always prioritise internal comms over IO now. Both uring and luv backends keep a special "IO" task in the run queue to remind them to check for IO from time to time because otherwise doing Fiber.yield
in a loop would block everything else.
from eio.
After rewriting the IO layer, this is no longer an issue for me specifically.
What was occurring was that if client requests were coming in they would each start a new fiber waiting for the resolution of that rpc request.
The issue was that if client requests kept coming in the time between main loop runs would increase, effectively causing queuing at the client side.
I've now redone the IO layer such that it is one fiber per client which should prevent this from occurring and also I can chuck it into another domain to avoid this entirely.
I think that if there was some overarching scheduling prioritisation feature this would help (attaching each fiber some priority) but I also fully understand how much work that would entail and also that it would be difficult to avoid starvation etc.
Additionally if other solutions exist (such as popping the client communication into its own domain) then this should be a non-issue for now.
from eio.
Related Issues (20)
- Restore "available" metadata on eio_windows
- Keep writes within IOV_MAX HOT 1
- Compilation failure HOT 7
- api questions and some migration feedback HOT 7
- Full tracing support
- `_os_unfair_lock_corruption_abort` after fork on MacOS HOT 15
- `getsockname` missing? HOT 3
- Switches should be domain-safe
- Eio_unix: Allocation warning from sched.ml breaks cram tests HOT 2
- Unix.Unix_error(Unix.EPERM, "io_uring_queue_init", "") failures in Docker HOT 5
- Occasional deadlocks with systhreads
- Multiple message in TCP communication with flow HOT 3
- Explanation of "connect-in-progress" HOT 3
- Net.listen hangs if the port is already in use HOT 2
- Extending eio from the outside HOT 1
- Signal handlers may not run, especially with eio_linux
- Support: sockets as flows with compatible poly variants HOT 1
- Fails to build with musl-gcc w/ linux-lts headers (no `struct clone_args`) HOT 1
- Eio.Path.load causes "file descriptor used after calling close!" error HOT 7
- Path.split does not work with backslash-encoded paths. HOT 1
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.
from eio.