Forepick
Forepick

Reputation: 937

Scaling worker pools in vert.x

I'm writing a clustered Vert.x application which uses, in its entry point, a pool of worker-verticles. These verticles are iterating endlessly, asking for tasks to execute, from a central persistent queue. This type of verticles is, of course, a worker-verticle, running in its own dedicated worker-pool.

I want to scale up and down the number of this verticles according the the number of pending tasks in the queue, but since a worker-pool has a constant size, I have no idea how to achieve such a behavior.

Is there any best-practice in which I could scale up and down the clustered worker-pool?

Furthermore - I'd like to add more VMs to my cluster as the total load on the system grows. Is there a built-in cluster-autoscaling support in vert.x?

Thanks

Upvotes: 0

Views: 1584

Answers (1)

adamM
adamM

Reputation: 1156

I don't think it is possible to re-scale the worker pool size via a vertx api, but the worker pool is just a standard FixedThreadPool executor service. You can replace that executor service with another instance. Look into the various Executor services that Java has and see if it fits your need.

See this post about changing the ExecutorService : multithreading within vertx

Upvotes: 1

Related Questions