dotnet / orleans

Cloud Native application framework for .NET
https://docs.microsoft.com/dotnet/orleans
MIT License
9.96k stars 2.02k forks source link

Grain prioritization #8650

Open keithazzopardi opened 9 months ago

keithazzopardi commented 9 months ago

Hi folks,

Let's say that we have 2 types of grains: Grain 1 and Grain 2. I would like that under heavy system load Grain 1 will have higher priority compared to Grain 2 and serves more throughput. What is the best way to achieve this? Perhaps throttling on grain type?

Thanks,

ReubenBond commented 8 months ago

There is currently no mechanism for this, but if you have a proposal for an implementation which will not be prohibitively expensive at runtime, then we will consider it. Ideally, it should impact performance only if it is used.

I am also interested in learning more about the scenario. I see that this could be quite beneficial. Ideally, if we had cheap, possibly approximate counters per-grain and per-grain-type, we could use those to prioritize request or Task scheduling and/or to throttle grains which consume too much.

For inspiration, the JIT in .NET 8 implements scalable approximate counting.