javavert.xvertx-verticlevertxoptions

How to apply concurrent processing on worker verticles using vert.x


Vert.x docs mentioning this : By default worker verticle instance will only be executed by one thread at any one time (it is not concurrent).

So that means that if I have Verticle with 20 instances e.g:

 vertx.deployVerticle(PotEventConsumerVerticle.class.getName(),
                new DeploymentOptions()
                        .setWorker(true)
                        .setInstances(20)

I wont be able to get concurrent processing of requests?

how could I concurrent this processing ? I saw that Multi-threaded worker verticles can be an option but Vert.x doc mention to avoid using this option by all means.


Solution

  • If you deploy 20 instances of a worker verticles, the maximum concurrency will be 20.

    Each instance will handle events one after the other, but the 20 instances altogether can handle 20 events in parallel.