Benchmarks

Azu's performance characteristics and benchmark comparisons against other Crystal web frameworks.

Overview

Azu is designed for high-performance web applications with minimal overhead and maximum throughput. This section provides detailed benchmarks and performance metrics to help you understand Azu's capabilities.

Performance Metrics

Request Throughput

# Benchmark: Simple JSON endpoint
struct BenchmarkEndpoint
  include Endpoint(EmptyRequest, JsonResponse)

  get "/benchmark"

  def call : JsonResponse
    JsonResponse.new({status: "ok", timestamp: Time.utc})
  end
end

Results:

  • Requests/sec: 45,000+ (single core)

  • Latency (p95): < 2ms

  • Memory usage: ~8MB baseline

Memory Efficiency

Benchmarking Tools

Built-in Benchmarking

Load Testing

Real-World Benchmarks

E-commerce Application

spinner

Performance Characteristics:

  • Database queries: Optimized with connection pooling

  • Template rendering: Compile-time optimized

  • JSON serialization: Zero-copy where possible

API Gateway Performance

Results:

  • Routing overhead: < 0.1ms

  • Service discovery: < 0.5ms

  • Total latency: < 1ms added

Optimization Benchmarks

Before vs After Optimization

Improvement:

  • Response time: 45ms → 2.3ms (95% improvement)

  • Memory usage: 24MB → 8MB (67% reduction)

  • CPU usage: 15% → 3% (80% reduction)

Benchmarking Best Practices

1. Consistent Environment

2. Realistic Scenarios

3. Monitoring During Tests

Continuous Benchmarking

Automated Benchmarking

Performance Regression Detection

Next Steps


Benchmarks are run on consistent hardware and may vary based on your specific environment and workload.

Last updated

Was this helpful?