Posts

Showing posts with the label microservices

Implementing Image Transformation Service with NextJS and imgproxy

Image
Introduction imgproxy is an efficient image processing and optimization service, featuring fast processing speeds, high security and low memory footprints because it is written in Go. The prominent advantages of imgproxy include the ability to resize, crop, compress and flexibly convert image formats (such as to WebP, AVIF) via URL. Notably, this service supports secure URL signing using HMAC encryption, which prevents DDoS attacks or unauthorized modifications of image size parameters from the client side. Although the NextJS Image component already supports automatic image resizing, it presents several limitations if you choose it for large-scale deployment Resized images stored in the cache of the .next folder only exist within a single NextJS server instance, making it difficult to share the cache when scaling up to multiple instances After building the project, the cache data is lost, or if you find a way to persist these resized images, a large dataset will still consume too much...

Distribution System Practice Series

Image
Introduction A distribution system is a collection of independent computers in terms of hardware but communicating and coordinating with each other through a computer network, making end users feel like a single centralized system. In the era of big data and cloud computing, distributed architecture plays a backbone role for almost all large-scale online services. Core Characteristics For a system to be considered truly distributed, it must face and solve the following technical characteristics: No Shared Clock : Each node has its own physical clock and there is always a certain clock drift. Therefore, you cannot rely on absolute real time to determine the order of events happening between nodes. No Shared Memory : Nodes cannot directly read or write to each other's RAM. Every communication activity and state synchronization must be done through message passing such as protocols like HTTP/REST, gRPC or message brokers like Kafka, RabbitMQ. Concurrency : Multiple nodes process indep...

Building a GraphQL and gRPC System on NextJS and NestJS

Image
Introduction GraphQL and gRPC are two powerful and popular communication technologies today. While GraphQL optimizes data transmission between Client and Server by allowing the Client to query exactly what it needs, gRPC is an ideal solution for communication between Microservices thanks to its superior performance, based on the HTTP/2 protocol and the Protocol Buffers binary format. The combination of this duo brings comprehensive optimization from the user interface layer to the core backend system. Using modern packages from @bufbuild and @connectrpc brings many outstanding advantages compared to the traditional library @grpc/grpc-js: Comprehensive Typescript support: Automatically generates safe type files (Type-safe) intuitively, helping the coding process to be error-free and providing excellent code suggestions (IntelliSense). Perfect compatibility with HTTP/1.1 and HTTP/2: No need to configure complex proxies like Envoy to connect from the browser or restricted environments, th...