Benchmarking Serverless Laravel vs Lumen

Test Scenario

Creating the Laravel Test

laravel new laravel-test
composer require bref/bref bref/laravel-bridge
php artisan vendor:publish --tag=serverless-config
cp .env.example .env
$router->get('/test', function () {
return "Hello, world!";
});
php artisan config:clear
composer install --optimize-autoloader --no-dev
sls deploy

Creating the Lumen Test

composer create-project --prefer-dist laravel/lumen lumen-test
cd lumen-test
cp .env.example .env
wget https://raw.githubusercontent.com/brefphp/laravel-bridge/master/config/serverless.yml
$router->get('/test', function () {
return "Hello, world!";
});
composer install --optimize-autoloader --no-dev
sls deploy

Running the Benchmark

...
endpoints:
ANY — https://abcdefghi.execute-api.us-east-1.amazonaws.com/dev
ANY — https://abcdefghi.execute-api.us-east-1.amazonaws.com/dev/{proxy+}
...

Results

Duration: 140.17 ms Billed Duration: 500 ms Memory Size: 1024 MB Max Memory Used: 87 MB Init Duration: 313.36 ms
Duration: 2.58 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 87 MB
Duration: 2.64 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 87 MB
Duration: 2.56 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 87 MB
Duration: 2.56 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 87 MB
Duration: 2.52 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 87 MB
Duration: 2.44 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 87 MB
Duration: 2.47 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 87 MB
Duration: 2.68 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 87 MB
Duration: 2.53 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 87 MB
Duration: 455.10 ms Billed Duration: 800 ms Memory Size: 1024 MB Max Memory Used: 100 MB Init Duration: 341.48 ms
Duration: 8.12 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 100 MB
Duration: 7.96 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 100 MB
Duration: 7.82 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 100 MB
Duration: 8.28 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 100 MB
Duration: 7.64 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 100 MB
Duration: 8.06 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 100 MB
Duration: 7.68 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 100 MB
Duration: 7.81 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 100 MB
Duration: 8.04 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 100 MB

Conclusions

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store