brefphp / bref

Serverless PHP on AWS Lambda
https://bref.sh
MIT License
3.16k stars 365 forks source link

Bref v2 Performance? #1477

Closed anggras closed 7 months ago

anggras commented 1 year ago

After upgrading to v2 seems like my minimum lambda execution time has increased. Before upgrade my minimum execution time can go as low as 11ms, but after the upgrade so far the minimum is 60ms.

App code base is exactly the same.

mnapoli commented 1 year ago

So far I was only able to see improvements in benchmarks: https://github.com/brefphp/benchmarks

Could you detail a bit what you deploy? Did you try ARM? What is the application doing? What is the metric you are measuring? (HTTP response time, lambda duration, API Gateway latency, something else?)

anggras commented 1 year ago

Our application is built with Laravel on PHP 8.1 with 1024 MB allocated memory. ARM likely is not possible at the moment as we are using some libraries that doesn't support ARM yet.

The observation is from the CloudWatch logs on the pretty significant increase in Lambda Duration minimum values.

Will observe for a little while more and maybe build a simple Laravel test app to confirm.

mnapoli commented 1 year ago

Ah understood, thanks for the details.

One thing I could see making a bigger impact is the v2 of the Laravel bridge: did you upgrade it too? Are you seeing the slower latency on cold starts only, or on all requests including warm ones? (it seems to be all requests but I want to confirm)

The new version of the bridge does a bit more things, maybe one thing is either bugged or slow? For example, we now run php artisan config:cache on every cold start (not warm invocations).

mnapoli commented 7 months ago

Closing because of inactivity.