This week’s system design refresher:
Scalability Simply Explained in 10 Minutes (Youtube video)
What do Amazon, Netflix, and Uber have in common?
What are the differences between paging and segmentation?
How does Git Work?
What tech stack is commonly used for microservices?
SPONSOR US
Your free ticket to P99 CONF is waiting — 60+ engineering talks on all things performance (Sponsored)
P99 CONF is the technical conference for anyone who obsesses over high-performance, low-latency applications. Engineers from Disney/Hulu, Shopify, LinkedIn, Netflix, Google, Meta, Uber + more will share 60+ talks on topics like Rust, Go, Zig, distributed data systems, Kubernetes, and AI/ML.
Signing up also gets you 30-day access to the complete O’Reilly library, free books, and a chance to win 1 of 300 free swag packs!
Don't miss this chance to join 20K of your peers for an unprecedented opportunity to learn from experts like the creators of Postgres, ScyllaDB, KVM, and the Rust tokio framework – for free, from anywhere.
Oct 23-24 | Online
Scalability Simply Explained in 10 Minutes
What do Amazon, Netflix, and Uber have in common?
They are extremely good at scaling their system whenever needed.
Here are 8 must-know strategies to scale your system.
Stateless Services
Design stateless services because they don’t rely on server-specific data and are easier to scale.Horizontal Scaling
Add more servers so that the workload can be shared.Load Balancing
Use a load balancer to distribute incoming requests evenly across multiple servers.Auto Scaling
Implement auto-scaling policies to adjust resources based on real-time traffic.Caching
Use caching to reduce the load on the database and handle repetitive requests at scale.Database Replication
Replicate data across multiple nodes to scale the read operations while improving redundancy.Database Sharding
Distribute data across multiple instances to scale the writes as well as reads.Async Processing
Move time-consuming and resource-intensive tasks to background workers using async processing to scale out new requests.
Over to you: Which other strategies have you used?
Latest articles
If you’re not a subscriber, here’s what you missed this month.
To receive all the full articles and support ByteByteGo, consider subscribing:
What are the differences between paging and segmentation?
Paging
Paging is a memory management scheme that eliminates the need for contiguous allocation of physical memory. The process's address space is divided into fixed-size blocks called pages, while physical memory is divided into fixed-size blocks called frames.
The address translation process works in 3 steps:Logical Address Space: The logical address (generated by the CPU) is divided into a page number and a page offset.
Page Table Lookup: The page number is used as an index into the page table to find the corresponding frame number.
Physical Address Formation: The frame number is combined with the page offset to form the physical address in memory.
Advantages:Eliminates external fragmentation.
Simplifies memory allocation.
Supports efficient swapping and virtual memory.
Segmentation
Segmentation is a memory management technique where the memory is divided into variable-sized segments based on the logical divisions of a program, such as functions, objects, or data arrays.
The address tranlation process works in 3 steps:Logical Address Space: The logical address consists of a segment number and an offset within that segment.
Segment Table Lookup: The segment number is used as an index into the segment table to find the base address of the segment.
Physical Address Formation: The base address is added to the offset to form the physical address in memory.
Advantages:
Provides logical separation of different parts of a program.
Facilitates protection and sharing of segments.
Simplifies management of growing data structures.
How does Git Work?
The diagram below shows the Git workflow.
Git is a distributed version control system.
Every developer maintains a local copy of the main repository and edits and commits to the local copy.
The commit is very fast because the operation doesn’t interact with the remote repository.
If the remote repository crashes, the files can be recovered from the local repositories.
Over to you: Which Git command do you use to resolve conflicting changes?
What tech stack is commonly used for microservices?
Below you will find a diagram showing the microservice tech stack, both for the development phase and for production.
Pre-Production
Define API - This establishes a contract between frontend and backend. We can use Postman or OpenAPI for this.
Development - Node.js or react is popular for frontend development, and java/python/go for backend development. Also, we need to change the configurations in the API gateway according to API definitions.
Continuous Integration - JUnit and Jenkins for automated testing. The code is packaged into a Docker image and deployed as microservices.
Production
NGinx is a common choice for load balancers. Cloudflare provides CDN (Content Delivery Network).
API Gateway - We can use spring boot for the gateway, and use Eureka/Zookeeper for service discovery.
The microservices are deployed on clouds. We have options among AWS, Microsoft Azure, or Google GCP.
Cache and Full-text Search - Redis is a common choice for caching key-value pairs. ElasticSearch is used for full-text search.
Communications - For services to talk to each other, we can use messaging infra Kafka or RPC.
Persistence - We can use MySQL or PostgreSQL for a relational database, and Amazon S3 for object store. We can also use Cassandra for the wide-column store if necessary.
Management & Monitoring - To manage so many microservices, the common Ops tools include Prometheus, Elastic Stack, and Kubernetes.
Over to you: Did I miss anything? Please comment on what you think is necessary to learn microservices.
SPONSOR US
Get your product in front of more than 1,000,000 tech professionals.
Our newsletter puts your products and services directly in front of an audience that matters - hundreds of thousands of engineering leaders and senior engineers - who have influence over significant tech decisions and big purchases.
Space Fills Up Fast - Reserve Today
Ad spots typically sell out about 4 weeks in advance. To ensure your ad reaches this influential audience, reserve your space now by emailing sponsorship@bytebytego.com
Great article, congratulations.
However, I am concerned about how this type of microservices architecture is becoming trendy even when it's not necessary.
There are many scenarios where using microservices doesn't make sense, even if they are or have been trendy or used by large companies.
For web applications that do not need to handle high request loads, companies with limited financial resources, or companies without a DevOps culture, it can be more of a problem than a solution.
Development - Node.js or react is popular for frontend development??! Nodejs!