Search code examples
performanceserverload

Regarding servers, when should a process be moved to another server instead of on the same?


Say I have one server. Its job is serving requests for views to my front end. The database is connected to it and what not.

Say I wanted to also have a program that takes user uploaded images and then allows a user to modify the image via an api?

When would running both of those programs on the same server be a good idea? A bad idea? Is there something else that determines when a program be placed on a separate server?

example. I have a django app (python) running on one server in heroku. The App is serving a restful api. I have image hosting being done on s3 with a direct to browser upload.

I want to at some point allow the user to upload their images to my server for processing before they upload them to s3. Perhaps they want to resize the image, crop it etc. My worry is that having both done on the same server at a significant scale would be bad design. Am I wrong?


Solution

  • I will try to give a few helpful pointers, but your question is so overly broad it will be difficult. The things you're asking are design questions where the answers vary wildly depending on things like:

    • Which language/frameworks you are using.
    • Caching or not caching.
    • Security needs (e.g. is it necessary to isolate the processes for modifying the images from the view interface threads/requests). This might be due to limitations in your framework or caching infrastructure, for example.
    • Do you have server availability to isolate those processes.

    System architects usually get paid good money to figure out the answers to these questions based on the specific implementation needs.

    If you give us more specifics, we might be able to better help.


    Updated info based on your python examples:

    I don’t know much about django/heroku specifically, but your example helps. In general, running both of these apps from the same server should be fine, at least initially. As long as the server isn’t overloaded from CPU/IO overhead, and the apps are deployed as separate apps (to protect their processes from each other), things should work fine.

    This covers the two most common problems with sharing a server:

    1) General server overload (hardware can't handle the CPU/IO needs)

    2) App processes need isolation to protect against various programming errors and security issues caused by possible shared access to the environment.

    One additional note: I noticed deploying multiple apps in Heroku can be a problem if you're using multiple domains, so keep that in mind. I'm not sure if it's still true, but here's a link:

    https://pilot.co/blog/hosting-multiple-heroku-apps-on-a-single-domain/

    I hope that helps.