http-delta
v0.1.1
Published
Drop-in performance accelerator for Express and Fastify
Maintainers
Readme
⚡ http-delta
Drop-in performance accelerator for Express and Fastify.
http-delta helps existing Node.js servers run closer to their real performance potential — without rewrites, framework migrations, or risky changes. It applies smart HTTP tuning, reduces response overhead, and adds production-grade monitoring in a single line.
🚀 Why http-delta?
Most Node servers in the wild are under-tuned. Common issues include:
- Suboptimal keep-alive settings
- Unnecessary connection churn
- Chunked encoding overhead
- Underutilized CPU cores
- Hidden event-loop blocking
http-delta fixes these automatically while keeping your current stack intact.
Goal: measurable performance and stability improvements with near-zero migration cost.
✨ Key Features
🔧 Smart Server Tuning
Applies safe, high-impact defaults to Node’s HTTP server:
- Optimized keep-alive behavior
- Improved timeout configuration
- TCP socket tuning
- Better connection reuse
⚡ Fast Response Helpers
Low-overhead response paths that reduce allocations and avoid chunked encoding.
res.fastText("OK")
res.fastJson({ success: true })
res.fastEmpty()Benefits
- Lower CPU per request
- Reduced GC pressure
- Better tail latency
🧠 Event Loop Monitoring
Detects when your server starts to struggle.
- Event loop lag detection
- Early overload signals
- Production visibility
🧩 Easy Multi-Core Scaling
Optional helper to fully utilize available CPU cores.
import { enableCluster } from "@srikant/http-delta"
enableCluster()🧪 Framework Compatible
Works with:
- ✅ Express
- ✅ Fastify
- ✅ Native
node:http
No middleware rewrites required.
📦 Installation
npm install @srikant/http-deltaRequirements
- Node.js ≥ 18
- Express or Fastify (optional)
🚀 Quick Start
Express Example
import express from "express"
import { accelerate } from "@srikant/http-delta"
const app = express()
app.get("/", (req, res) => {
res.fastText("Hello from delta")
})
const server = app.listen(3000)
// Enable acceleration AFTER listen()
accelerate(server)Fastify Example
import Fastify from "fastify"
import { accelerate } from "@srikant/http-delta"
const app = Fastify()
app.get("/", async (req, reply) => {
reply.raw.fastJson({ ok: true })
})
await app.listen({ port: 3000 })
accelerate(app)⚙️ API Reference
accelerate(appOrServer, options?)
Enables http-delta optimizations.
Parameters
appOrServer— Express server, Fastify instance, or http.Serveroptions— optional configuration
Important: call after .listen().
Options
{
keepAliveTimeout?: number
headersTimeout?: number
requestTimeout?: number
maxRequestsPerSocket?: number
monitor?: boolean
monitorOptions?: {
threshold?: number
interval?: number
}
log?: boolean
}enableCluster(options?)
Forks workers equal to CPU cores.
enableCluster({ workers: 4 })Note: call this at the very start of your app.
monitorEventLoop(options?)
Manual event loop monitoring.
monitorEventLoop({
threshold: 50,
interval: 5000
})📊 Expected Performance Impact
Realistic improvements (typical API workloads):
| Scenario | Typical Gain | | --------------- | ------------ | | Vanilla Express | baseline |
- http-delta tuning | +15–30% RPS |
- fast responses | +10–30% |
- proper clustering | 2×–6× throughput | Tail latency | noticeably improved |
Results vary based on workload, payload size, and infrastructure.
🧪 Benchmarking
We recommend testing with autocannon:
npx autocannon -c 200 -d 20 http://localhost:3000Test:
- before http-delta
- after http-delta
- with clustering
🧠 Design Philosophy
http-delta intentionally does not replace Node’s HTTP stack.
Instead it:
- removes common inefficiencies
- improves defaults
- reduces per-request overhead
- adds production safety rails
This makes it safe to adopt in existing systems.
⚠️ What http-delta is NOT
To set clear expectations:
- ❌ Not a framework replacement
- ❌ Not a Go-style runtime
- ❌ Not faster than native C++ servers in all cases
- ❌ Not a silver bullet for slow databases
It is a practical performance multiplier for real Node apps.
🗺️ Roadmap
Planned future work:
- [ ] Advanced backpressure controls
- [ ] Adaptive keep-alive tuning
- [ ] Native turbo engine (Rust)
- [ ] uWebSockets adapter mode
- [ ] Built-in metrics export
🤝 Contributing
Contributions and performance reports are welcome.
If you benchmark http-delta in production-like workloads, please open an issue.
📜 License
MIT © Srikant Pandey
⭐ If this project helps you
Please consider starring the repo and sharing benchmarks — real-world data helps the project mature.
