What are the use cases for worker sessions

I am reading the doc of worker sessions. Could anyone give some examples or principles of use cases of this feature? I am not quite sure when I should use it, and if I am not using it, will it be of some trouble which I fail to anticipate ?

Hi @maki_XIE

sessions allow you to execute multiple activities on the same worker process / host, see file processing sample.

Another use case for sessions can be to limit a number of parallel sessions running on a worker process / host.

For file processing sample with session, I have a problem here. If the downloading activity is finished, and the file is on Host-A which runs the worker. Then Host-A goes down, what happens to the unfinished workflow? The worker on other hosts without the local file can hardly finished the remaining work, and the downloading file is on local. What will happen, the matching service will not send the related task to other workers until some worker on host-A is polling or it will send anyway and then a non-deterministic task blows up this flow.? I am asking this question because part of the durable is not on the server but on the worker?

For another use case, I don’t quite understand, could you help clarify?

The host going down is not going to affect workflow in any way as it is not linked to a specific host. It assumes that you run a workflow worker at more than one host.

When Host-A goes down the session is going time out and the workflow code has to handle this error and reexecute the whole session on a different host. Look at the fileprocessing sample. It does exactly that.

2 Likes

get it. Then when using the session, the task is on the session not for a single activity inside this session. I think this is the point that confuses me. I have checked the file-processing sample, but I haven’t find time to test it locally and check the event history. Thank you:)