I know optaplanner scales very well wrt problem size. But how can it scale wrt the number of problem requests? Currently, we have exposed optaplanner as a REST service. It can get hundreds of scheduling requests per day. Search is stopped after 10 seconds. This means that at some peaks there are several scheduling requests in the queue. What could we do to parallelize the requests on multiple machines?
Asked
Active
Viewed 1,046 times
1 Answers
3
All low-level support for a multi-tenant setup (on a cluster) is available:
- The
SolverFactory
is thread safe, 1 per node - 1
Solver
per thread per node. Because a singleSolver
hogs a singleThread
(it does not do any IO, unlike web requests etc), I recommend against running more Solvers than there are Threads. Solver.terminateEarly()
is thread-safe and can be called on allSolvers
if the node is exiting.
However, there is no high-level support for a multi-tenant setup yet. So you 'll need to build that yourself:
- Queue requests to be handled, in case more requests come in than threads are available. A JDK
ExecutorService
with the size of the number of CPU cores should suffice for this. Simply submit the requests asFuture
's. Build the Solver in the Future. Build the SolverFactory at bootstrap. - Optionally play with allowing more/less time depending user saturation.
terminateEarly()
can help in this regard. - Load balancing over nodes of the cluster. Each cluster has 1
ExecutorService
. - Work stealing?
- High-availability
- Failover
- ...
We 'll build high-level support in the future. Please add your requirements in this jira issue.

Geoffrey De Smet
- 26,223
- 11
- 73
- 120
-
Thanks! Is optaplanner 7.0 still for 2015? Given your last comment on https://issues.jboss.org/browse/PLANNER-76 – truem Apr 05 '15 at 20:36
-
As they say in software development "it's out when it's out"... Discussing the release date of 7.0 before 6.3.0.CR1 is out, is at best a guestimation, because the scope of features isn't frozen yet. Product management is still influencing that scope a lot, based on BRMS customer requests. – Geoffrey De Smet Apr 06 '15 at 09:44