Limiting ThreadPool Size Play 2.5.x

60 views
Skip to first unread message

ase...@gmail.com

unread,
Nov 15, 2017, 11:17:20 PM11/15/17
to Play Framework
Hello, 

I'm using Play 2.5.x and I noticed that many of thread pools can be very large +70 each for Async http client and Netty Server

I'm hoping someone can point me in the right direction or provide some advice on what the correct approach is here.

Basically I'm trying to use play packaged in a docker image but the problem is that many of thread pools used are based on the number of processors on a machine. This varies a lot for us from environment to environment, where some environments have 4 others have 36.

The pools often seem to be based off these formula threads = 2 x N where N is number of processors. Is there a way to configure this differently so that thread pool size is consistent and would not vary from deployment to deployment.

Specifically for 
Akka,
WSClient (AsyncHttpClient)
and Netty.


Mariot Chauvin

unread,
Nov 16, 2017, 7:40:13 AM11/16/17
to play-fr...@googlegroups.com
Hi,

Have a look to the documentation about it: https://www.playframework.com/documentation/2.5.x/ThreadPools
Regards,

Mariot

--
You received this message because you are subscribed to the Google Groups "Play Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/17946643-eef7-4c1d-9509-d2bbe4ed25ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



This e-mail and all attachments are confidential and may also be privileged. If you are not the named recipient, please notify the sender and delete the e-mail and all attachments immediately. Do not disclose the contents to another person. You may not use the information for any purpose, or store, or copy, it in any way.  Guardian News & Media Limited is not liable for any computer viruses or other material transmitted with or as part of this e-mail. You should employ virus checking software.
 
Guardian News & Media Limited is a member of Guardian Media Group plc. Registered Office: PO Box 68164, Kings Place, 90 York Way, London, N1P 2AP.  Registered in England Number 908396


Marcos Pereira

unread,
Nov 16, 2017, 8:27:49 AM11/16/17
to play-fr...@googlegroups.com
Hi, 

For Play and Akka, you may configure the default thread pool according to your needs:


For AsyncHttpClient, we don't expose a configuration, but you can replace the default bindings with your own, providing an AsyncHttpClientConfig with what you need:


But I would say that if the environment changes and have more or fewer processors, why not let the application adapts to it? If you are using the same number of threads in an environment with 4 or 36 threads, you are just wasting resources. What problems are you observing?

Best.

--
You received this message because you are subscribed to the Google Groups "Play Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/17946643-eef7-4c1d-9509-d2bbe4ed25ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Marcos Pereira
Software Engineer, Lightbend.com

Koen De Groote

unread,
Nov 16, 2017, 4:26:46 PM11/16/17
to Play Framework
Just want to link this older thread: https://groups.google.com/forum/#!topic/play-framework/mrx2CUR8U2A

I got that in the comments of any project I make, since it's easy to forget.

To quote: There's a gotcha with the fork-join-pool: parallelism-max does not cap the maximum amount of threads. What you configure with a fork-join pool is the amount of maximum *hot* threads. if you want to really cap the amount of threads you need to use a fixed pool
Reply all
Reply to author
Forward
0 new messages