Maintain single state in azure function

DevBuster007 176 Reputation points
2021-03-26T19:16:42.173+00:00

I have hit a road block with maintain a single state in azure function. I know we have azure durable function but it also spins up multiple instances.

We are connecting with socket within our code using tcp send request.
This sockets wants us to maintain a single session.
And give it a wake up call every 120 seconds.

How can i maintain a single session in azure application?
Can you please suggest.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,300 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JayaC-MSFT 5,526 Reputation points
    2021-03-30T12:41:50.217+00:00

    Hello @DevBuster007 , I believe you want each execution to be a blocking call and limit the scale to one instance only.
    To achieve that you could modify the App Setting WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT.

    However, if your code is asynchronous, the same app instance can process multiple requests in parallel.

    You may also check the Singleton attribute concept here.
    https://github.com/Azure/azure-functions-host/issues/912

    Please let me know whether this helps. If yes, please "Accept the answer" and "up-vote" so that it helps others in the community.