Contention in PoolArena

342 views
Skip to first unread message

timv...@gmail.com

unread,
Jun 15, 2015, 3:28:49 PM6/15/15
to ne...@googlegroups.com
Hello folks,

I've been doing some profiling (using yourkit) of Vert.x 3 under heavy load.

We're using pooled direct buffers.

Yourkit is detecting monitor contention on PoolArena.allocateNormal as its being called concurrently by more than one Vert.x event loop.

Just wondering if you have any hints for tuning pool buffer allocation to reduce contention?

Maybe each Vert.x event loop can be configured to have its own allocator to avoid contention altogether?

Norman Maurer

unread,
Jun 16, 2015, 12:07:29 AM6/16/15
to ne...@googlegroups.com, timv...@gmail.com
Hey Tim,

You could increase the number of arenas. Thst said, this will increase memory ussge. So it's always a trade-off.

Bye,
Norman

timv...@gmail.com

unread,
Jun 16, 2015, 3:09:59 AM6/16/15
to ne...@googlegroups.com, timv...@gmail.com
Hi Norman,

I figured as much. I've set num arenas to be > number of event loops and this pretty much eliminates contention.

Interestingly, I see Netty defaults to 2 * runtime.availableProcessors() for number of event loops, but only runtime.availableProcessors() for default number of arenas.

So, with the defaults an arena is shared by two event loops and contention is more likely.

Norman Maurer

unread,
Jun 16, 2015, 3:15:41 AM6/16/15
to ne...@googlegroups.com, timv...@gmail.com
I agree we may should increase the number of arenas.

jemalloc even use 4 x number of cpus:


"opt.narenas" (size_tr-

Maximum number of arenas to use for automatic multiplexing of threads and arenas. The default is four times the number of CPUs, or one if there is a single CPU.


Would you mind open an issue and i will pick up before next release?



--
You received this message because you are subscribed to the Google Groups "Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netty+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netty/4f36fcf4-d1da-4d86-bec3-f062fa35a0f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages