What happens internally when we create multiple instances of standard and worker verticle?

Lets say we create a standard verticle and a worker verticle. Now we increase the instances to 2 each. So when lets say 10 users requests at a time what happened previously and what will happen now internally ?


Solution 1:

When a request comes in, Vert.x will pick up in a round-robin manner one of the two event loop verticles, that, as the name suggests, will run on the event loop thread pool. The size of the event loop thread pool is x2 number of CPUs. In case there are more verticles than EventLoop threads, some or all threads will have to context-switch.

The same will happen with the worker verticles, but those are run on a different thread pool, which is not work-stealing.

Vert.x will work the same, but in case of a single instance, it won't have anything to pick from.

Worker instances and worker thread pool are separate. How many threads there are depends on the pool. By default, the number is 20.