Lewati ke konten
Rama's logo Qisthi Ramadhani
Go back

Benchmarking PHP Health Endpoints with PestPHP Stress Test

In my previous post, I covered how to implement health check endpoints across Hyperf, Hypervel, and Webman. Today, I’ll demonstrate how to benchmark these endpoints using PestPHP’s built-in stress testing tool, with real-world results and insights to help you evaluate performance in your own stack.


What Is PestPHP Stress Test?

PestPHP is a modern PHP testing framework, and its stress command allows developers to simulate high-concurrency HTTP requests against an endpoint. This is useful for measuring throughput, latency, and reliability under load—crucial metrics for production readiness.

Example Command:

./vendor/bin/pest stress http://127.0.0.1:9501/up --concurrency=3 --duration=3

Reading the Results

After running the stress test, PestPHP produces a detailed performance report. Here’s how to interpret the output:

Key Metrics

Example Output Summary

Test Duration:        3.00 seconds
Test Concurrency:     3
Requests Count:       55,932 requests (18,642.49 requests/s)
Success Rate:         100.0%
DNS Lookup Duration:  0.00 ms
TLS Handshake:        0.00 ms
Request Duration:
  - Upload:           1.6%
  - TTFB:             93.5%
  - Download:         4.9%
Upload Rate:          2.15 MB/s
Download Rate:        35.36 MB/s
Status:               Excellent

Benchmarking Results Across Frameworks

I ran the stress test against the /up endpoint in both Hypervel and Hyperf environments. Here’s a breakdown:

Hypervel

Result Hypervel Stress Test by PestPHP

Hyperf

Result Hyperf Stress Test by PestPHP

Webman

First Result Webman Stress Test by PestPHP

Second Result Webman Stress Test by PestPHP


What Do These Results Mean?


How to Benchmark Your Own Endpoints

  1. Install PestPHP: Add Pest to your project with Composer.
  2. Run Stress Tests: Use the stress command as shown above, adjusting concurrency and duration to match your use case.
  3. Analyze: Look for high requests per second, low TTFB, and a 100% success rate.
  4. Iterate: Optimize your application or infrastructure if you see bottlenecks or errors.

Conclusion

PestPHP’s stress test tool provides an easy yet powerful way to benchmark health endpoints in PHP applications. Whether you’re deploying on Hyperf, Hypervel, or Webman, regular load testing ensures your services remain reliable, performant, and cloud-ready.

Feel free to share your own results or ask questions about tuning your endpoints for even higher performance!


Share this post on:
LLM-friendly version:
Open in ChatGPT Open in Claude

Related Posts


Previous Post
Kelas Pakar: Indonesia’s Talent Gap Isn’t Skills—It’s Thinking
Next Post
Building Health Check Endpoints in Modern PHP Frameworks: Hyperf, Hypervel, and Webman