Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to tune the scalability of play framework app?
    text
    copied!<p>I am using Play framework 2.1 to develop my app. It is quite easy-to-use framework. I am able to develop my app quickly. But I also ran into some scalability issues. It seems the Play 2.1 doesn't run as fast as claimed. Maybe that is because I didn't know to tune the performance. </p> <p>My problem is following: I have an API to login a user with his/her email. </p> <p>I used Apache Benchmark (ab) to use the performance. One single request takes about 230ms. When there are 5 concurrent requests, the response time is still fast enough, about 280ms. </p> <pre><code>Concurrency Level: 5 Time taken for tests: 0.306 seconds Complete requests: 5 Failed requests: 0 Write errors: 0 Total transferred: 3495 bytes Total POSTed: 1065 HTML transferred: 3135 bytes Requests per second: 16.34 [#/sec] (mean) Time per request: 306.009 [ms] (mean) Time per request: 61.202 [ms] (mean, across all concurrent requests) Transfer rate: 11.15 [Kbytes/sec] received 3.40 kb/s sent 14.55 kb/s total Connection Times (ms) min mean[+/-sd] median max Connect: 1 1 0.1 1 1 Processing: 280 290 13.8 292 305 Waiting: 278 288 13.7 291 304 Total: 280 291 13.9 293 306 </code></pre> <p>However, when I used 100 concurrent requests, I got very bad results.</p> <pre><code>Concurrency Level: 100 Time taken for tests: 4.243 seconds Complete requests: 100 Failed requests: 0 Write errors: 0 Total transferred: 69900 bytes Total POSTed: 21300 HTML transferred: 62700 bytes Requests per second: 23.57 [#/sec] (mean) Time per request: 4243.058 [ms] (mean) Time per request: 42.431 [ms] (mean, across all concurrent requests) Transfer rate: 16.09 [Kbytes/sec] received 4.90 kb/s sent 20.99 kb/s total Connection Times (ms) min mean[+/-sd] median max Connect: 1 62 31.5 83 89 Processing: 996 3744 544.7 3902 4146 Waiting: 995 3727 542.0 3894 4146 Total: 1084 3806 542.6 3968 4204 </code></pre> <p>My server machine: Intel i7, 8 cores, 2.8GHz, 8GB memory. I used default setting of play framework. Anyone knows how to tune the performances of play framework? </p> <p>I think it relates to thread pool size. The document says play's default thread pool size is # cores. In that case, the expected time to handle all 100 requests is:</p> <pre><code>230ms * (100 / 8) = 2875ms </code></pre> <p>So, should I increase the size of default thread pool? But the document says I should get the best performance when pool size is equal to # cores.</p> <p>Also, will netty's (play's web server) thread pool size affect the performance? I didn't find any information about its default value. Anyone knows how it is configured?</p> <p>Thank you! </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload