
#รับนำเข้าส่งออกสินค้า 🇹🇭↔️🇨🇳🇺🇸รับทำโปรเจค #gcp/#aws/#aliyun/#阿里云/#PHP/#Hardening OS+middleware 💚#Poker/#Crypto/#Technology/#Golf/#Bakerian
Lamphun, Thailand
Joined December 2008
- Tweets27.9K
- Following499
- Followers647
- Likes850
侯สุด95☁️ retweeted
If I had to load balance traffic,
here are 6 algorithms I'd consider:
1) Round robin
2) Weighted round robin
3) Least connections
4) IP hash
5) Random
6) Least response time
There's no one-size-fits-all solution.
When choosing, consider these key factors:
↳ Workload uniformity: Are all requests roughly equal in complexity?
↳ Session state: Do you need sticky sessions?
↳ Server variability: Are all instances identical, or do some have significantly more horsepower?
↳ Traffic patterns: Do you regularly experience bursts, or is traffic relatively predictable? Are requests short-lived or persistent?
In many production environments, load balancers like NGINX, HAProxy, AWS ELB, or Envoy enable combining algorithms or fine-tuning behaviors with custom logic and health checks.
👋 PS - we wrote a detailed article about this in our newsletter (with visuals): lucode.co/load-balancing-alg…
--
♻️ Repost to help others learn system design.
🙋🏻♀️ Follow Nikki Siapno + turn on notifications.
侯สุด95☁️ retweeted
RESTful API Design Checklist
🔹 Domain Model Driven
Base API path structure on your domain model.
🔹 Choose Proper HTTP Methods
Use standard HTTP methods and avoid problematic ones like PATCH when possible.
🔹 Implement Idempotence Properly
Design for idempotence upfront to improve API robustness. GET is naturally idempotent; design POST carefully.
🔹 Choose Proper HTTP Status Codes
Use a limited set of status codes to simplify development.
🔹 Versioning
Plan version numbering in advance to simplify future upgrades.
🔹 Semantic Paths
Use descriptive paths to make APIs self-documenting and easier to find.
🔹 Batch Processing
Use batch or bulk keywords at the end of paths for processing multiple items.
🔹 Query Language
Design consistent query rules for pagination, sorting, filtering, and other operations.
--
We just launched the all-in-one tech interview prep platform, covering coding, system design, OOD, and machine learning.
Launch sale: 50% off. Check it out: bit.ly/bbg-li-posts
侯สุด95☁️ retweeted
Many Cloud Engineers think load balancers are just for traffic distribution.
There are plenty of use cases in modern cloud architectures proving otherwise.
Here, I’ve made this to help you better understand.
55K+ read my DevOps and Cloud newsletter: techopsexamples.com/subscrib…
What do we cover:
DevOps, Cloud, Kubernetes, IaC, GitOps, MLOps
🔁 Consider a Repost if this is helpful
侯สุด95☁️ retweeted
I've been using 𝐀𝐩𝐚𝐜𝐡𝐞 𝐊𝐚𝐟𝐤𝐚 for years now and I absolutely love it. Let me explain the message/event flow in simple terms. Give it a read. 👇
𝐃𝐨 𝐲𝐨𝐮 𝐤𝐧𝐨𝐰 𝐰𝐡𝐚𝐭? 𝐀𝐩𝐚𝐜𝐡𝐞 𝐊𝐚𝐟𝐤𝐚 𝐰𝐚𝐬 𝐛𝐨𝐫𝐧 𝐨𝐮𝐭 𝐨𝐟 𝐚 𝐩𝐫𝐨𝐛𝐥𝐞𝐦. 😉
LinkedIn engineers => faced difficulties in tracking website metrics, activity streams and other operational data.
A team of engineers => led by Jay Kreps, Neha Narkhede and Jun Rao started developing a distributed publish-subscribe messaging system that could handle high-throughput, low-latency data streams.
This system eventually became Apache Kafka.
It was open sourced in early 2011.
The name 'Kafka' was chosen by Jay Kreps.
He named the system after the famous author 'Franz Kafka'. 😊
Kreps was an admirer of Franz Kafka's writing and found the name fitting for a system that dealt with the flow of information.
It's written in Java and Scala.
Later they founded => 'Confluent (
@confluentinc
)' (a company) in 2014 to provide commercial support and additional tools for Kafka users.
📌 𝐋𝐞𝐭'𝐬 𝐮𝐧𝐝𝐞𝐫𝐬𝐭𝐚𝐧𝐝 𝐭𝐡𝐞 𝐛𝐚𝐬𝐢𝐜 𝐟𝐥𝐨𝐰.
[1.] Producer sends a message
◾ An application acts as a producer, creating a message with data (payload) and optional key.
◾ The producer connects to a broker in the Kafka cluster and identifies the target topic.
◾ Kafka uses a partitioner to determine which partition within the topic should receive the message. This ensures load balancing and parallel processing.
◾ The message is delivered to the leader replica of the chosen partition.
[2.] Message storage and replication
◾ The leader replica appends the message to its log segment.
◾ The message receives a unique offset, serving as its position within the log.
◾ The leader replicates the message to follower replicas for fault tolerance.
[3.] Consumer fetches messages
◾ An application acts as a consumer, joining a consumer group.
◾ Consumers within the same group share offsets and coordinate consumption.
◾ Each consumer fetches messages from its assigned partitions based on its committed offset.
◾ The consumer receives batches of messages and processes them.
[4.] Acknowledging consumption
◾ Once processing is complete, the consumer commits its new offset.
◾ This tells Kafka which messages have been successfully consumed.
◾ Kafka tracks committed offsets for each consumer in the group.
[*.] Flow continues
◾ Producers continue sending messages and consumers keep fetching and processing them based on their latest offsets.
◾ This cycle ensures ordered delivery and reliable consumption even with failures or restarts.
Remember,
👉 Message flow is asynchronous. Producers don't wait for consumers to process messages.
👉 Consumers can lag behind producers if processing is slow.
👉 Kafka offers mechanisms for handling failures and ensuring at-least-once or exactly-once delivery semantics.
Topics => Partitions =>Log Segments
(Data is actually stored in log segments)
Follow @techNmak
侯สุด95☁️ retweeted
gRPC & RPC Frameworks
Introduction
→ gRPC (Google Remote Procedure Call) is a modern, high-performance framework that enables communication between services in different systems.
→ It is based on the concept of Remote Procedure Calls (RPC), where a program can directly execute a function on another server as if it were local.
What is RPC?
→ RPC (Remote Procedure Call) allows one system to request a service or function on another system over a network.
→ The client calls a remote function, passes parameters, and receives the result — similar to calling a local function.
How gRPC Works
→ Uses HTTP/2 as its transport protocol for faster, multiplexed connections.
→ Relies on Protocol Buffers (protobuf) for defining services and message data structures.
→ Client stubs and server code are auto-generated from .proto files, reducing manual setup.
→ Supports multiple programming languages, making it ideal for microservices communication.
Key Features of gRPC
→ Bi-directional Streaming → Enables both client and server to send messages continuously.
→ Strong Typing → Uses Protocol Buffers for structured, type-safe communication.
→ Performance → Lightweight and faster than traditional REST APIs.
→ Cross-Language Support → Works across Java, Python, Go, Node.js, and more.
gRPC vs REST
→ REST uses JSON over HTTP/1.1, while gRPC uses Protocol Buffers over HTTP/2.
→ gRPC is binary and faster, while REST is text-based and easier to debug.
→ REST fits public APIs well; gRPC excels in internal microservices communication.
Common RPC Frameworks
→ Apache Thrift → Developed by Facebook, supports multiple languages and transports.
→ JSON-RPC → Lightweight text-based protocol using JSON for requests and responses.
→ XML-RPC → Early RPC format using XML over HTTP.
→ gRPC → Modern standard for high-performance RPC communication.
Best Practices
→ Use gRPC for internal service-to-service communication.
→ Implement authentication and encryption using TLS.
→ Monitor latency and handle retries for network resilience.
→ Combine with API gateways for hybrid REST and gRPC architectures.
👉 Grab the Backend Development with Projects Ebook here:
codewithdhanian.gumroad.com/…


































