1

I use PlayFramework 2.6 with Docker. I build and publish image with sbt:dockerPublish and then deploy it with Ansible to Amazon EC2 Instance. I want to get powerful instance for production and my question is:

Do I need to change configuration for docker and play to achieve best performance?

I want instance with 4 CPU cores and 16 GB RAM. I had issues before running Play on plain Ubuntu with 1GB RAM without swap, would I run into same memory issues with Docker even there will be 16GB?

2 Answers 2

2

I'm not familiar with PlayFramework outside of the quick web search I just did to see it's a Java MVC thing, but a Docker container by default will use up as much memory and compute as your instance has. Which seems like it would be a good thing in this instance, you're worried about Docker being conservative and not utilizing a bigger EC2 instance.

You can place hard or soft limits on container memory usage: https://docs.docker.com/engine/admin/resource_constraints/#limit-a-containers-access-to-memory

Once you get the container running on your instance ssh in and run docker stats, and you can track the resource usage of the container.

1

Memory

You'll need some memory for the OS—say 100MB. Inside the Java VM you'll need some basic memory for Play—say 32MB. The rest of the memory in your VM will depend on your application: how many concurrent users, how memory-intensive its work is, how much you've optimised it.

If your machine/VM/container has 1GB of RAM then set the Java VM max heap size to less than this using Java's -Xmx768M option so that you don't cause your machine to swap.

CPU

Play is designed to use all cores by default. If needed you can tune it further. The configuration is documented here:

https://www.playframework.com/documentation/2.6.x/ThreadPools#Configuring-the-default-thread-pool

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.