Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
run: go mod download

- name: Run tests
run: go test -race -v -coverprofile=coverage.out ./adaptivepool/
run: go test -race -v -coverprofile=coverage.out ./...

- name: Upload coverage
uses: codecov/codecov-action@v4
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
go-version: '1.23'

- name: Run benchmarks
run: go test -bench=. -benchmem -benchtime=5s ./benchmarks/ | tee benchmark.txt
run: go test -bench=. -benchmem -benchtime=5s ./... | tee benchmark.txt

- name: Upload benchmark results
uses: actions/upload-artifact@v4
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ help:

build:
@echo "Building adaptivepool..."
$(GOBUILD) ./adaptivepool/...
$(GOBUILD) ./...

test:
@echo "Running tests with race detector and coverage..."
$(GOTEST) -race -v -coverprofile=coverage.out ./adaptivepool/...
$(GOTEST) -race -v -coverprofile=coverage.out ./...
@echo "To view coverage report: go tool cover -html=coverage.out"

lint:
Expand All @@ -39,7 +39,7 @@ lint:

bench:
@echo "Running benchmarks..."
$(GOTEST) -bench=. -benchmem ./benchmarks/...
$(GOTEST) -bench=. -benchmem ./...

run-http:
@echo "Running HTTP server example..."
Expand All @@ -59,10 +59,10 @@ run-1m-without:

run-comparison:
@echo "Comparing Naive vs Adaptive Pool..."
$(GOCMD) run scripts/compare.go
$(GOCMD) run examples/comparison/main.go

clean:
@echo "Cleaning..."
$(GOCLEAN)
rm -f coverage.out
rm -f benchmarks/benchmark.txt

15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![CI](https://github.com/iyashjayesh/go-adaptive-pool/actions/workflows/ci.yml/badge.svg)](https://github.com/iyashjayesh/go-adaptive-pool/actions/workflows/ci.yml)
[![Go Report Card](https://goreportcard.com/badge/github.com/iyashjayesh/go-adaptive-pool)](https://goreportcard.com/report/github.com/iyashjayesh/go-adaptive-pool)
[![GoDoc](https://godoc.org/github.com/iyashjayesh/go-adaptive-pool/adaptivepool?status.svg)](https://godoc.org/github.com/iyashjayesh/go-adaptive-pool/adaptivepool)
[![GoDoc](https://godoc.org/github.com/iyashjayesh/go-adaptive-pool?status.svg)](https://godoc.org/github.com/iyashjayesh/go-adaptive-pool)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![Visitors](https://api.visitorbadge.io/api/visitors?path=iyashjayesh%2Fgo-adaptive-pool%20&countColor=%23263759&style=flat)
![GitHub last commit]( https://img.shields.io/github/last-commit/iyashjayesh/go-adaptive-pool)
Expand All @@ -22,7 +22,7 @@ A production-grade adaptive worker pool for Go that handles dynamic scaling, bac
## Installation

```bash
go get github.com/iyashjayesh/go-adaptive-pool/adaptivepool
go get github.com/iyashjayesh/go-adaptive-pool
```

## Quick Start
Expand All @@ -35,7 +35,7 @@ import (
"log"
"time"

"github.com/iyashjayesh/go-adaptive-pool/adaptivepool"
"github.com/iyashjayesh/go-adaptive-pool"
)

func main() {
Expand Down Expand Up @@ -186,6 +186,8 @@ We performed an extreme pressure test (1M RPS target for 30s with 500KB tasks) t
**Why the Pool Wins:**
Under extreme load, the Naive approach causes a "Goroutine Explosion" and "Memory Bomb" that forces the Go runtime into constant Garbage Collection, leading to unusable 2-second latencies. The `go-adaptive-pool` shields your system by enforcing backpressure and resource caps.

For a detailed deep-dive into this test and the mechanics of the pool, check out the blog post: [Scaling to 1 Million RPS](https://iyashjayesh.github.io/go-adaptive-pool-website/blog/scaling-to-1m-rps/).

**Run the comparison yourself:**
```bash
make run-comparison
Expand All @@ -196,7 +198,6 @@ make run-comparison
Run standard micro-benchmarks:

```bash
cd benchmarks
go test -bench=. -benchmem -benchtime=10s
```

Expand Down Expand Up @@ -245,13 +246,13 @@ Key components:
Run tests with race detector:

```bash
go test -race -v ./adaptivepool/
go test -race -v ./...
```

Run with coverage:

```bash
go test -race -coverprofile=coverage.out ./adaptivepool/
go test -race -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
```

Expand All @@ -273,7 +274,7 @@ Inspired by:
## Related Documentation

- [Examples](examples/) - Complete working examples
- [Benchmarks](benchmarks/) - Performance comparisons
- [Benchmarks](.) - Performance comparisons

## Star History

Expand Down
File renamed without changes.
19 changes: 0 additions & 19 deletions benchmarks/README.md

This file was deleted.

62 changes: 0 additions & 62 deletions blog/scaling-to-1m-rps.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package benchmarks
package adaptivepool_test

import (
"context"
Expand All @@ -7,7 +7,7 @@ import (
"testing"
"time"

"github.com/iyashjayesh/go-adaptive-pool/adaptivepool"
"github.com/iyashjayesh/go-adaptive-pool"
)

// BenchmarkNaiveGoroutines benchmarks spawning a goroutine for each job
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/batch_processor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"syscall"
"time"

"github.com/iyashjayesh/go-adaptive-pool/adaptivepool"
adaptivepool "github.com/iyashjayesh/go-adaptive-pool"
)

func main() {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/http_server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"syscall"
"time"

"github.com/iyashjayesh/go-adaptive-pool/adaptivepool"
adaptivepool "github.com/iyashjayesh/go-adaptive-pool"
)

var pool adaptivepool.Pool
Expand Down
2 changes: 1 addition & 1 deletion examples/one_million_simulator/with_pool/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"sync/atomic"
"time"

"github.com/iyashjayesh/go-adaptive-pool/adaptivepool"
adaptivepool "github.com/iyashjayesh/go-adaptive-pool"
)

func main() {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions benchmarks/pool_bench_test.go → pool_bench_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package benchmarks
package adaptivepool_test

import (
"context"
"fmt"
"testing"
"time"

"github.com/iyashjayesh/go-adaptive-pool/adaptivepool"
adaptivepool "github.com/iyashjayesh/go-adaptive-pool"
)

// BenchmarkPoolThroughput benchmarks the pool's throughput with different worker counts
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading