Skip to content

System Design

Mysql Trap when DB Read-Write Separate and Parent-Child Relationship Schema without Transaction

Db_Replica_Trap_Cover.png

DB replicas are essential for data-intensive systems. First, we can accelerate our performance by writing to the master and reading from replicas, which can have many instances or be geographically close to users. Second, the replica DB can serve as a backup for the system. No matter what happens to the main DB, it can be a data recovery source or even become the new main DB to reduce downtime.

It's no secret that the trade-off for using a read-write separation mechanism is so-called "data inconsistency." The solutions to avoid this situation depend on the use cases and the architecture. In this article, we will go through the MySQL binlog mechanism and what would happen if we don't use transaction when insert/update parent-child relationship data. Let's start!

3 Times Performance Improvement for Generative AI within a Kafka Pipeline System

Kafka-Cover.jpg

Generative AI went viral in the last year, many use cases show the ability of generative AI, such as text, image, video, music generation, and more. It helps people to create more content with less effort. However, unlike conventional APIs, the Gen-AI API often has a relatively longer latency and higher costs due to the need for better (more expensive) GPU resources to enhance performance.

How to design an efficient Idempotent API

Idempotency API means that the data/ system state will be the same no matter how many times the API is successfully called with the same request body/parameter.

For a well-follow-principles RESTful API, besides the POST and PATCH, all other methods are idempotent. But in some particular circumstances (e.g. create a payment, upload files, microservice communication...), it is essential to implement idempotent if we want to make an API more robust.

In This article, we will propose an idempotency mechanism that is also focus on the API performance. The topics we will cover are as follows: