Replies: 2 comments 2 replies
-
We've spent the day trying all sorts of things, but we still have issues. We bumped up backpressure, that blew up our database (we ran out of connections). We tried less workers, more workers, all sorts of inbetween configurations. I think the hardest part is not knowing if granian is contributing to the latency at this point or if we're just wasting our time tuning the wrong things. Are there any metrics or logs (debug logs?) that would help us determine if the io threads/backpressure is too low? My next plan is to get some continuous profiler running so I can at least see what's going on under the hood. |
Beta Was this translation helpful? Give feedback.
-
I can't think of anything specific which can increase latency 10x compared to gUnicorn (in fact, every benchmark suggests otherwise). To me sounds like you're overloading the database, so instead of increasing backpressure I would go the other way around and pick very low numbers (4-16 range). If that doesn't help, the other possible way would be to limit the blocking threads to a low number as well, but I would first try with a low backpressure. |
Beta Was this translation helpful? Give feedback.
-
Hi!
We're looking at switching over from Gunicorn to Granian but we ran into a weird performance issue. We're running Django 4.x, and in our development environment baseline latency has gone up from 6ms to 60ms.
This was weird, so I started digging into our apm traces and found one of our middlewares (something custom) has gone from an average of 6ms to 60ms.
It's got some unexciting code that looks like:
At this point I couldn't find any obvious reasons for issues, so I started to dig into blocking threads, stuff like that, trying to find anything to tune. From my understanding for WSGI the best option for us is:
At that point I would have had backpressure=128 by the default calculation, so I then bumped this to 512 to see if it would help but nothing changed about the latency profile. (We don't use a db connection pool, we just let django do it's thing, so I couldn't scale them based on that).
Questions:
The latency hike was pretty noticeable on the charts so I'm hesitant to try and roll this up into environments with more traffic until I better understand what's going on here. Any suggestions would be gratefully appreciated!
Beta Was this translation helpful? Give feedback.
All reactions