-1

I want to understand how many actors the default settings (execution context) that play ships with will create when responding to requests?

Once this maximum number of actors is reached, what will happen to requests that don't get served? Will they block up to a certain point? Do browsers timeout after x seconds or is this a tcpip timeout?

cool breeze
  • 4,461
  • 5
  • 38
  • 67
  • 2
    I'm not convinced this is the right mental model. Requests can be shared across actors. [This question and answers may be helpful](https://stackoverflow.com/questions/8113468/akka-how-many-instances-of-an-actor-should-you-create). Of course, at some point you may hit the max number of open connections possible for a given process (constrained by OS file handles / limits etc.) and would need to scale out. When you reach this limit, no more incoming connections could be made. – w08r Feb 20 '20 at 21:53

1 Answers1

1

Some information that may help you understand things a little more. You should probably think in the context of threads though, not actors, for the purpose of your question.

The default backend is Akka HTTP (previous versions - prior to 2.6 I think - shipped with Netty by default, which is still available in later versions as a configurable alternative backend to Akka HTTP).

Play's default execution context is configured to pool 1 thread per processor core. The docs state processor but more specifically it is per core. The assumption is that you are building your application in a purely asynchronous and non-blocking fashion though - core tenets of Play's architecture. If you need to do blocking work (notably synchronous IO) then you explore the concept of having a custom pool where you control the number of threads available, and/or multiple pools which provides you with a way to isolate your blocking work from your non-blocking etc - please refer to the docs.

If your thread pool(s) is/are exhausted then subsequent requests will stack up. Default timeout configuration settings can be found by consulting the play docs, or more specifically, the Akka HTTP config.

jacks
  • 4,614
  • 24
  • 34