# Service & load

> Where does a service saturate under load, and what happens there?

- Status: Open
- Record count: 2
- Source: https://www.muhammetsafak.com.tr/en/research/program/servis-yuk/
- Language: en-US
- Author: Muhammet Şafak

---
Latency distribution, saturation point and queue behaviour under load — p95/p99, not the mean; backpressure and circuit breakers included.

## Findings ledger

### I measured PHP and Go on the same OAuth2 API: no gap at 10,000 writes, a real one at 50,000 reads

- Question: The same API verifies an OAuth2 token on every request and then writes to or reads from PostgreSQL. On four cores, how much CPU do PHP-FPM, FrankenPHP worker mode and Go need for 10,000 writes and 50,000 reads a second?
- Finding: At 10,000 writes a second all three candidates hit the target in five runs out of five, and none had a p99 above 2.5 ms: at this load the language is not a capacity line item. At 50,000 reads a second only Go held the target on four cores (p99 6.45 ms); PHP-FPM stopped at 23,528 and FrankenPHP at 22,859. CPU per read request is 64 microseconds for Go, 117 for FrankenPHP and 168 for PHP-FPM. Sized by instance, 50,000 reads take 3.4 cores in Go and 8.2–8.8 cores for the two PHP candidates. FrankenPHP's CPU saving does not turn into capacity: at saturation it leaves about one of its four cores idle.
- https://www.muhammetsafak.com.tr/en/research/php-vs-go-oauth2-postgres-load-test/
- Markdown: https://www.muhammetsafak.com.tr/en/research/php-vs-go-oauth2-postgres-load-test.md

### Seven PHP frameworks under identical load: the gap narrows as soon as the request does real work

- Question: On the same hardware, the same PHP build and the same seven routes, how many requests a second do Laravel, Symfony, CodeIgniter, Yii2, Phalcon, Laminas and Slim serve, and at what latency?
- Finding: On an empty route the fastest is 4.4× the slowest (Slim 25,975, Laravel 5,966 req/s). As soon as the request does real work the gap closes: 3.7× for a single row from the database, 3.5× for twenty rows. Phalcon is third on an empty route and fifth once a query is involved — being a C extension buys nothing while the process waits on MySQL. And the expensive decision is not the framework: Laravel's own default `web` middleware group takes the same response from 5,858 to 2,176 req/s, so one default costs more than most of the distance between the frameworks.
- https://www.muhammetsafak.com.tr/en/research/php-framework-load-test/
- Markdown: https://www.muhammetsafak.com.tr/en/research/php-framework-load-test.md
