C#C
C#13mo ago
LazyGuard

Which Architecture to Choose?

I am working with two .NET-based architectures for processing HTTP POST requests, and I’m looking to wondering what to choose and how to measure things. Here's how the two architectures work:

Architecture 1: Decoupled Worker with Kafka
A POST request writes data to a database and sends a message to a Kafka topic.
A separate worker app consumes messages from Kafka, processes them, and updates the database.

Architecture 2: Background Service in the Same App
A POST request writes data to a database.
A background service running in the same application continuously polls the database for unprocessed tasks and processes them one by one.


Architecture 1 decouples the request handling and background processing using Kafka, allowing independent scaling of the worker.
Architecture 2 couples the request handling and background processing within the same app.

In what conditions I must chose the first or second one? Performance-wise how should I go about testing both ?
Thanks
Was this page helpful?