On Thu, Nov 15, 2012 at 10:41 AM, Anton Whalley
<anton.whal...@nearform.com> wrote:
> Can you put it on an illumOS based system temporarily and get DTracing?
> At the very least this would tell you if its infrastructure or application.
>
> Spin up a Joyent SmartOS or do a local install of OpenIndiana.
> Then install your app
>
> This d script will show you when garbage collection is starting and how long
> it takes.
>
>
> node*:::gc-start
> {
>     self->ts = timestamp;
> }
>
> node*:::gc-done
> {
>     printf("Garbage Collection - [%Y] - %d",
>               walltimestamp,
>               timestamp - self->ts);
>               self->ts = 0
> }

In that vein, if you're on a semi-recent RHEL-based system (CentOS,
Fedora), you can use this systemtap script.  It prints aggregated GC
statistics every 5 seconds and at program exit.  Run with `sudo stap
gc.stp -c 'node script.js'`.

Note that systemtap support currently only exists in master.
Debian/Ubuntu probably won't work, the systemtap in the official
repositories is too old.

#!/usr/bin/env stap

global samples
global all_samples
global timestamp

probe process("node").mark("gc__start")
{
  timestamp = gettimeofday_us()
}

probe process("node").mark("gc__done")
{
  sample = gettimeofday_us() - timestamp
  samples <<< sample
  all_samples <<< sample
}

probe timer.s(5)
{
  print(@hist_log(samples))
  printf("min:%d avg:%d max:%d count:%d\n",
         @min(samples), @avg(samples),
         @max(samples), @count(samples))
  delete samples
}

probe end
{
  print(@hist_log(all_samples))
  printf("min:%d avg:%d max:%d count:%d\n",
         @min(all_samples), @avg(all_samples),
         @max(all_samples), @count(all_samples))
}

As a gist: https://gist.github.com/4078925

-- 
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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to