GithubHelp home page GithubHelp logo

Comments (4)

talex5 avatar talex5 commented on August 22, 2024

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.

Cjen1 avatar Cjen1 commented on August 22, 2024

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.

talex5 avatar talex5 commented on August 22, 2024

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.

Cjen1 avatar Cjen1 commented on August 22, 2024

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)

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.