Round Robin for handlers?

305 views
Skip to first unread message

mathias

unread,
May 1, 2015, 6:26:27 AM5/1/15
to ve...@googlegroups.com

I have three questions:

1. Are verticles always executed on the same event loop in which they have been initialized?
2. Is there some round robin mechanism for picking up handlers from the pool of verticle instances independent of their event loop?
3. Does the following picture contain a mistake?


Tim Fox

unread,
May 1, 2015, 12:22:19 PM5/1/15
to ve...@googlegroups.com
Hi Matthias,

Julien wrote a good article on this recently... if you search back in this group you'll find the link. There's also some info in the Vert.x 3 docs on this :)


On 01/05/15 11:26, mathias wrote:

I have three questions:

1. Are verticles always executed on the same event loop in which they have been initialized?


Standard verticles: yes.

2. Is there some round robin mechanism for picking up handlers from the pool of verticle instances independent of their event loop?


Not sure I understand this question.


3. Does the following picture contain a mistake?


Not sure I follow what this represents.. sending a message on the event bus?


--
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.

mathias

unread,
May 1, 2015, 1:51:50 PM5/1/15
to ve...@googlegroups.com
Yes. I mean verticle A sends messages over the event bus to verticle B.

Regarding the docs vert.x takes care about threading and scaling automatically. Currently I like to understand what scaling in the sense of a single vert.x instance actually means.
In the sense of a cluster it means delivering messages in a round robin fashion between different vert.x instances. But within a single vert.x instance there might run multiple instances of the same verticle. So how is that choice made by vert.x?

Thank you for hint on an arcticle from Julien. I'll try to find it.


Jordan Halterman

unread,
May 2, 2015, 5:21:56 AM5/2/15
to ve...@googlegroups.com


On May 1, 2015, at 3:26 AM, mathias <roleba...@gmail.com> wrote:

I have three questions:

1. Are verticles always executed on the same event loop in which they have been initialized?

For non-worker verticles, yes. But handlers registered in worker verticles may be called on some variety of threads in the worker pool.

2. Is there some round robin mechanism for picking up handlers from the pool of verticle instances independent of their event loop?

Yes. Round robin is not just with regard to ha flees registered in other Vert.x instances (in a cluster). Vert.x is location transparent, so any behavior you would see locally you should expect to see in a cluster and vice versa.

3. Does the following picture contain a mistake?

It seems to make sense to me!

To clarify, a handler registered within an event loop verticle will indeed always be executed on that verticle's event loop.

Julien Viet

unread,
May 2, 2015, 8:06:23 AM5/2/15
to ve...@googlegroups.com, Jordan Halterman
here is the doc updated with Jordan’s feedback :-) (and I realise I said big mistakes in the worker section based on his review)



-- 
Julien Viet
www.julienviet.com

mathias

unread,
May 3, 2015, 8:03:51 AM5/3/15
to ve...@googlegroups.com
Thank you Julien. The following output shows that neither the event loop context nor the thread id must be the same between sender and consumer. The sender verticle in count 5 uses thread 12, whereas the consumer verticle for count 5 uses thread 13:

















It matches all statements in your article. I was just not sure if event bus consumer must get executed on the same thread as the sender.
Reply all
Reply to author
Forward
0 new messages