Web unit and computing unit

So I managed to get my website working on a droplet (docker image with nginx, gunicorn, django). The website is still under development (I’m new to web development). The website is intended to be an interface for the user to interact with an finite element solver I wrote in C++. Each time the user hits the solve button, the C++ must be invoked to solve the problem. Now, solving such a problem can be time consuming as well as computationally expensive. So, I guess it wouldn’t be wise to host both the web and the app on one single droplet, since the website wouldn’t run smoothly anymore (is that correct?). So I thought to get another droplet which would take care of the computation part. Is this the right way of thinking? And if so, can I pass the input of the user from the web droplet to the computing droplet?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Thanks @bobbyiliev, this was helpful to understand the big picture (not familiar with kubernetes yet).

As I understand it, in this situation, my web on one droplet is considered as a frontend and my other droplet with the C++ app would be the backend. I would then send information forth and back by means of requests. Is that correct?

Hi there @michielfenaux,

I like the approach of keeping the different services separately, it’s kind of leaning to the whole microservices architecture. That way the services (your frontend and the computation service) would be loosely coupled and independently deployable, so in case that the computation service goes down due to overload, your website would still remain running.

Actually this would be your approach even if you go for Kubernetes for example, you would have your different services, packaged into Docker images, and deployed as separate services to the cluster.

Of course, you could always have all of the components on a single Droplet in the beginning and later scale with a few Droplets.

Passing the input from your website to the backend service which would be doing the computation could be done through an API. For example, on the backend service, you could expose an endpoint that expects a certain payload, and then you could just hit that API endpoint with a POST request including the necessary parameters from your frontend.

Hope that this helps! Regards, Bobby