Comments (9)
@zubair-temi the problem is that python by itself is very slow, try this uwsgi+nxing #13
from hit-counter.
@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.
stats: {
totalElapsed: 3918.5201469659805,
main: {
meter: {
mean: 19.664531856285347,
count: 77,
currentRate: 29.67619221666306,
'1MinuteRate': 0,
'5MinuteRate': 0,
'15MinuteRate': 0
},
histogram: {
min: 288.20108902454376,
max: 1496.9496248960495,
sum: 37145.473836660385,
variance: 149351.9639121301,
mean: 482.40875112545956,
stddev: 386.4608180813808,
count: 77,
median: 346.6487469673157,
p75: 373.0026630163193,
p95: 1488.0008405685426,
p99: 1496.9496248960495,
p999: 1496.9496248960495
}
}
}
from hit-counter.
@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.
from hit-counter.
@zubair-temi If you are crazy about performance you should go for rust instead :)
from hit-counter.
@fluential "Go for rust". Pun intended?
from hit-counter.
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.
from hit-counter.
@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.
from hit-counter.
@zubair-temi @brentvollebregt this
Line 52 in 2897edb
I suggest you run some benchmarks with current code using:
- native python (using currently)
- nginx+uwsgi (use #13)
- meinheld (use https://github.com/tiangolo/meinheld-gunicorn-flask-docker)
Make a change and flush every 100000 requests, comapre you might get blown away.
from hit-counter.
Line 52 in 2897edb
is another problem, as I've mentioned in the #13 you would want to flush data periodically instead of inserting every time request hits the server. The simplest you could implement is flush ever X requests.
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.
@brentvollebregt Comparing default python to any other wsgi server is basically not even comparable.
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:
The API request time for pythonanywhere ranged from 2-4 seconds
from hit-counter.
Related Issues (20)
- Counter is broken HOT 3
- hit-counter gives timeout HOT 8
- Github shows You can't comment at this time.
- Your issue setting may be wrong. HOT 1
- Even the update of my comments is disabled (by settings?) :-(
- No 'Access-Control-Allow-Origin' header is present on the requested resource HOT 2
- The site is down HOT 5
- Feature request: allow to count files download HOT 3
- Hit Counter Badge isn't coming HOT 2
- Ajax request makes the count continuously increasing HOT 11
- Bug : Not Working (Doesn't Show up ) HOT 1
- Add a license HOT 1
- hit counter url is barely responsive HOT 2
- Deprecated Usage Examples HOT 1
- Is the same person viewing the repo again and again counted as another view? HOT 5
- How does counting for another site work? HOT 1
- Appears to be down HOT 1
- Feature request: unique visitor count HOT 2
- Hosted on #! HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hit-counter.