Ace
475
4
Servers

Scaling Laravel - required infrasturcture for a PaaS application

Posted 1 year ago by Ace

I have an application that runs on Laravel and is managed by Forge laravel.

My application sends sms messages campaigns, with specific promotions.

each campaign is scheduled as a cronjob and is executed as queued job that sends 1Ks of messages per minute each time via third party sms providers.

each sms is logged with the third party message_id and is tracked for engagement performance. this means:

a message is created-> sent to RESTful API RestfulAPi ->returns message status etc.

each status change returns a push notification via pusher to a dashboard in realtime. that is: it refreshes an Ajax dashboard per pusher return event.

 I have reached the stage were I need to scale horizontally .

I have looked at htop and other monitoring tools but can't understand how to derive from that how many requests are actually running and what is the required php-fpm setting , pm.max_children , nginx configuration.

I am getting 502 errors when stress testing on a digitalocean 2 core 2GB droplet. 2000 requests per minute fail after 18 seconds with 502.

I have watched https://serversforhackers.com/scaling-laravel/forge/forge-recipes

but am not sure if the structure @fideloper showed is the correct one for this use case.

most of the stress is backend not many users, it is more of a managed automated system, not sure I need a load balancer between the apps. and I'm not using cache for my execution.

from what i have seen using blackfire most of my logic runs fast but mainly uses like 3-5 mb of memory.

your tips and advise appreciated.

Please sign in or create an account to participate in this conversation.