Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

communitycreator
general

Key concepts to know before designing any system

Harsh Jain

While system design questions aren’t really tests of what you need to recognize, certain concepts can make things easier. In this shot, we will look at a brief overview. These are complex topics, so I encourage you to check out the following Educative courses for a more in-depth understanding:

  1. Grokking the System Design Interview
  2. Grokking the Advanced System Design Interview

Horizontal vs. vertical scaling

A system can be defined in one of two ways:

  • Vertical scaling increases the resources of a selected node. For example, you would add additional memory to a server to enhance its ability to handle load changes.
  • Horizontal scaling increase the number of nodes. For example, you would add additional servers to decrease the load on any server.

Vertical scaling is simpler than horizontal scaling, but it’s limitedyou can only add limited memory or disc space.

Load balancer

Typically, some front-end parts of a scalable website are going to be thrown behind a load balancer. A load balancer allows a system to equally distribute the load so that, if one server crashes, it won’t shut down the whole system. To do this, of course, you have to hold out a network of cloned servers that all have the same code and access to the same data.

Database denormalization and NoSQL

The join operation performed in SQL can get very slow as the system grows bigger. For this reason, you should generally avoid them.

Denormalizationadding redundant data into a database to boost reads is one option for this. Another option, instead of going with denormalization, could be to use a NoSQL database. A NoSQL database does not support joins and might structure the information differently, but it is designed to scale better.

Database partitioning (sharding)

Sharding means splitting information across multiple machines, while making sure that you know which data is on which machine. A few common ways of partitioning are:

  • Vertical partitioning: This is basically partitioning by feature.
  • Key-based (or Hash-based) partitioning: This uses a few parts of the data (for example, an ID) to divide it. One of the issues with this is that ,often, the amount of servers you have is effectively fixed; therefore, adding additional servers would mean reallocating all the information, which is a costly task.
  • Directory-based partitioning: In this kind of partitioning, you should maintain a lookup table for where info can be found. This makes it relatively easy to feature additional servers, but it comes with two major drawbacks:
  • The lookup table is often one point of failure.
  • Constantly accessing this table impacts performance.

Caching

An in-memory cache can deliver very rapid results – it’s an easy key-value pairing and typically sits between your application and your data store.

When an application requests a bit of data, it will try the cache first. If the cache doesn’t contain the key, it will search the information within the data store. Once you cache, you would cache a question and its results directly or specific objects.

Asynchronous processing & queues

Ideally, slow operations will be done asynchronously. Otherwise, a user might grind to a halt while waiting and expecting a process to finish. In some cases, you would do that beforehand (i.e., pre-process), but in other cases, we’d tell the user to attend and notify them when the method is completed. You’ve probably seen this on websites before.

Networking metrics

Some of the foremost important metrics around networking include:

  • Bandwidth: This is often the largest amount of knowledge that will be transferred during a unit of your time. Bandwidth is typically expressed in bits per second (or gigabytes per second).

  • Throughput: While bandwidth is the maximum data that will be transferred during a unit of your time, throughput is the amount of knowledge that is actually transferred.

  • Latency:. How long it takes data to travel from one end to the opposite end. That is, latency is the delay between the sender sending information (even a really small chunk of data) and the receiver receiving it.

RELATED TAGS

communitycreator
general
RELATED COURSES

View all Courses

Keep Exploring