Hey guys,
I have an application where I expect many clients to connect to via TCP. So
my design is the following. I have these two actor-types:
* Server-Actor - Accepts incoming TCP connections (Uses Reactive TCP -
Stream). Per incoming request i spawn a new "ClientSession" - actor
instance.
* ClientSessionActor - This actor handles all the inside like session -
managment (Uses Akka FSM). It also setups a network-Flow (Using reactive
streams) that reads the incoming data.
So far so good. Now the problem I am facing that I have 100% CPU Load after
a short while. I could reproduce the problem by putting a Loadbalancer in
front which constantly makes a new TCP Connection to the application. I
attached JConsole and VisualVM to it and found out that it seems to spawn a
new thread per connection (new akka-default-dispatcher-<nr> keep popping
up). Here is how i spawn my "ClientSession" - Actor:
val props =
FromConfig.withDispatcher("network-dispatcher").props(Props[ClientSessionActor])
val actorRef = context.actorOf(clientProps, Server.generateClientPath())
Here is my config:
network-dispatcher {
type = "Dispatcher"
executor = "fork-join-executor"
# configure the thread pool
fork-join-executor {
# Min Threads
parallelism-min = 1
# Max Threads
parallelism-max = 1
# factor =
parallelism-factor = 1.0
}
# Throughput defines the maximum number of messages to be
# processed per actor before the thread jumps to the next actor.
# Set to 1 for as fair as possible.
throughput = 1
}
Is there a way to get around this? I would either prefer to have a fixed amount
of "threads" that do the work. Or it intended that every Flow is doing his work
in it's own thread? If yes is there
a way to fix this? I though about using "one" network-flow. But that seems to
be problematic when using TLS as security layer inbetween that is the reason
why I have one materialzted "flow" per connected client.
Regards,
Thomas
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.