chingologram / bref-blog

Small Lumen-on-bref POC with a blog API on serverless-cli

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lumen Blog example on Bref POC

This is a sample proof-of-context of running the Lumen microframework on Bref.

Components

The project consists of a simple set of API endpoints that instantiate and interact with an RDS MySQL instance in a VPC. The example is based on the Serverless framework for easier configuration of the AWS functions and resources, and easier transition to multi-cloud.

Deploying

Performance

Warm start

With the container already initialized, latency for a simple endpoint executing a query is consistently < 100ms.

Warm start

Cold starts

Latency is > 1 second when performing a cold start.

Cold start

Cold starts are a common issue in Lambda architecture and it seems to be more prominent in Bref.

Cold start times seems to have a correlation with packaged runtime size. Note that, for this Lumen installation, the packaged vendor folder is ~10 MB. Taking this into account, performance seems comparable to that of NodeJS with same packaged size.

Latency wrt. size

As per benchmark on https://mikhail.io/serverless/coldstarts/aws/

Note that Lumen already comes with much of the Laravel tooling, which makes it less likely to require extra packages in comparison to other skinned down frameworks like Slim, or ExpressJS. Included functionality:

  • Eloquent ORM
  • Mailers
  • Queues
  • Cache (redis/memcached)
  • Encryption
  • Validation
  • Dependency injection
  • Logging

Solutions for cold starts are similar to those for other runtimes: hitting the endpoint periodically to keep containers alive. An easy workaround is to use the Serverless warmup plugin.

About

Small Lumen-on-bref POC with a blog API on serverless-cli


Languages

Language:PHP 100.0%