On Tue, Jun 02, 2015 at 11:14:45AM -0700, cymrow wrote:
> Greenlet pool. I run a worker process with a greenlet pool for each CPU
> core.
Okay, cool, I've done the same thing and I didn't use a greenlet pool at all -
I basically just spawned from the accept loop for each request. I log response
time and cpu usage in graphite to track scaling metrics and so forth.
But it occurs to me, and maybe more to your question, you'd want to perhaps
look at the event loop directly and see how many greenlets are ready to run but
are waiting. This would give you a better idea (than sleep/idle) of how hard
you were pushing the process and perhaps that it was getting too many requests.
I would think a largish backlog would roughly correlate with high cpu
utilization.
I unfortunately don't know enough about the gevent internals to say how to do
that or if this is even possible...
It may also be interesting to look at the listening socket backlog as well
although it seems perhaps you can only do that through netstat.
m