We have developed a bot using the Bot framework and it is deployed on Azure and running on the Azure Bot service. Currently, there are two channels: Slack and MS Teams. The bot is built using a waterfall model and we have a predefined structure for the steps.
Technology used:
- Python (aiohttp, uvloop)
- CosmosDB
In the development environment, the python code is running with gunicorn and 2 workers on the P1v2 tier( 1CPU:1Core, 3.50 GB RAM ).
Issue: When we test our bot with only 2 users (Or more) simultaneously, from either Slack or Teams, after some time Azure starts throwing the below error:
Failed to forward request to application. Encountered a System.Net.Http.HttpRequestException exception after 1085.488ms with message: An error occurred while sending the request.. Check application logs to verify the application is properly handling HTTP traffic.
Also please find the attached screenshot of the application logs.
We have looked into its Traffic Manager feature as well and tried to implement it. But the methods available in it, do not seem to be suitable for this case.
The error mentioned above is thrown by Azure and the request does not reach our code. Moreover, after this error, if we send the message again, it reaches our code, the response is also sent successfully from the code, but it never reaches to the user at Slack or Teams.
Our expectation is at least 2 users should be able to talk with the bot at a time, on 1 CPU which is also low.
We have researched on this issue for weeks but we haven't found any working solution.
Any help would be appreciated.