Closed afilipov1 closed 3 years ago
Hi @AntonioFilipov
I'm not sure this is anything to do with the watchdog, it sounds like an issue with the python3-http template that you're using and the behaviour of its HTTP server called waitress.
I'd suggest you spend a bit of time with their documentation and browsing the template repo below:
You can find the repo here: https://github.com/openfaas-incubator/python-flask-template
For now I'll close this issue since it's attributing the behaviour to the of-watchdog which I believe to be incorrect (happy to be proven wrong of course).
Alex
/set title: Support issue for Python template
It seems like you may want the setting in the Waitress docs:
--threads=INT
https://docs.pylonsproject.org/projects/waitress/en/stable/runner.html#runner
If it can configured via ENV-var, then that'd be your easiest option, otherwise feel free to experiment by forking the templates repo, changing them and testing them out.
faas-cli template pull https://github.com/your-repo/templates
You should also configure some minimum level of availability for the function, like a min scale value, and then consider using the endpoint loadbalancing feature in openfaas, to make sure the replicas are getting an even balance and to prevent any keep-alive code in your testing app.
Endpoint load-balancing in the docs: https://docs.openfaas.com/architecture/production/#endpoint-load-balancing
Expected Behaviour
A way to configure how many threads of the underline WSGI server to be used for function execuiton
Current Behaviour
Default threads count is 4 and thus only 4 parallel functions are executed at the same time
Possible Solution
Providing an env variable inside templates
Steps to Reproduce
Function
Testing results with 50 parallel invokations
hey -n=50 -c 50 -m POST -d=Test http://192.168.64.14:31112/function/hello-openfaas-of-watchdog
From the last 2 blocks of logs we can see that only 4 requests are processed at the same time. Tested the same scenario with the classic watchdog and the execution time is much lower because of the multiple parallel processes.
Context
Currently we are evaluating the benefits for us if migrating to the new of-watchdog. We are looking for high concurrency and throughput with the new watchdog. With simple function without sleep the tests shows significant improvements with the new of-watchdog.
Your Environment
Docker version 19.03.1
Kubernetes version v1.15.4