google cloud platform – Should I deploy my backend in a different VM from my frontend?

I’m trying to set up a staging environment for my web application using GCP. I deployed my frontend in a VM instance and set up a load balancer to serve https traffic. I set up a Dockerfile for my frontend that builds the frontend and serves the app using Nginx.

My frontend communicates to my Java backend through http calls. Should I deploy the backend in a separate VM instance using a different Dockerfile, or should I deploy it to the same VM that’s hosting my frontend? What are the pros and cons of each option?

Read more here: Source link