Laravel Vapor reaching limits with Queue and not clear what a solution can be
I'm new to Serverless hosting on AWS. I configured a working serverless environment via Laravel Vapor, but with some issues on a high load.
A high load is 10k requests within seconds, all doing a change in the database.
I use a PostgreSQL-database instance (db.t3.micro) now, not the Serverless version and found out there is some limitation of requests is can handle: “SQLSTATE[08006] [7] FATAL: remaining connection slots are reserved for non-replication superuser connections”
How can I solve this? Replacing it with a Serverless instance or scale the Fixed-size PostgreSQL?
And is the Queue by itself serverless or can I assign more memory to the queue specificly? Or is that combined with the memory the instance itself gets?
This is currently the Vapor.yml-file
id: ---
name: foobar-***
separate-vendor: true
environments:
staging:
warm: 10
scheduler: false
timeout: 60
memory: 1024
queue-memory: 2048
cli-memory: 512
cache: serverless
database: “database-***"
max_connections: 10000
balancer: “**-balancer"
runtime: php-7.4
build:
- "COMPOSER_MIRROR_PATH_REPOS=1 composer install"
- "php artisan event:cache"
- "php artisan migrate --force"
domain: "*.domain.app"
This error relates to your maximum connections on your database.
Call show max_connections;
to see what this limit is. For t3.micro
this would be 112 looking at the AWS documentation.
This would automatically increase with a larger DB instance, however you could just override the parameter in the Parameter Group assigned to the RDS instance.
Change the one called max_connctions
till you find a number that is suitable to you.