-
Notifications
You must be signed in to change notification settings - Fork 43
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
Hosting on heroku #15
Comments
@zubair-temi the problem is that python by itself is very slow, try this uwsgi+nxing #13 |
@fluential Well, then I'd better not use this at all. I'm getting reasonable API response time (on average sub-500ms) on heroku which works for me now. If I'd need more performance, I'd port it to golang.
|
@zubair-temi Most likely you are right. In terms of python for yet better performance consider using ASGI frameworks instead of WSGI. Out of the box try running this image https://github.com/tiangolo/meinheld-gunicorn-flask-docker this is as fast as wsgi flask can go. |
@zubair-temi If you are crazy about performance you should go for rust instead :) |
@fluential "Go for rust". Pun intended? 😄 |
In terms of the speed, I know pythonanywhere is slow, but for my original use case, I didn't mind it. Python is another factor to the speed but I don't this it's anything comparable to the delay from pythonanywhere. I mentioned in #13, maybe I could use peewee to fix the database issues we are facing - which will allow us to then use MySQL, Postgresql, CockroachDB and the default SQLite. |
@zubair-temi you could try running under https://github.com/tiangolo/meinheld-gunicorn-flask-docker and give use some numbers ?;) @brentvollebregt Comparing default python to any other wsgi server is basically not even comparable. So if you need a reliable anything python please stop running via default python webserver :) More reading https://flask.palletsprojects.com/en/1.0.x/deploying/uwsgi/ PS: In the original Docker image for test I did use native pathon, but in this MR you will see that uwsgi image is now being used correctly to expose app via nginx uwsgi. |
@zubair-temi @brentvollebregt this Line 52 in 2897edb
I suggest you run some benchmarks with current code using:
Make a change and flush every 100000 requests, comapre you might get blown away. |
Yep, I understand this is an issue also. A simple option would be to store deltas in an internal dictionary and flush every x requests as you said.
I was trying to say the speed decrease from Python is nothing compared to what I am currently loosing on python anywhere; I can see:
|
Pythonanywhere had a very bad performance in the region I'm living (South Asia) so I had to deploy this on heroku for a better performance. The API request time for pythonanywhere ranged from 2-4 seconds, while heroku gives me sub 500ms response times. The problem is that heroku doesn't support persistent filesystem in free tier so I had to patch the code to work with postgres as it is available in heroku free tier.
My fork with postgres settings is here: https://github.com/zubair-temi/hit-counter
Should I open a pull request to this repo to merge these changes? Maybe you can keep it in a separate branch. What do you think?
I'd also update the README with heroku + postgres deployment instructions if you're willing to merge the changes.
The text was updated successfully, but these errors were encountered: