Live data from Hacker News

Fast and observable background job processing for .NET

github.com

11–20 of 26 posts

Re: Fast and observable background job processing for .NET

#11
post #7
post #4

I'm trying to find the actual value-add here. This feels like TPL but with more steps. Why do we need to serialize the jobs through a Channel ? Couldn't we just do Task.Run and let the runtime take care of scheduling our work?

You have no control over concurrency/scheduling, have to manage scoping, error handling, etc. TPL/Threads add to much low level noise to the logic. Like you could easily blow up the thread pool depending on what you are doing, where a channel based implementation would just deal with spillover and not affect the other threads. You can easily capture scoped services that are disposed by the time the thread executes -…

This is exactly why I built BusyBee. My team found ourselves hand‑rolling something similar almost every time we started a new project. If we kept needing it, I figured there are probably more people in the same situation. So instead of duplicating the same background queue logic across multiple codebases, I decided to build it once, add proper OpenTelemetry support, and keep it simple without extra bloat. That way we can just reuse it and reduce the amount of similar code we have to maintain.

Re: Fast and observable background job processing for .NET

#12
post #5

This seems to be a thin abstraction over Channels, I'd probably prefer to use Channels directly in almost all cases. I really like Channels for in-memory queues like this, they're very nice and it's easy to make everything parallel. But if you need more than this you usually need persistence, and then you need something else entirely.

It is a thin abstraction over Channels, and that’s by design. What it adds is graceful shutdown handling, OpenTelemetry integration, timeout support, and simple configuration. I kept needing those pieces in almost every project, so wrapping them up into a small reusable library felt worthwhile.

Re: Fast and observable background job processing for .NET

#13
post #7
post #4

I'm trying to find the actual value-add here. This feels like TPL but with more steps. Why do we need to serialize the jobs through a Channel ? Couldn't we just do Task.Run and let the runtime take care of scheduling our work?

You have no control over concurrency/scheduling, have to manage scoping, error handling, etc. TPL/Threads add to much low level noise to the logic. Like you could easily blow up the thread pool depending on what you are doing, where a channel based implementation would just deal with spillover and not affect the other threads. You can easily capture scoped services that are disposed by the time the thread executes -…

> You have no control over concurrency/scheduling

https://learn.microsoft.com/en-us/dotnet/api/system.threadin...

Re: Fast and observable background job processing for .NET

#14
post #12
post #5

This seems to be a thin abstraction over Channels, I'd probably prefer to use Channels directly in almost all cases. I really like Channels for in-memory queues like this, they're very nice and it's easy to make everything parallel. But if you need more than this you usually need persistence, and then you need something else entirely.

It is a thin abstraction over Channels, and that’s by design. What it adds is graceful shutdown handling, OpenTelemetry integration, timeout support, and simple configuration. I kept needing those pieces in almost every project, so wrapping them up into a small reusable library felt worthwhile.

Oh that sounds pretty darn nice actually

Re: Fast and observable background job processing for .NET

#16
post #15

If you are running a web service, does this provide any advantages to BackgroundService? https://learn.microsoft.com/en-us/aspnet/core/fundamentals/h...

Under the hood, BusyBee consists of an in-memory queue built on Channels and a job processor that dequeues and executes tasks. The processor is essentially a BackgroundService, but BusyBee wires everything together for you, so you don’t have to manually set up the queue, parallel processing, timeouts and errors handling and observability for OpenTelemetry.

Re: Fast and observable background job processing for .NET

#17
post #12
post #5

This seems to be a thin abstraction over Channels, I'd probably prefer to use Channels directly in almost all cases. I really like Channels for in-memory queues like this, they're very nice and it's easy to make everything parallel. But if you need more than this you usually need persistence, and then you need something else entirely.

It is a thin abstraction over Channels, and that’s by design. What it adds is graceful shutdown handling, OpenTelemetry integration, timeout support, and simple configuration. I kept needing those pieces in almost every project, so wrapping them up into a small reusable library felt worthwhile.

Out of curiosity, why do you use an explicit semaphore here? I usually used Parallel.ForEachAsync together with ReadAllAsync from the Channel. Avoiding the manual semaphore handling was one of the things I really liked about Channels.

Re: Fast and observable background job processing for .NET

#18
post #9

How is it different from hangfire?

Hangfire is primarily a job scheduler. It is designed for running jobs at specific times or intervals, and it persists jobs in a database so they survive restarts. It comes with a dashboard, retries, and a lot of infrastructure around long‑term job management. That makes it powerful, but also heavier in terms of setup and overhead. BusyBee is focused on lightweight background processing. Everything is in‑memory, with…

So what happens if the application shuts down before the file is processed? I get the appeal of a simple solution, but I don't know if I can ever recall a situation where "push work to the background and no one cares what happens to it" is ok.

Re: Fast and observable background job processing for .NET

#19
post #4

I'm trying to find the actual value-add here. This feels like TPL but with more steps. Why do we need to serialize the jobs through a Channel ? Couldn't we just do Task.Run and let the runtime take care of scheduling our work?

I wish TPL Dataflow was more known.

Not only, most people really aren't aware of all batteries that come with .NET, and Java, more so than Python or Go.
Post reply on HN