When I stress test a certain interface of Sanic, an error will be reported when there are multiple concurrent requests as follows:
How should I avoid this error?
When I stress test a certain interface of Sanic, an error will be reported when there are multiple concurrent requests as follows:
How should I avoid this error?
Never seen that particularly, so I can’t say. There’s not really much to go on here to know what you’re running into besides hardware limitations. There’s no info on how you created this result, code, steps to reproduce, etc.
My environment is:
Sanic v23.3.0
python: 3.8.3
platform: Windows-10-10.0.19041-SP0
packages: sanic-routing==22.8.0
Server Code:
# !/bin/env python
# -*- coding=utf-8 -*-
from sanic import Sanic, response
app = Sanic("demo")
@app.route("/demo")
def demo_request(request):
return response.json({"status": "ok"})
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8000, access_log=False)
After the service starts, I use jmeter to test, will cause error.
Jmeter params like this:
I believe that when the concurrency exceeds the limit, the worker should not be stopped, and it is normal to refuse access.I want to know if there is max_requests for settings.
There is not a max_requests
setting, but you could potentially implement one since this information is available on the protocol. This type of concern could be handled by nginx as a proxy in front.
Okay, thank you! By the way, are there any plans to increase in the future?
Yes.
But I can’t release details yet.
Really looking forward to it.