Eventloop thread count not matching number of cores.

262 views
Skip to first unread message

Billy Yarosh

unread,
Dec 22, 2014, 1:39:26 PM12/22/14
to ve...@googlegroups.com
Is there stronger documentation around how Vert.x determines the number of eventloop threads it starts? According to the docs it's one per CPU core. I am on an Intel i7 and am seeing 16 eventloop threads. I also notice that thread 0 is never used by any verticle. Why is that? My i7 claims to be 4 cores with 8 threads.

Billy Yarosh

unread,
Dec 23, 2014, 12:32:11 PM12/23/14
to ve...@googlegroups.com
I have reviewed the code and it looks like event loop thread are created with the algorithm: (2 * "available cores")

public static final int DEFAULT_EVENT_LOOP_POOL_SIZE = 2 * Runtime.getRuntime().availableProcessors();


In my case, my processor is 4 cores, but supports 8 thread. 8 is then what
Runtime.getRuntime().availableProcessors();
responds with.
  

Tim Fox

unread,
Dec 24, 2014, 4:20:27 AM12/24/14
to ve...@googlegroups.com
On 23/12/14 17:32, Billy Yarosh wrote:
I have reviewed the code and it looks like event loop thread are created with the algorithm: (2 * "available cores")

public static final int DEFAULT_EVENT_LOOP_POOL_SIZE = 2 * Runtime.getRuntime().availableProcessors();

Yes, we use 2 * number of cores by default - in practice this gives better results as OSes don't always distribute threads evenly across cores.




In my case, my processor is 4 cores, but supports 8 thread. 8 is then what
Runtime.getRuntime().availableProcessors();
responds with.
  

Docs look ok to me :)

Note, it says " The default size is determined by the number of cores" not " The default size is equal to the number of cores"

I.e. it's a *function* of the number of cores N, f(N)


On Monday, December 22, 2014 1:39:26 PM UTC-5, Billy Yarosh wrote:
Is there stronger documentation around how Vert.x determines the number of eventloop threads it starts? According to the docs it's one per CPU core. I am on an Intel i7 and am seeing 16 eventloop threads. I also notice that thread 0 is never used by any verticle. Why is that? My i7 claims to be 4 cores with 8 threads.
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Billy Yarosh

unread,
Dec 24, 2014, 10:24:16 AM12/24/14
to ve...@googlegroups.com
I think the docs are clear enough. The threading model is key to understanding Vert.X, so my initial question was if there were more specific documentation. When reading the docs, I was assuming the algorithm was threads = CPU cores. I think the docs are fair in that the algorithm should be implementation specific, but leading towards the core count as the fixed algorithmic factor.

Thanks
Reply all
Reply to author
Forward
0 new messages