Serverless, Laravel and RDS Serverless Benchmarks

We have created benchmarks for our Laravel + SLS boilerplate to demonstrate its scalability and to set priorities for the future. To complete our benchmarking, we used a slightly modified version of our demo application that could be put through load tests.

For the purposes of these tests, we didn’t want to optimize the Laravel application for speed. Instead, we focused on assessing and benchmarking the infrastructure around it. This will enable us to concentrate for the time being on the entire operation of our infrastructure. It also helps us identify any root issues that could impact speed and performance.

For testing, the S3 counter implementation was deactivated, and all connected queues were switched off in order to have synchronous processing. During the page call, the MySQL database was read and written once. The DynamoDB was handled in the same way.

AWS RDS Aurora Serverless MySQL 5.6

The aim of each of our benchmarking tests was to get a feel for the required RDS ACUs for our application. We were particularly interested in determining exactly how many requests per second the ACUs are capable of processing. Of course, we have found that you don’t have to worry about these small quantities when using DynamoDB.

  • ACUs
  • Reqs/Sec
  • €/hr
  • €/day
  • €/month
  • 1
  • ~200
  • 0,063€
  • 1,51€
  • 45,36€
  • 2
  • ~350
  • 0,126€
  • 3,024€
  • 90,72€
  • 4
  • ~450
  • 0,252€
  • 6,048€
  • 181,44€
  • 8
  • ~650
  • 0,504€
  • 12,096€
  • 362,88€
  • 16
  • ~1200
  • 1,008€
  • 24,192€
  • 725,76€

1 ACU has approximately 2 GB of memory with associated CPU and network capacity, similar to the user-provided Aurora instances.

Additional costs

- 0,090€ per GB per month for storage

- 0,18€ per 1MM IO Requests

Laravel + Serverless + RDS Aurora MySql Serverless with 16 ACUs
lambda-laravel

Auto scaling behavior

On the screenshot you can see the behavior of the autoscaling very well. A RDS aurora serverless database takes about 10 minutes to scale from 1 ACU 1 to 8 ACUs.

RDS Aurora autoscaling behavior
rds-aurora-autoscaling-behavior

Costs compared to an AWS RDS Aurora MySQL non serverless database

  • Instance
  • vCPU
  •  GB
  • €/hr
  • db.t3.small
  • 2
  • 2
  • 0,043€
  • db.t3.xlarge
  • 4
  • 16
  • 0,29€
  • db.r5.large
  • 2
  • 16
  • 0,32€
  • db.r5.xlarge
  • 4
  • 32
  • 0,57€

The RDS Aurora serverless variant is therefore almost 3 times as expensive then a classic RDS Aurora instance.

ECS Fargate comparison

We configured an RDS aurora serverless database with 8 ACUs and got the following request per seconds with an this ECS Fargate cluster with 2 x 4 VCUs.

ECS Fargate Laravel
ecs-fargate-laravel

Lambda + Gateway prices

As an example, we took figures from 2 of our applications and compared the costs with Lambda & Gateway. Let’s just take a look at the ECS cluster and the EC2 costs without databases.

  • Name
  • Requests/Month
  • ECS/EC2 costs
  • Lambda + API Gateway costs
  • App1
  • 5.000.000
  • 1.285€
  • ~44€
  • App2
  • 1.000.000
  • 134€
  • ~8€

The two applications serve very different customers and have a very large difference in traffic behavior, especially the highly provisioned App1 for large traffic peaks shows a huge price difference to serverless hosting.

With the App2 the difference is not quite so big but this application, of course, always exists in X different environments (stage, feature-1, feature-2, …).