1
10 Comments

Is it wise to split project in different subdomain/servers for different areas?

Just that.

I am working in a project that (been the same code base) , has different working areas. I might put all in one place, but I think it could lead to problems as it grows. On the other hand, setting different servers also mean more work although at least knowing its a manageable size.

Technically, I had this 2 choices, and once I choose there is no easy going back.

I can't decide.

Any thought on this?

on February 13, 2021
  1. 1

    If your application does any kind of heavy processing or performs lengthy tasks, then it's a good idea to offload these tasks to a background task and split your app that way.

  2. 1

    If you don't have a clear estimate of the expected load, I would recommend running a load test / stress test on your app to see which part will fry the server first.
    This will give you the opportunity to better understand your code, and maybe optimize many of its blocks.

    Despite I highly recommend it, but in many cases we lack the capacity or the time as we need to swiftly spin our products (and we do pull our hair later :D or pay additional money for the additional resources) but in real life, this happens.

    Database:
    If the database is involved, and is one of the resource hogs, I would load it into a scalable Cloud SQL.

    Static
    If you have an amount of static content, I would load them into Cloudflare.com pages or Render.com - and call them over a sub-domain.
    Images:
    I would load them all to Cloudinary or CDN buckets
    Heavy Process?
    How about cloud functions?

    Cloud providers are generous with the free tiers, make sure to tear that up before using your paid resources. ;)

    The more you elaborate on your project and codebase, the more we would be able to suggest cost-effective ideas to get you running.

    1. 1

      Thanks for your answer.
      Any suggestion about how to perform the load test?

      1. 1

        What's your stack?

        1. 1

          Vanilla Ruby on Rails. Nothing extra but Bootstrap, StimulusJS and just that.

          1. 1

            I'm not particularly well versed with RoR but their documentation seem to be comprehensive https://guides.rubyonrails.org/v3.2.13/performance_testing.html

  3. 1

    Only reason that I would think about separating software on more servers is if software is resource heavy, use a lot of calculations or anything that hogs processor and memory power to the point of halt. Otherwise I would keep everything on same place, mostly because it's easier to organize. I don't even use subdomains, when I need to separate something I use another folder (domain .com/another)

    1. 1

      What about a lot of traffic?
      Like a heartbeat function for a big IoT network.

      1. 2

        It depends of what those "heartbeats" are triggering, fetching, logging or whatever (I don't know your setup) and how much server resources are they consuming. If those are mass-consumer iot devices I assume that at some point it will be thousands or tens of thousands of active devices demanding their quick connections at fast rate, so I am guessing that you would probably need more powerful infrastructure or really good scalable cpu/ram setup.

        1. 1

          Mostly database tables touch.

          Right now, it is still a working prototype and it is supposed to be workin in production by June.

          I use Rails, and I give coverage to a network of little towns that could reach ten of thousands of devices.