Playing thread architecture

Play is described as a “reactive” framework, which is very useful for asynchronous programming. I want to know more about the architecture of Play, mainly:

> Does it have an event loop?
>Does it have many akka actor systems? Do they have many thread pool support?
>If so, how many thread pools are there, what are their goals (routing, request processing, promise redemption, anorm, etc.)
>which is the execution thread we can block (where can we do some Expensive calculations)? Which thread of execution should we never block?

Any resources/wikis/suggestions are very useful. Thank you

Note: The following content applies to Play! 2.1.x. Play for…! 2.0.4 See nico_ekito’s answer.

The interaction with customers can be summarized through the following chart:

Play’s HTTP handler (built on Netty) exists in itself In the execution context of the .When it receives a request, it will try to find the entry point of the application based on the URL (using the application’s conf/routes file). At this time, only the header of the HTTP request It is loaded into memory.

Then, the entry point is called. It is usually an action, and if there is one, it will load the remaining body. This happens in a different execution environment, Play! The “user” execution context is defined as the Akka actor scheduler that can be configured in the application’s conf/application.conf file.

Finally, inside the action, you can perform asynchronous calls (for example, call Web Service). All these asynchronous calls use Scala’s Future API, so they use the available execution context within the calling site. So you can use Play! “User” execution context (defined in play.api.libs.concurrent.Execution.defaultContext).

In short, play! Use different execution contexts for the following tasks:

>receive request (Netty HTTP handler);
>call operation (“user” execution context).

You are free Use any execution context you want for asynchronous calculations (including Play! “user” execution context).

The idea is that all user code uses Play by default! “User” execution context. If you block it, you will not be able to run more user code, but you can continue to perform all other operations.

If you are doing extended calculations, I recommend that you use a dedicated execution context.

Play is described as a “reactive” framework, which is very useful for asynchronous programming. I want to know more about the architecture of Play, mainly:

> Does it have an event loop?
>Does it have many akka actor systems? Do they have many thread pool support?
>If so, how many thread pools are there, what are their goals (routing, request processing, promise redemption, anorm, etc.)
>which is the execution thread we can block (where can we do some Expensive calculations)? Which thread of execution should we never block?

Any resources/wikis/suggestions are very useful. Thank you

Note: The following content applies to Play! 2.1.x. Play for…! 2.0.4 See nico_ekito’s answer.

The interaction with customers can be summarized through the following chart:

Play’s HTTP handler (built on Netty) exists in itself In the execution context of the .When it receives a request, it will try to find the entry point of the application based on the URL (using the application’s conf/routes file). At this time, only the header of the HTTP request It is loaded into memory.

Then, the entry point is called. It is usually an action, and if there is one, it will load the remaining body. This happens in a different execution environment, Play! The “user” execution context is defined as the Akka actor scheduler that can be configured in the application’s conf/application.conf file.

Finally, inside the action, you can perform asynchronous calls (for example, call Web Service). All these asynchronous calls use Scala’s Future API, so they use the available execution context within the calling site. So you can use Play! “User” execution context (defined in play.api.libs.concurrent.Execution.defaultContext).

In short, play! Use different execution contexts for the following tasks:

>receive request (Netty HTTP handler);
>call operation (“user” execution context).

You are free Use any execution context you want for asynchronous calculations (including Play! “user” execution context).

The idea is that all user code uses Play by default! “User” execution context. If you block it, you will not be able to run more user code, but you can continue to perform all other operations.

If you are doing extended calculations, I recommend that you use a dedicated execution context.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2917 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.