by echoangle · 4mo ago · 0 comments
> After turning on template caching, it seems like the site can now pretty easily handle 12 requests per second or so without using all of the CPU. I have not carefully benchmarked the before and after but it seems like it’s made a pretty big difference.
That seems crazy low, I think there has to be something else going on here.
And if you pay $10/month for a single threaded machine, you’re overpaying by a lot.
For a half-decent VM, I'd be expecting multi-thousand.
Single figures a second, is choked to a single connection at a time.
Anyway, more than a decade ago my django servers could handle close to 10 requests per second on each thread.
[0] https://github.com/django/django/blob/main/django/core/serve...
Using Django is like trying to walk on a highway, with a crutch. Even though it has some convenience features, it's just so impossibly slow you would have to invest a lot of engineering time and resources to mitigate that slowness.
I imagine even a $10 VPS should be a much more powerful machine than a high-end server from 2005 or so.
I don't think the performance issues here are a result of Django. The author says only 2-3 requests per second (rps). Even in debug mode just using django runserver I can get 60~ rps on my $WORK repo. Part of this is likely their choice of only using '-c 1', which doesn't accurately represent a web workload.
For example on a local dev server I get (in format -c n. rps)
1. 58
2. 61
3. 55
as expected because we only have 1 worker, in debug with little caching.
but when looking at an example production config we see
1. 1: 11
2. 2: 23
3. 5: 54
4. 10: 95
5. 20: 153
6. 30: 165
7. 40: 177
8. 50: 192
and so on....
All of these are far in excess of the 2-3 observed by the author.
Note these will heavily depend on how many database hits you have per request as that is the majority of workload, as well as your http server such as using http 1/2/3, and the TLS settings used etc...