System Design Foundation

Single Server Setup

By Ayush Arora2 min read

A journey of a thousand miles begins with a single step, and building a complex system is no different. To start with something simple, everything is running on a single server: web app, database, cache, etc.

Single server setup

To understand this setup, it is helpful to investigate the request flow and traffic source. Let us first look at the request flow, shown in the figure below:

UserWeb browserMobile appDNS1api.mysite.com215.125.23.214Web server315.125.23.2144HTML page
  1. Users access websites through domain names, such as api.mysite.com. Usually, the Domain Name System (DNS) is a paid service provided by 3rd parties and not hosted by our servers.
  2. Internet Protocol (IP) address is returned to the browser or mobile app. In the example, IP address 15.125.23.214 is returned.
  3. Once the IP address is obtained, Hypertext Transfer Protocol (HTTP) requests are sent directly to your web server.
  4. The web server returns HTML pages or JSON response for rendering.

Next, let us examine the traffic source. The traffic to your web server comes from two sources: web application and mobile application.

GET /users/12 – Retrieve user object for id = 12

The server responds with a JSON object representing that user:

{
  "id": 12,
  "firstName": "John",
  "lastName": "Smith",
  "address": {
    "street": "123 Main St",
    "city": "Seattle",
    "state": "WA",
    "zip": "98101"
  }
}

With the growth of the user base, one server is not enough, and we need multiple servers: one for web/mobile traffic, the other for the database. Separating web/mobile traffic (web tier) and database (data tier) servers allows them to be scaled independently.

That's where the next post picks up.