{"id":28138819,"url":"https://github.com/wedevsofficial/framework-benchmark","last_synced_at":"2025-05-14T17:17:38.641Z","repository":{"id":47780273,"uuid":"395251306","full_name":"weDevsOfficial/framework-benchmark","owner":"weDevsOfficial","description":"Popular framework benchmarking used as a REST API for a better understanding of speed","archived":false,"fork":false,"pushed_at":"2021-08-13T07:21:37.000Z","size":178,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-14T06:00:01.651Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weDevsOfficial.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-12T08:37:08.000Z","updated_at":"2021-08-13T07:21:40.000Z","dependencies_parsed_at":"2022-09-23T20:01:27.184Z","dependency_job_id":null,"html_url":"https://github.com/weDevsOfficial/framework-benchmark","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weDevsOfficial%2Fframework-benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weDevsOfficial%2Fframework-benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weDevsOfficial%2Fframework-benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weDevsOfficial%2Fframework-benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weDevsOfficial","download_url":"https://codeload.github.com/weDevsOfficial/framework-benchmark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254190422,"owners_count":22029639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-14T17:15:02.273Z","updated_at":"2025-05-14T17:17:38.634Z","avatar_url":"https://github.com/weDevsOfficial.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Framework Benchmark\n\nThe goal of this repository is to benchmark popular frameworks to be used as a REST API in their optimal configuration. \n\n## Ideal Setup\n\n- Default offering of the framework.\n- Optimized suggested state for the framework.\n\n## Testing Tool\n\n- [ApacheBench](http://httpd.apache.org/docs/2.4/programs/ab.html)\n\n## Testing Criteria\n\n- **HelloWorld:** `GET /ping` : Returns a simple `{message: 'pong'}` JSON response.\n    - Command: `ab -t 10 -c 10 http://server.address/ping`\n- **Read:** `GET /users` : Returns a list of 50 users from the database.\n    - Command: `ab -t 10 -c 10 http://server.address/users`\n- **Write:** `POST /users` : Saves a user to the database.\n    - Command: `ab -t 10 -c 10 -p data.json -T 'application/json' http://server.address/users`\n- **Compute:** `GET /compute` : Computes the first 10,000 Fibonacci numbers.\n    - Command: `ab -t 10 -c 10 http://server.address/compute`\n\n## Frameworks\n\n- [Laravel](./laravel) *(v8.54.0)*\n- [Lumen](./lumen) *(v8.2.4)*\n- [Symfony](./symfony) *(v5.3)*\n- [Express](./expressjs) *(v4.17.1)*\n- [Flight](./flight) *(v1.3)*\n\n## System Requirements\n- ApacheBench\n- PHP 8.x or later\n- Swoole PECL extension (for Laravel Octane)\n- All of the projects are using SQLite to avoid heavy setup.\n\n## Project Setup\n- Laravel\n    - Run `composer install`\n    - Run `touch database/database.sqlite` from the `laravel` directory.\n    - Run `cp .env.example .env` followed by `php artisan key:generate` from the `laravel` directory.\n    - Open `.env` file and set the `DB_CONNECTION` variables value to `sqlite` and comment out all the remaining `DB_*` variables.\n    - Run `php artisan migrate` from the `laravel` directory.\n    - To run the project without octane, run: `php artisan serve`\n    - To run the project with octane (make sure swoole pecl ext is installed and enabled): `php artisan octane:install` and then `php artisan octane:start`\n- Lumen\n    - Run `composer install`\n    - Run `touch database/database.sqlite` from the `lumen` directory.\n    - Run `cp .env.example .env` followed by `php artisan key:generate` from the `lumen` directory.\n    - Open `.env` file and set the `DB_CONNECTION` variables value to `sqlite` and comment out all the remaining `DB_*` variables.\n    - Run `php artisan migrate` from the `lumen` directory.\n    - To run the project, run: `php -S localhost:8000 -t public`\n- Symfony:\n    - Run `composer install`\n    - Run `touch var/data.db` from the `symfony` directory.\n    - Create a `.env` file and set the `DATABASE_URL` to: `DATABASE_URL=\"sqlite:///%kernel.project_dir%/var/data.db\"`\n    - Run `php bin/console doctrine:migrations:migrate` and confirm if asked.\n    - To run the project, run: `php -S localhost:8000 -t public`\n- Express:\n    - Run `touch database.sqlite` from the `expressjs` directory\n    - Run: `npm install`\n    - Run: `npm start`\n\nOther than the above mentioned endpoints, each project has two helper endpoints: `/truncate` and `/generate` which truncates the `users` table and generates 50 user records with same key-value pairs to achieve byte-fairness across all frameworks. Performance isn't measured against these two endpoints.\n\nThe data.json file in each project is used during the test for the **Write** criteria.\n\n## Results on Local Machine:\n### Hardware:\n    - Memory: 8GB Apple Unified Memory\n    - CPU: 8-Core Apple Silicon\n\n### **#1: Hello World:**\n| Framework  | Request Per Second   |\n|---|---|\n| Laravel  | 366.19 |\n| Laravel (Octane)  | 1548.85 |\n| Lumen | 1567.74 |\n| Symfony | 145.17 |\n| Express | 1021.3 |\n\n\u003cimg src=\"results/local/rps_helloworld.svg\"\u003e\n\n### **#2: Read:**\n| Framework  | Request Per Second   |\n|---|---|\n| Laravel  | 159.39 |\n| Laravel (Octane)  | 930.98 |\n| Lumen | 246.95 |\n| Symfony | 106.92 |\n| Express | 1545.86 |\n\n\u003cimg src=\"results/local/rps_read.svg\"\u003e\n\n### **#3: Write:**\n| Framework  | Request Per Second   |\n|---|---|\n| Laravel  | 238.62 |\n| Laravel (Octane)  | 921.45 |\n| Lumen | 513.8 |\n| Symfony | 106.48 |\n| Express | 1189.17 |\n\n\u003cimg src=\"results/local/rps_write.svg\"\u003e\n\n### **#4: Compute:**\n| Framework  | Request Per Second   |\n|---|---|\n| Laravel  | 336.79 |\n| Laravel (Octane)  | 1436.07 |\n| Lumen | 1438.68 |\n| Symfony | 122.29 |\n| Express | 984.36 |\n\n\u003cimg src=\"results/local/rps_compute.svg\"\u003e\n\n\u003e *[P.S.: The results may be subject to change as we add more frameworks.]*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwedevsofficial%2Fframework-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwedevsofficial%2Fframework-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwedevsofficial%2Fframework-benchmark/lists"}