Stock Market System Design

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 38

System

Design
An Introduction
Session
Plan
50 Mins - Learn System Design Basics
10 Mins - Quiz and Questions
10 Mins - Whimsical board walkthrough
10 Mins - Quick Break
1 Hour - Learn about evolving system designs
30 Mins - Final System Design
15 Mins - Q&A

2 Hrs 45 Mins
System Design

Cloud Architecture

Planning exercise
Software Architecture

Project Structure

Code
Significance
Macro Level View

Systems Thinking, overview

Important for leadership

End to End Product tech understanding


Skillset
Problem Solving

Conceptual understanding of the entire tech


stack and all the technologies

Planning skills, pre-emption

Working with systems that can scale


Real World
Scale Bottlenecks Failures Recovery

Parking lots have multiple entries

Restaurants have multiple chefs, repeatable


recipes

Gas distribution pipelines have multiple vents,


knobs, checkpoints, parallel pipelines.
Technical System Design of
Stock Trading Platforms

For Engineers only Advanced Level No Coding Some prior system


design knowledge will
be helpful

Not relevant for UI/UX Not relevant for Stock traders Only high level system
designers design
HLD Vs. LLD
In depth talk about tech
Tech components only
components may not be present

Exact technology not discussed


Discusses exact tech.

No DSA
Will discuss underlying DSA in deep

No schema design Will discuss schema design

No API / JSON design


Will discuss API design
Stock Trading Platforms Real Time Systems.

Near real time Milliseconds delay


Use streams Use Queues

Soft real time Delay increases, won't hamper things, not mission critical

Leverage event
Hard real time Delay increases, system fails
driven systems

Stock Trading apps are slightly hybrid -


95% is real time and 5% is request -
response driven
What we will learn today
Loadbalancers
State
Indexing
Working at Caching Stability, Sharding
Latency API Composers
SCALE Scalability Reliability Replication Webhooks
Distribution
Service Registries

Proxies
Microservices Processing Batches
Security Rate Limiters Latency Sockets Streams
big data
API Gateways Events Queues

ETLs

How to apply all these concepts to build a great system design


Points to remember
Today's session will be intense and fast paced, try and keep up :)

If we don't go a bit fast, it'll be difficult to complete the session.

The PPT and Whimsical board will always be available with you.

You can always come back and refer the whimsical board for prepping for interviews.

It'll take 3 months of hard work and solving 15-20 problems to actually get great at system design.
Don't expect to become an expert after today's 3 hour session :)

Don't be harsh on yourself, it's possible you may not follow along for some of the concepts, Google
them AFTER the session, loads of info available on youtube, medium.com.

Stick around till the very end for a complete picture. Don't jump to conclusions.

This session aims to save 40-50 Hrs of prep time for system design interviews
Loadbalancer.
Caching.
Caching.
Caching.
Caching.

Database Front End Back End


Scalability.

Latency Throughput Capacity

the delay before a transfer of data begins the amount of data passing through a the amount of data that the system can
following an instruction for its transfer. system at a given point of time. handle / store in entirety.

"Performance is not equal to scalability."


Scalability.

Gunther's universal scalability

Horizontal Vertical

Add communication constraints and latency


Scaling with distribution.

Distributing data Distributing compute Replicating data


Scaling - state.

Stateful Stateless
Databases - Sharding.
Databases - Replication.
Databases - Indexing.
Proxies.
Ratelimiters.
CAP Theorem.
Microservices.
API Gateways.

Ratelimiters and Proxies can


also be rolled into API
Gateways in some cases.
API Composers.

Joins and aggregations are expensive.


API composers do this beforehand
and keep data ready.
Service Registry.

With container and container


orchestration, the IPs of services
change frequently - sometimes on
each deployment.
Web Hooks.

Instead of external services pooling our


APIs for updates, instead we can push
updates to them.
SQL Vs. NoSQL
Row DBs Vs Column DBs Services like stock data are Read-heavy systems.
Synchronous
Events. Asynchronous
Event Queues.
Ordered
Data Stream.
Unordered

Source Producer Adapter The adapter knows how to transform the incompatible data in order to make it
compatible

Sink Consumer Broker A message broker is software that enables applications, systems, and
services to communicate with each other and exchange information
Batch Vs. Streams
Websockets

You might also like