-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
High CPU usage with eventlet #114
Comments
You ever figure this out? |
No, I'm still stuck with this problem |
Can you use MQTT outside of Flask? Curious if that would make a CPU difference or not |
If I don't connect to the broker it works perfectly, the MQTT is clearly the issue. |
From the Flask Mqtt documentation there is multi workers limitation so as you use many clients connecting in the same time it might be the reason. |
This also happens with only one client connected |
I'm using Flask on a project on an embedded system and I'm having performance issues. I'm running gunicorn with one eventlet worker by running:
gunicorn -b 0.0.0.0 --worker-class eventlet -w 1 'app:create_app()'
The problem I'm facing is that, when the MQTT messages start to pour with more cadence, the application starts to use almost all the CPU I have available. My initial thought was that I was handling the messages not ideally but, I even took out my handler, and just receive the messages, and the problem still persists.
I have another python application, running on the same platform, that subscribes to the same information with the paho client and this is not an issue, so I'm assuming I'm missing something on my Flask application and it's not the information itself.
My code is:
As you can see my handler mqtt_topicSplitter is commented but I'm still having performance issues. I've tried adding an sleep command [eventlet.sleep(0.1)] on the on_message handler which solved the CPU consumption problem but resulted on my application being constantly kicked from the broker.
I'm sorry if I wasn't clear, but I'm not an expert, please feel free to ask me any questions if needed.
Thanks in advance.
The text was updated successfully, but these errors were encountered: