Skip to content

About

No description, website, or topics provided.

Resources

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel framework benchmarking (2026)

See the original blog post.

Six implementations of the same small JSON API, built for the Laravel Cloud framework benchmarks. Each uses MySQL and exposes GET /api/v1/chirps for a paginated feed and GET /api/v1/chirps/{id} for a single chirp.

Application Stack
Laravel Rust Rust with Laravel Rust 0.1.0 and its built-in MySQL support.
Laravel PHP Laravel 13 with Eloquent, served by Octane on FrankenPHP.
Beego Go with Beego 2, Beego ORM, and go-sql-driver/mysql.
Django Python with Django 5.2, Django REST Framework, and mysqlclient, served by Gunicorn.
Rails Ruby with Rails 8.1, Active Record, mysql2, and Kaminari for pagination, served by Puma.
Rocket Rust with Rocket 0.5 for HTTP and SeaORM for MySQL.

Reproduce the HTTP benchmarks

Start with a Laravel Cloud organization (growth plan or higher required) and a copy of this repository that it can read. You'll deploy a benchmark app with MySQL, run the traffic from an isolated k6 generator, and export the results. The traffic mix, load profiles, and infrastructure sizes match the blog post. Use dedicated benchmark deployments you control: the ramp deliberately overloads every app.

1. Configure and deploy the benchmark apps

Use these resources in Laravel Cloud in Canada Central (ca-central-1):

Resource Configuration
Each app One fixed Pro replica, 1 vCPU / 4 GiB (pro.m-1vcpu-4gb)
Each app's database Its own dedicated MySQL 8.4 Pro 4 GiB cluster with 5 GiB of storage, in the same region
Load generator A separate 2 vCPU / 8 GiB instance (pro.m-2vcpu-8gb), in the same region; the original generator ran on Linux arm64

Create one Cloud application per implementation you want to test. Select this repository and set the app's root directory to the implementation's directory. Attach its fresh MySQL database and enable a public HTTPS hostname. Keep Cloud's built-in health checks and gzip compression. Set the edge cache strategy to Bypass so requests always reach the app.

Use Cloud's native runtime for each stack and enter these commands in the environment settings. The Rust buildpack puts both Rust binaries on PATH.

App root Build command Deploy command (migrate and seed) Start command
laravel-rust cargo build --release --locked chirper-laravel-rust migrate --force chirper-laravel-rust serve
laravel-php composer install --no-dev --prefer-dist --optimize-autoloader --no-interaction && php artisan config:cache && php artisan route:cache php artisan migrate --force No custom start command
beego-go sh scripts/cloud-build.sh sh scripts/cloud-migrate.sh ./app
django-drf python manage.py collectstatic --noinput python manage.py migrate --noinput gunicorn config.wsgi:application --bind "[::]:$PORT" --workers 2 --worker-class sync --threads 1 --access-logfile - --error-logfile -
rails bundle install bundle exec bin/rails db:prepare db:seed bundle exec puma -C config/puma.rb
rocket cargo build --release --locked --bin chirper-rocket chirper-rocket migrate chirper-rocket serve

For Laravel PHP, select PHP 8.5 under General Settings → Runtime. On the App cluster, enable Use Octane as runtime. Cloud starts Octane with FrankenPHP and generates APP_KEY; keep the generated key.

Set the following under General Settings → Custom environment variables:

App Settings
Laravel Rust APP_ENV=production, APP_DEBUG=false, DB_CONNECTION=mysql, LOG_CHANNEL=stderr, LOG_LEVEL=warning, DB_MAX_CONNECTIONS=20, and a valid APP_KEY
Laravel PHP APP_ENV=production, APP_DEBUG=false, DB_CONNECTION=mysql, LOG_CHANNEL=stderr, LOG_LEVEL=warning, OCTANE_SERVER=frankenphp, OCTANE_WORKERS=4, BENCHMARK_CPU_PROFILE=false
Beego GO_FULL_IMAGE=true (Bee needs Go at deploy time), DB_MAX_CONNECTIONS=10, GOGC=100
Django DJANGO_SETTINGS_MODULE=config.settings, DEBUG=false, CC=gcc
Rails RAILS_ENV=production, RACK_ENV=production, WEB_CONCURRENCY=0, RAILS_MAX_THREADS=3, and APP_URL set to the public HTTPS origin
Rocket ROCKET_WORKERS=1; leave the SeaORM/SQLx connection pool at its default

Use the MySQL connection settings Cloud injects when you attach the database. For Django, confirm DATABASE_URL points to that MySQL database. Use Cloud's injected SECRET_KEY and ALLOWED_HOSTS for Django and SECRET_KEY_BASE for Rails. For Laravel Rust, generate a key once with printf 'base64:%s\n' "$(openssl rand -base64 32)" and save it as APP_KEY. Set APP_URL to the app's public HTTPS origin.

Deploy each configured environment and wait for Cloud to mark its deployment successful.

2. Verify the deployment

Use the 10 authors and 200 chirps installed by the deploy commands as the benchmark dataset. To confirm the counts in MySQL, run SELECT COUNT(*) FROM authors and SELECT COUNT(*) FROM chirps. For Django, use chirps_author and chirps_chirp as the table names.

Set BASE_URL to the deployed app's HTTPS origin, as shown:

BASE_URL=https://your-benchmark-app.example
curl -fsS -o /dev/null -w '/up HTTP %{http_code}\n' "$BASE_URL/up"
curl -fsS --compressed -H 'Accept: application/json' \
  -H 'Accept-Encoding: gzip' -D - -o /dev/null "$BASE_URL/api/v1/chirps"

Confirm both requests return 200. The feed response should be JSON with Content-Encoding: gzip and either Vary: Accept-Encoding or CF-Cache-Status: BYPASS. k6's preflight follows the app's pagination links and verifies the first two pages contain 50 chirps each.

3. Run k6 from the separate generator

Create a standalone Cloud app for the generator. Use the size above, one fixed replica, and root directory k6. Select static serving with public as the document root. Cloud detects Node.js 26 and installs from package-lock.json.

Set Build command to sh build.sh and deploy the generator. The build installs k6 v2.3.0 for Linux arm64 and places the runner in a private directory. Open the generator's public HTTPS hostname to confirm it serves its placeholder page.

Run each command below as a Cloud one-off command in the generator environment. Replace the example URL with the benchmark app's origin. Wait for each run to finish before starting the next. ramp increases offered load linearly from 1 to 2,000 RPS over 20 minutes; steady holds 50 RPS for 5 minutes. Both use 200 preallocated VUs, a 1,500-VU cap, and five-second request timeouts. Each iteration sends one GET. The request mix is 50% latest feed, 20% next page, 10% previous page, and 20% detail reads.

sh public/runtime/.private/run.sh https://your-benchmark-app.example ramp
sh public/runtime/.private/run.sh https://your-benchmark-app.example steady

4. Export each run

The command prints the results directory, for example /tmp/chirper-ramp.aB3xYz. Use a second Cloud command to archive it and upload it to a private bucket. Set RUN_DIR to the printed path and pass a short-lived presigned PUT URL as RESULTS_UPLOAD_URL.

RUN_DIR=/tmp/chirper-ramp.aB3xYz
tar -cf "$RUN_DIR.tar" -C "$RUN_DIR" .
curl -fsS -T "$RUN_DIR.tar" "$RESULTS_UPLOAD_URL"

Download and extract the archive to read the results.

5. Read the results

A completed run produces these files:

chirper-ramp.aB3xYz/
├── benchmark.js           # Exact workload script used for this run
├── start-utc.txt           # UTC timestamp just before k6 starts
├── end-utc.txt             # UTC timestamp just after k6 exits
├── generator-commit.txt    # Generator's deployed Git commit
├── k6-config.json          # Empty config: {}
├── k6-version.txt          # k6 version, OS, and architecture
├── summary.txt             # End-of-run k6 text summary
├── report.html             # Interactive k6 dashboard; open in a browser
└── samples.json.gz         # Raw newline-delimited JSON metrics

Use summary.txt to check for errors and drops. Open report.html to see how load and latency changed over time. Use samples.json.gz to calculate the blog's 10-second windows. With jq installed, run this from the extracted results directory to inspect one measured request duration:

gzip -dc samples.json.gz | jq -n '
  limit(1; inputs
    | select(.type == "Point" and .metric == "http_req_duration"
             and .data.tags.phase == "load")
    | {metric, time: .data.time, value: .data.value,
       tags: (.data.tags | {phase, status, expected_response, scenario})})'

Example output, with only the fields selected above:

{
  "metric": "http_req_duration",
  "time": "2026-11-18T15:22:03.620287232Z",
  "value": 58.078182,
  "tags": {
    "phase": "load",
    "status": "200",
    "expected_response": "true",
    "scenario": "feed_latest"
  }
}

This is one successful feed request that took about 58 ms. In the same file, look for http_req_failed for HTTP outcomes, checks for response validation (1 passes, 0 fails), and dropped_iterations for arrivals k6 didn't start.

