DEV Community

YJDoc2
YJDoc2

Posted on • Edited on

How to decide server specifications for a docker Project?

Hello!

My friends and I are working on a project which allows people to send code and input to the server where it will be compiled and run. Then the output/errors will be sent to the user.

We had initially done the whole setup using only node but while testing, it became overloaded and crashed, as the compilation was taking time and node being single threaded combined with having about 120 websockets connected at a time.

Hence we changed the setup,and now the current setup is a react frontend + express on backend for primary user interactions, and for compiling and running we are using a basic flask server (which is not exposed to users), in which using subprocess module of python we are running the compiler process.

The basic flow is that user will send request for compiling along with input to express server. Then the code and input will be forwarded to flask server internally, which will start a subprocess and immediately return to express server. After the compiling and running, ( with a predefined timeout in case user submits an infinite loop ) the subprocess will make a request to express server, which is then forwarded using websocket to react frontend.

The current use of this will be done for 20-25 (non-consecutive) days in a whole year, and at those times we are expecting about 300 simultaneous users.

We have containerized the express and flask server and planning on deploying using docker-compose with one instance of express server and 4-5 instances of flask servers, an internal net, and two or three mounted volumes.

Our main concern here is that the server should be able to maintain the 300 user websockets along with ui, without crashing.

For this we are considering a full server platform like digital ocean or MS Azure.

Can you give any tips or rule-of-thumb to decide the server specifications that will be required for this project, as we have never deployed on such platforms?

Thank you!

Top comments (2)

Collapse
 
rubenwap profile image
Ruben Sanchez

The exact resources are hard to estimate without knowing the app, but if you are hitting the blocker of your app crashing by lack of resources, you can deploy it in a platform such as MS Azure or Google Cloud which can use auto scaling features. When auto scaling you can choose whether you want vertical scaling (your machines will be more powerful) or horizontal scaling (you will add more machines). For your use case, if you run out of capacity when the connections grow, I would say you can experiment with horizontal scaling. Take a look at this docs.microsoft.com/en-us/azure/arc...

Collapse
 
yjdoc2 profile image
YJDoc2

Hey,
Thanks for the help 😁
That link is really useful 👍