On Fri, May 10, 2013 at 7:48 PM, Alex Kocharin <[email protected]> wrote: > Hi everyone, > > I'm looking for a way to check a responsiveness of node.js app, and find out > if it tries to do more work that it should, and I need to scale up it > somehow. > > CPU time isn't it. If I see 100% cpu load, it might indicate that node.js is > currently successfully serving thousands of requests, or it might indicate > that someone put in extra semicolon in "while(1); {blablabla}" sentence, and > there's no way to distinguish these. > > On the other hand, a difference between time when some callback should fire > and a time when it actually fires shows what's needed. If some callback > executes a second after it should, we surely are in trouble. There is a lot > of packages like 'toobusy' seem to do exactly that, they fire up a callback > every second and measure a time when it fired. But it sounds like too rough > or imprecise way. > > When I was thinking about that, I remembered how load average in unix > kernels is calculated. If there was such thing for node.js core, that would > solve an issue. I mean, just like 'os kernel load average' shows amount of > currently runnable processes, I'd like to see 'node.js event loop load > average' that shows amount of currently runnable functions in node.js event > loop. Is there such thing?
Maybe, depends on your definition of 'runnable'. You could track process._getActiveHandles() and process._getActiveRequests() to get a feel of overall event loop progress. > Anyway, what performance metrics does event loop expose? Maybe some libuv > functions I can use to get that? Or maybe I can register a custom c++ > function that gets executed in every tick in event loop? There are tick-start and tick-stop dtrace probes in recent versions of libuv / node.js. We'll add support for systemtap and ETW as well, someday. Alternatively, you could pair uv_prepare_t and uv_check_t handles in an add-on. Prepare handle callbacks are run just before entering epoll_wait/kevent/port_getn/etc., check handle callbacks right after. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
