Reputation: 15385
How do I make Play framework use all the 64 cores on the machine. No matter whatever I configure, I could not make my Play webapp use all the 64 cores. Is there a specific setting that I should focus on? Please help!
Currently, I have the following configured:
play {
akka {
event-handlers = ["akka.event.slf4j.Slf4jEventHandler"]
loglevel = WARNING
actor {
default-dispatcher = {
fork-join-executor {
parallelism-factor = 10.0
parallelism-max = 64
}
}
}
}
}
internal-threadpool-size=64
iteratee-threadpool-size=64
When I look at the machine processes, I could see that only one third of the processor cores are utilized. Is there any other setting that I could do so that all 64 cores are used?
What we have is a WebSocket endpoint in one of our Play controller in a non blocking mode uisng the WebSocket.Async call. To load test this WebSocket endpoint, I have a simple client that uses Akka to dynamically create multiple Actor instances. Each of those Actor instance creates a new WebSocket connection and sends a couple of thousands of messages.
Both the number of messages that will be sent via a single WebSocket connection and the total number of Actor instances are configurable. This way, I can really load test my WebSocket endpoint exposed by the Play framework.
But no matter whatever I do, I do not see the server utilizing all of its cores. This literally slows down our performance. Any suggestions on which configuration in the Play framework could be tweaked to make sure that all the 64 cores are used during heavy load?
Here is what I see when Play framework loads up (from the log file):
play {
# merge of application.conf: 7,reference.conf: 8
akka {
# application.conf: 9
loglevel=WARNING
# application.conf: 8
"event-handlers"=[
# application.conf: 8
"akka.event.slf4j.Slf4jEventHandler"
]
# merge of application.conf: 10,reference.conf: 12
actor {
# application.conf: 11
"default-dispatcher" {
# application.conf: 13
"fork-join-executor" {
# application.conf: 15
"parallelism-factor"=2
# application.conf: 14
"parallelism-min"=8
# application.conf: 16
"parallelism-max"=256
}
# application.conf: 12
executor="fork-join-executor"
}
# reference.conf: 13
retrieveBodyParserTimeout="1 second"
}
}
}
Upvotes: 0
Views: 1188
Reputation: 26579
Actual used number of threads is parallelism-factor * availableProcessors bounded by min and max. As per the documentation:
" # This will be used if you have set "executor = "fork-join-executor"" fork-join-executor { # Min number of threads to cap factor-based parallelism number to parallelism-min = 8
# The parallelism factor is used to determine thread pool size using the
# following formula: ceil(available processors * factor). Resulting size
# is then bounded by the parallelism-min and parallelism-max values.
parallelism-factor = 3.0
# Max number of threads to cap factor-based parallelism number to
parallelism-max = 64
}
" - http://doc.akka.io/docs/akka/2.2.3/general/configuration.html
Upvotes: 1
Reputation: 3449
You're telling Akka that each processor can have 10 threads but capping the total number of threads at 64.
You can lower the parallelism-factor
or raise the parallelism-max
(obviously doing load testing to see which one actually performs better for your app).
Upvotes: 0