recently i came across an architectural diagram in my organization, where a backend service sends messages to itself using Kafka, so basically it queues the messages and reads from the queue and processes the messages. Tried to ask the rationale behind it and the only answer i got was it was done to reduce load on the app. Is this common practice and what are the cases where you’d approach such an implementation.

Not sure if it is helpful to mention this but the service is written in Go



Often message queues are used to distribute work across several workers, so it might be interesting to know whether this app is actually running as several processes or at least several threads within one service process.

The reason you were told is somewhat questionable without some more information. By itself, using a message queue does not reduce load, but it can be useful in distributing the load among multiple workers. But even in a single-thread situation, its persistence may be a desirable feature to ensure processing of all tasks, even if the server process is shut down temporarily. An in-process queue cannot guarantee this.

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *