Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
Worker Service and an In-Process Job Queue: Channel, PeriodicTimer and Windows Service/systemd
An in-process job queue built on a bounded Channel returns false from TryWrite when it is full; the endpoint turns that into a 503 with a Retry-After header and applies backpressure. For periodic work, PeriodicTimer doesn't pile up missed ticks: after a long run it fires at most once right away. AddWindowsService and AddSystemd only activate in their own environment, and the queue empties on restart.
Asynchronous Processing: Queues, Workers, Fan-Out and Backpressure
Heavy work that is not part of the response moves out of the request to a queue and workers; the API returns 202 Accepted and a status address. In a real experiment the synchronous invoice endpoint times out 52 of 100 concurrent requests yet still renders 100 PDFs, while the bounded-queue version answers in 9 ms and pushes back with 503 and Retry-After when full; asynchrony decouples the work's timing, it doesn't speed it up.