Skip to content

Performance

Benchmarks and performance characteristics

NestForge Web leverages Rust’s performance characteristics for blazing-fast response times and minimal resource usage.

FrameworkCold Start
Next.js (Node.js)100-500ms
NestForge Web< 50ms
Improvement5-10x faster
FrameworkBaseline Memory
Next.js50-200MB
NestForge Web< 20MB
Improvement3-10x lower
FrameworkRequests/second
Next.js (Node.js)~10,000-30,000
NestForge Web~100,000+
Improvement3-10x higher
FrameworkTTFB
Next.js SSR50-150ms
NestForge Web SSR< 10ms
Improvement5-15x faster
Terminal window
# Next.js requires Node.js runtime (~100MB)
# NestForge Web is a compiled native binary
file my-app
# my-app: ELF 64-bit LSB executable... (no runtime needed)
use tokio::runtime::Runtime;
// Single-threaded runtime for I/O-bound tasks
let rt = Runtime::new().unwrap();
// Multi-threaded for CPU-bound work
let rt = Runtime::new().multi_thread().build().unwrap();
use axum::{Router, routing::get};
let app = Router::new()
.route("/", get(handler))
.layer(cors())
.layer(compress());
// Zero-copy routing
async fn handler() -> &'static str {
"Hello, World!"
}
// Reuse database connections
#[nestforge::service]
pub struct DatabaseService {
pool: Pool<Postgres>,
}
// Pool manages connections efficiently
pool.get_read().await?;
pool.get_write().await?;
// Deserialize without allocation
use serde_json::Value;
fn process_json(data: &[u8]) -> Value {
// No intermediate allocations
serde_json::from_slice(data).unwrap()
}
use bumpalo::Bump;
fn process<'a>(&self, arena: &'a Bump) -> &'a str {
// Allocate from arena (faster than heap)
arena.alloc_str("hello")
}
Terminal window
# Install wrk
brew install wrk
# Run benchmark
wrk -t12 -c400 -d30s http://localhost:3000/api/users
test.yml
config:
target: "http://localhost:3000"
phases:
- duration: 60
arrivalRate: 100
scenarios:
- name: "User API"
flow:
- get:
url: "/api/users"
- post:
url: "/api/users"
json:
name: "Test"
email: "test@example.com"
Terminal window
artillery run test.yml
Terminal window
# CPU profile with perf
perf record -g ./target/release/my-app
perf report
# Memory with valgrind
valgrind --tool=massif ./target/release/my-app
Cargo.toml
[profile.release]
lto = true
codegen-units = 1
opt-level = 3
Terminal window
cargo build --release
~/.cargo/config.toml
[build]
jobs = 8
FeatureMemory
Base server~5MB
+ Routing~8MB
+ Database pool~15MB
+ Full app< 20MB
Instance SizeConcurrent Users
256MB RAM~10,000
512MB RAM~50,000
1GB RAM~100,000+
ProviderNext.jsNestForge Web
AWS Lambda~$0.02/1M req~$0.002/1M req
Cloudflare WorkersNot available$0.50/1M req
VPSFull Node.js1/10 resources

Lower resource usage means:

  • Less energy consumption
  • Smaller data center footprint
  • Reduced CO2 emissions