System Design Points to Consider and Architectural Design Goals At Work

Hanwen Zhang
4 min readMar 5, 2024

--

Software design at the high level is referred to as “Architecture.” The simpler you can keep the system, the better.

System Design

High-Level Ideas

- there are no right answers
- the focus is usually on the data model
- no need for specific technologies
- draw stuff

How Would You Design a Software?

- identify core features
- possible implementation
- identify and address difficulties
- solutions for scalability

Scalability

Cashing: user -> server (memory store) -> database

Do some expensive work one time, storing the results, and then reusing that result as soon as we need to recalculate it again, and in-memory cache is very fast to access and can have a cache that lasts like 24 hours.

We can store data in memory stores like Memcache or Redis first, when this piece of data is needed, rather than pulling data from the database by running an expensive algorithm, we just go right back to the memory store, pull out the previous information and send it back to the user.

Deployment Architecture: create a load balancer

Create an HTTP Load-balancer for the web server, whenever a user accesses the software, it will go to this load balancer, and then the load balancer will randomly assign that request to any one of several different identical servers. We could have many different servers that are completely invisible to the user and any one of those servers can handle a given request and respond which is horizontally scaling the application:

  • helps to distribute traffic to many different web servers to help with scalability
  • put a load balancer in front of the request and that load balancer will route the client request to several different web servers

Database sharding

First, think of database schema design, what tables going to be used? primary key? indices? Database indexes are important because they make your queries fast. Then Split up the database into multiple master DBs:

  • vertical sharding — take each table and just put it into a new machine (like user table, comment table, user support table, chat table)
  • horizontal sharding — take a single table and split that across multiple machines

Slave-master replications are a single master database that you write into and then clone duplicated into many slave databases which you only read from. Use case like the user updated the profile and wants to see the changes right away

CDN content delivery network: (image/video server)

It is like a global network, to cache and static asset files like images, video, HTML, CSS, and JavaScript files, which decrease the load on your actual server, and access content very fast for users.

  • Pull Technique: The first time may be slow due to fetch and cache, then subsequent users within the local region can access quickly
  • Distributed Systems like Amazon S3 (Cloud Object Storage) for uploading images

NoSQL Database: key-value pairs model able to scale themselves easily across multiple different machines easily

For example, Redis — an in-memory data structure store (server), used as a NoSQL key–value persistent database, cache, and message broker.
— MongoDB, Amazon Dynamodb, Firebase

API design: how do the client and server communicate with each other? What are the methods and functions they use?
— what is the data transport mechanism? Are you using JSON or protocol buffer?
— how do you handle security? for offline usage, how do you make it fast?

Design Goal At Work

Correctness/Modularity

We want to decompose designs into modules, each well-knit, and depending on few others.

To Begin Selecting a Basic Architecture

  1. Develop a mental model of the application as if it were a small application
  2. Decompose into the required components, look for high cohesion & low coupling
  3. Repeat this process for the components.
  4. Consider using Façade for each package.

Reusability

We classify architectures to use them for several applications.

A Software Architecture is Essentially

  • a Data Flow
  • a set of Independent Components
  • a Virtual Machine
  • a Repository
  • Layers.

Models are used to express requirements, architecture, and detailed design.

A framework is a collection of models, typically a class model, that forms a template for a category of architectures.

Key Concept: We Use Frameworks to reuse

  • classes
  • relationships among classes or pre-programmed control

We create frameworks because we want to reuse groups of classes and algorithms among them.

We create frameworks because we want to reuse groups of classes and algorithms among them.

--

--

Hanwen Zhang

Full-Stack Software Engineer at a Healthcare Tech Company | Document My Coding Journey | Improve My Knowledge | Share Coding Concepts in a Simple Way