How is the performance under concurrent requests?

Asked by Chris Lu

I ran a simple page and test the performance.
 ab -n 1000 -c 1 "http://...."
 ab -n 1000 -c 2 "http://...."
 ab -n 1000 -c 10 "http://...."
However, the "time taken for tests" seems a constant number, even on a multi-core CPU.

The page is very simple and no shared resources are used.

Is Play! using any thread pool to process the requests? If so, how to configure it?

Question information

Language:
English Edit question
Status:
Answered
For:
play framework Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jean-Francois POUX (jfp-taldius) said :
#1

Hi,

Play's http server is asynchronous: it will only use small fixed amount of threads regardless of the load you have. When the requests are decoded, they are processed from the same calling thread when running Play! in dev mode, from a wait queue+thread pool when running Play! in prod mode (see play.Invoker).

When running in production mode, the interresting parameters to control the behaviour of invoker are:

play.pool.queue: number of request wait queue.
play.pool.core: minimal number of threads in the processor pool
play.pool.max: maximal number of threads in the processor pool

play.pool.core and play.pool.max should be set to [number of cpu in your machine] + 1, that should be optimal if your code (controller, etc...) do not rely on blocking code. If you have things like slow network interactions, you might want to consider increasing theses values.

Have you tried running play in production mode ? You can do so by changing application.mode=dev to application.mode=prod in your application conf/application.conf file.

Can you help with this problem?

Provide an answer of your own, or ask Chris Lu for more information if necessary.

To post a message you must log in.