Request scheduling in Orleans
In the previous chapter, we learned that one of the design decisions of Orleans is to use cooperative multi-tasking. By default, the Orleans runtime will execute incoming requests on a given grain from start to completion before processing the next request. Orleans gives some control to developers where the current request is for an asynchronous operation (for example, an I/O operation) to complete, to let other requests be processed.
Let's understand the default request scheduling behavior in Orleans with an example. Consider the following code snippet of the HotelGrain
implementation to handle the scenario of a guest transferring from one hotel to another hotel in our chain. At the time of check-in to the new hotel, we need to compute the amount due from the previous hotel:
public class HotelGrain : Grain, IHotelGrain { public Task<decimal> ComputeDue(string guestName) { &...