question

DevBuster-3739 avatar image
0 Votes"
DevBuster-3739 asked DevBuster-3739 commented

Maintain single state in azure function

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
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JayaC-MSFT avatar image
0 Votes"
JayaC-MSFT answered DevBuster-3739 commented

Hello @DevBuster-3739, 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.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thats the problem, we cannot have async process and more than 1 connection Or instance at a time. We need to connect to mainframe socket. It seems azure has very little support on that. We did lot of R&D and decided to go with OnPrem services instead.

1 Vote 1 ·

That's a good suggestion. But when you say blocking call and limit scale. We will loose requests when traffic increases.
Can you please tell how Azure will handle this scenario, business don;t want to loose any requests.

0 Votes 0 ·

Hello @DevBuster-3739, you may want to check this https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-azure-and-service-bus-queues-compared-contrasted or consider something similar depending on what type of requests you are handling here.

0 Votes 0 ·