1 year ago
#360520
Roy Amoyal
Heroku python backend server is extremely slow compared to the localhost (haar cascade face detector)
I am using Flask as my python backend and html-js-css for the frontend. I am using the socketio to send the live streaming of the client webcam to the server then I process it (with opencv and more libraries and sending it back to the client and display it. For Example a face detector (ignore the face recognition header)
In my localhost, the web is running really fast (I am using Macbook Pro) but when I deploy it to the Heroku, I get latency and it is getting worse as time is passing. (probably the client is sending faster frames to the server, but the server sends it slowly back, the processing time in the server is around 12-13 FPS)
I am trying to use easy computer vision tasks that a normal CPU can handle in 30+ FPS but for some reason, the Heroku server is really slow, even when I use more dynos.
this is my Procfile:
web: gunicorn --worker-class eventlet -w 1 app:app
Important Note: If I don't process the frame in the python backend, and I just send the frames from the client to the server and then back (Just for sanity that it works), it works really well and the latency is very low (it's great!).
what can I do about it? I even tried to pay for more dynos(500$+) and I got the same results.
thanks!
python
opencv
flask
heroku
flask-socketio
0 Answers
Your Answer