Skip to content

Commit 6080abf

Browse files
committed
Custom dispatcher for api execution context
1 parent b51bb80 commit 6080abf

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

api/src/main/resources/application.conf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,21 @@ hmda {
7070
zookeeperPort = ${?ZOOKEEPER_PORT}
7171
}
7272

73+
api-dispatcher {
74+
type = Dispatcher
75+
executor = "fork-join-executor"
76+
fork-join-executor {
77+
# Min number of threads to cap factor-based parallelism number to
78+
parallelism-min = 2
79+
# Parallelism (threads) ... ceil(available processors * factor)
80+
parallelism-factor = 2.0
81+
# Max number of threads to cap factor-based parallelism number to
82+
parallelism-max = 10
83+
}
84+
# Throughput defines the maximum number of messages to be
85+
# processed per actor before the thread jumps to the next actor.
86+
# Set to 1 for as fair as possible.
87+
throughput = 100
88+
}
89+
7390

api/src/main/scala/hmda/api/HmdaPlatform.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ object HmdaPlatform {
3434
val system = ActorSystem(configuration.getString("clustering.name"), configuration)
3535
val supervisor = createSupervisor(system)
3636
val querySupervisor = createQuerySupervisor(system)
37-
implicit val ec = system.dispatcher
37+
implicit val ec = system.dispatchers.lookup("api-dispatcher")
3838

3939
startActors(system, supervisor, querySupervisor)
4040
startApi(system, querySupervisor)

0 commit comments

Comments
 (0)