FUNDAMENTALS Flashcards
what is a system
An architecture or collection of technologies that serve a set of users to fulfill a set of requirements. Consists of the users, requirements and the components to server the users.
What is design
The process of understanding the user requirements and selecting the appropriate components, modules and software technologies, how are going to be intertwined and communicate with each other to meet the needs of the system.
What is system design
System design is the process of defining the architecture, components, modules, interfaces, and data for a system to satisfy specific requirements. It involves creating a blueprint that guides the construction and implementation of a software or hardware system to ensure it meets business and technical needs.
2 broad components of a system
Logical and tangible entities
Examples of Tangible entities
- Text, images, videos,..
- mongoDB, Java
Examples of logical entities
Data, database, applications, cache, message queues, infra
what is a client-server architecture
client requests data from the server
Server responds to the client’s request
thin client
When the core of the business logic sits on the server-side
thick client
When the core of the business logic sits on the client-side, e.g. gaming
2 - tier
client - 1 server
3 - tier
client - server - database
N - tier
client - CDN - server - loadbalancer - database
what is a proxy server
A middleman, that communicates on behalf of a component/node
Forward proxy
Sits between the client and server on the client side, and communicates with server on behalf of the client, hence client anonymity. Controls, and monitors traffic from clients
reverse proxy
Sits between the client and server on the server side and responds to client requests on behalf of the server, hence server anonymity. Controls, and monitors traffic, load balancing, caching, DDoS attacks mitigation
Proxy caveats
Single point of failure, bottleneck for reverse proxy
Forward proxy restriction bypass
Data representation in different layers
o Business
o Application
o Data stores(databases)
o Network
o Hardware
o Business; text, video, image
o Application: JSON, XML
o Data stores(databases): tables, lists, indexes
o Network: packets
o Hardware: bits
Data stores types
o Databases
o Queues
o Caches
o Indexes
Data-flow methods
o APIs
o Message queue
o Events
Data generation sources
o Users: created by user directly
o Internal: created by the system
o Insights: created based on user information, actions
Factors determining the data storage type
o Type of data
o Volume
o Consumption/retrieval
o Security
database type factors
Vary by data type and structure
database types
Relational
Non-relational
File
Network
Large datasets
time series
storage bucket
Properties of relation
Schema
* If data is structured and relational
ACID
meaning of ACID
- Atomicity, completed or rollback
- Consistency; reads values are the same
- Isolation, reads/writes independent of each other
- Durability; transactions completed will survive permanently
Pros of relational databases
- Easily design complex related data
- Ensures null value not populated
- Ensures schema constraints are followed
Cons of relational databases
- Horizontal scaling is complex
- Adding new columns is complex
Examples of non-relational databases
KV store like hashmap
Column based, cassandra, hbase, scylla
Document based;
Search db; elastic search
properties of column based
- Has tables and columns but no ACID
- Midway of relational and document
- Heavy writes, special reads
Properties of document based
- Supports heavy read/writes
- No fixed schema, downside null values
- No ACID, cannot ensure completed transactions
- Benefits
o Highly scalable
o Sharding
o Dynamic data flexibility
o Special query operations/aggregation
Elements of Application design
o Requirement
o Layer
o Tech stack
o Code structure/design pattern
o Data store instructions
o Performance/cost
o Deployment
o Monitoring
o Operational excellence/reliability
what is an API
Interaction between different applications
Advantages of API
o Provides communication b/n different systems
o Abstraction
o Platform agnostic
Examples of APIs
o Private
o Public
o Web APIs
o SDK/library
API contracts
o RPC
o SOAP
o REST
API factors
o API contracts
o Documentation
o Data format
o Security
what is caching
Hardware or software component which helps save frequently accessed data or expensive to compute
what is cache invalidation
removing, updating cache value
cache invalidation methods
o Removing old cached value, and replacing with updated data
o By keeping a TTL, cache expiry time
o Removing and updating the cached value
cache eviction strategies
o Replace existing keys when limit reached
o Least recently used keys
o FIFO
o Least frequently used
popular cache patterns
o Cache-aside strategy/ pattern
o Read through strategy/pattern
o Write around strategy/pattern
o Write back pattern
describe Cache-aside strategy/ pattern
Cache never talks to DB but to application code
Redundancy when cache goes down