Thanks for pointing this out Endre. At least I got an idea where I should 
look at



On Wednesday, April 20, 2016 at 11:14:06 AM UTC+2, Akka Team wrote:
>
> Hi Thomas,
>
> > 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: 
>
> Are you calling blocking calls somewhere? Nothing in Akka's TCP stack 
> creates new threads, they only create actors. The only reason why the 
> threadpool might create threads if you happen to use blocking. Try out the 
> same test with using a thread-pool-executor instead of the 
> fork-join-executor and see what happens.
>
> > Is there a way to get around this? I would either prefer to have a fixed 
> amount of "threads" that do the work. 
>
> Akka's IO support does not create threads, it uses thread-pools on which 
> actors are dispatched. Fork-join may launch compensating threads, 
> especially if there is blocking. Try out with thread-pool-executor and see 
> if the issue remains. If you call blocking calls then your application will 
> just hang with the thread-pool-executor.
>
> > Or it intended that every Flow is doing his work in it's own thread? 
>
> No.
>
> -Endre
>
>
>
> On Tue, Apr 19, 2016 at 3:48 PM, Thomas Zimmer <t.zi...@eslgaming.com 
> <javascript:>> wrote:
>
>> 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 akka-user+...@googlegroups.com <javascript:>.
>> To post to this group, send email to akka...@googlegroups.com 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Akka Team
> Typesafe - Reactive apps on the JVM
> Blog: letitcrash.com
> Twitter: @akkateam
>

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to