8

Let's say you are making a website (something like Facebook). You write code, deploy it on servers, and increase servers as your load increases. These servers are behind a load-balancer and requests can pretty much go to any server, at random.

But let's say you are making something like Firebase. Now on firebase, you can create an application, and you get a subdomain <app_name>.firebase.com. While your server code is still the same for all the applications, but requests for app1.firebase.com will go to dedicated set of servers, different from app2.firebase.com. So, load from one app, can't affect another, as it should be.


How is something like Firebase designed, more specifically, in the interest of limiting the scope of question, how are requests routed to a particular set of hosts for each application?

Jatin
  • 14,112
  • 16
  • 49
  • 78
  • 1
    Very interesting question, but unfortunately also incredibly broad (and thus likely out of scope on Stack Overflow). If you have a specific piece that you're interested in (such as how you'd direct connections to the correct server), you'd probably do best to edit your question to limit the scope to that piece. – Frank van Puffelen Feb 15 '16 at 12:53
  • @FrankvanPuffelen I have reduced the scope of question down to request routing. – Jatin Feb 16 '16 at 07:04
  • @FrankvanPuffelen I have started a bounty on this question! Considering your work, you might be able to provide an authoritative answer here. Thanks! – Jatin Feb 19 '16 at 10:16
  • are you looking for reverse proxies? http://stackoverflow.com/questions/10273291/horizontal-scaling-routing-user-generated-subdomains-between-servers – luchaos Feb 26 '16 at 01:00

1 Answers1

3

Generally, the "app" as you calling it is actually a subdomain or virtual host. This is accomplished via a few technology stacks.

First you need a DNS record fo the subdomain. So app.somedomain.com has to have a IP address that is resolveable on the internet and an Alias record (or A Record) is created that points to that subdomain. Once that is complete you configure a web server, typically apache or nginx to handle the subdomain via what is called a virtual host. You should consult the specific documentation for each technology but for apache server its most basic configuration would look something like this:

<VirtualHost *:80>
   ServerName app.somedomain.com
   ServerAdmin webmaster@app.somedomain.com
   DocumentRoot /var/www/app.somedomain.com/
</VirtualHost>
Griff
  • 1,796
  • 3
  • 23
  • 48
  • 1
    I don't think there would be any manual file-based configuration involved like that in case of something like Firebase. – Jatin Feb 22 '16 at 12:19
  • 2
    I don't use Firebase, but this is how the rest of the internet works, – Griff Feb 22 '16 at 16:15