Removing latency spikes. Garbage collector related?

Will Sewell me at
Tue Sep 29 09:15:41 UTC 2015

Thanks for the reply John. I will have a go at doing that. What do you
mean exactly by dumping metrics, do you mean measuring the latency
within the program, and dumping it if it exceeds a certain threshold?

And from the answers I'm assuming you believe it is the GC that is
most likely causing these spikes. I've never profiled Haskell code, so
I'm not used to seeing what the effects of the GC actually are.

On 28 September 2015 at 19:31, John Lato <jwlato at> wrote:
> Try Greg's recommendations first.  If you still need to do more
> investigation, I'd recommend that you look at some samples with either
> threadscope or dumping the eventlog to text.  I really like
> ghc-events-analyze, but it doesn't provide quite the same level of detail.
> You may also want to dump some of your metrics into the eventlog, because
> then you'll be able to see exactly how high latency episodes line up with GC
> pauses.
> On Mon, Sep 28, 2015 at 1:02 PM Gregory Collins <greg at>
> wrote:
>> On Mon, Sep 28, 2015 at 9:08 AM, Will Sewell <me at> wrote:
>>> If it is the GC, then is there anything that can be done about it?
>> Increase value of -A (the default is too small) -- best value for this is
>> L3 cache size of the chip
>> Increase value of -H (total heap size) -- this will use more ram but
>> you'll run GC less often
>> This will sound flip, but: generate less garbage. Frequency of GC runs is
>> proportional to the amount of garbage being produced, so if you can lower
>> mutator allocation rate then you will also increase net productivity.
>> Built-up thunks can transparently hide a lot of allocation so fire up the
>> profiler and tighten those up (there's an 80-20 rule here). Reuse output
>> buffers if you aren't already, etc.
>> G
>> --
>> Gregory Collins <greg at>
>> _______________________________________________
>> Glasgow-haskell-users mailing list
>> Glasgow-haskell-users at

More information about the Glasgow-haskell-users mailing list