Kessoku is a high-performance compile-time dependency injection library for Go that optimizes application startup by executing independent providers in parallel. This innovative approach significantly reduces the waiting time associated with service initialization, making it an excellent choice for projects reliant on multiple slow services.
Kessoku is a next-generation compile-time dependency injection (DI) library designed specifically for Go applications. It stands out by enabling parallel dependency injection, which significantly reduces application startup time, especially when dealing with multiple independent services. Traditional DI frameworks, such as google/wire, initialize services in a sequential manner, potentially leading to increased waiting times during application restarts. In contrast, Kessoku executes independent providers simultaneously, allowing for faster service initialization.
Parallel Execution: Independent services can be initialized at the same time, minimizing total startup time. For example:
// Sequential (google/wire)
wire.Build(NewDB, NewCache, NewAuth, NewApp) // Each waits for the previous
// Parallel (Kessoku)
kessoku.Inject[*App](https://github.com/mazrean/kessoku/blob/main/"InitApp",
kessoku.Async(kessoku.Provide(NewDB)),
kessoku.Async(kessoku.Provide(NewCache)),
kessoku.Async(kessoku.Provide(NewAuth)),
kessoku.Provide(NewApp),
) // Starts as fast as possible
Efficiency: Experience faster application restarts, especially beneficial for environments where frequent restarts are commonplace, such as during development or in serverless architectures.
Kessoku presents several strengths when compared to other DI frameworks:
| Feature | Kessoku | google/wire | uber/fx |
|---|---|---|---|
| Startup Speed | Parallel | Sequential | Sequential + runtime |
| Learning Curve | Minimal | Minimal | Steep |
| Production Ready | Yes | Yes | Yes |
Ideal Use Cases: Kessoku is particularly useful for:
Kessoku's straightforward API allows developers to seamlessly integrate it into their Go projects, using simple code constructs to create efficient dependency graphs. Full documentation and API references can be found at pkg.go.dev/github.com/mazrean/kessoku.
Discover how Kessoku can streamline service initialization and enhance your Go application performance.
No comments yet.
Sign in to be the first to comment.