Filter request counts, durations, and response checks to phase=load. For dropped_iterations, sum data.value across all points without filtering by phase. Report failed HTTP requests, failed checks, and dropped arrivals separately.

  • Ramp throughput: Bucket points by sample timestamp into non-overlapping 10-second windows from the recorded k6 start time. A http_req_failed point with value 0 is a successful request; 1 is a failure. Among full windows with zero HTTP failures, pick the one with the most successful requests and divide by 10. Report that window's drops and failed checks alongside it.
  • Steady table: Choose the full 10-second window with the most successful requests. If windows tie, use the earliest one for both successful RPS and p50/p95/p99. Compute percentiles from that window's http_req_duration points (milliseconds), including failures. Sort the samples and interpolate at zero-based position (n - 1) × percentile / 100. Report HTTP failures over the entire run.
  • Latency plots: Use only http_req_duration samples with expected_response=true. If a run overloads, break out HTTP 5xx responses and k6 timeouts (error_code=1050) from the failure count.

For both the app and the generator, open Monitoring → Metrics in Laravel Cloud. The Resources chart shows CPU and memory as percentages. Hover over a memory sample to read its value in MiB. For MySQL, open the database cluster's Metrics page.

Choose a preset time range that covers the run. Use only samples whose timestamps fall between start-utc.txt and end-utc.txt. For the blog tables, report the highest app CPU (%) and the highest app memory (MiB) in that interval, not the maximum for the displayed range or just the winning window. Dashboard sampling can smooth short peaks. Compare app CPU with generator CPU and dropped arrivals when interpreting peak throughput.

Record the target commit from the app's Deployments tab. Keep it with the run's generator commit and k6 version, along with the region, instance sizes, and effective worker and connection pool settings.

6. Clean up

After saving the results and telemetry, delete the benchmark apps, generator, and their dedicated MySQL clusters in Laravel Cloud.

Reproduce the build-time comparisons

Cold builds on Laravel Cloud

We measured 100 first deployments for each of the six frameworks in Canada Central, for 600 builds total. Each trial used a fresh Cloud environment and its own MySQL database. Build the same fixed revision for each trial using the Cloud build commands above. Verify the deployment succeeded before counting it, save the logs, and remove the trial resources.

In each deployment's logs, measure from the start of git.clone to the start of prepare.env. This interval includes checkout, image preparation, and the build command, and ends before deployment begins. Report the median, minimum, and maximum of the 100 successful trials for each framework.

Clean and incremental builds on macOS

We ran 100 pairs for each of the three compiled apps: Beego, Rocket, and Laravel Rust. The machine was an Apple M4 Pro with 24 GB of memory, running Go 1.27.4 and Rust 1.99.1 natively on arm64. The incremental-builds branch contains the exact edit from the benchmark: it adds a GET /foo route that returns HTTP 200 in each of the six apps. Only the three compiled apps were timed locally. Its parent commit is the unchanged baseline.

In a fresh clone, run git switch incremental-builds to check out the branch. Download Go modules (go mod download) and Rust dependencies (cargo fetch --locked) in their respective app directories before timing. For each pair, use the same checkout and compiler cache paths for both builds:

  1. Run git switch --detach incremental-builds^. Remove the Go build cache and Beego binary, or the Cargo build and target outputs for the app.
  2. Time the app's build command below, from its directory.
  3. Run git switch incremental-builds. Keep the compiled artifacts and time the same command again. Do not time cleanup or either branch switch.
App directory Timed command
beego-go go build -mod=readonly -o app .
rocket cargo build --offline --locked --bin chirper-rocket
laravel-rust cargo build --offline --locked

Reproduce the wake-from-sleep comparisons

Approximate the wake test by measuring HTTP time to first byte from your laptop or a separate app in the same Cloud region. Use the same probe location for cold and warm requests. Set up a dedicated Flex 2 GiB app with one replica when awake, a one-minute sleep timeout, and edge caching set to Bypass. Keep the app idle between trials.

  1. Confirm that the app's database-independent GET /up returns 200 and that the Cloud API reports one replica. Leave the app idle for at least 75 seconds, then use the Cloud API to check replica count.
  2. Wait for two consecutive zero-replica observations, five seconds apart. Wait another 30 seconds and confirm the count is still zero. Start the wake request within five seconds of that last observation.
  3. Send a single HTTPS GET /up with a unique query string and Cache-Control: no-cache. Record time to first byte from a 200 response, then take three warm measurements and confirm one replica in Cloud.

Report cold time to first byte. You can also report the difference from the median warm time. Label these as HTTP measurements, which include DNS, connection setup, network latency, and app response time.

How the blog measured platform restore time

We used internal Grafana telemetry to verify exactly one restore on the same pod and node and measure the platform's restore time. We counted trials with complete, unambiguous telemetry, a successful restore, and stable counters. That telemetry is internal to Laravel Cloud; the HTTP method above is the customer-accessible approximation.

For each framework in each of the nine regions, we took the first 100 verified, distinct trials by wake request time. We pooled those 900 durations per framework (5,400 total), then sorted them and computed p01, p05, p50, p95, and p99 by linear interpolation at position (n - 1) × percentile / 100, counting from zero. We rounded the results to whole milliseconds.

About

No description, website, or topics provided.

Resources

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages