rodosabbath's avatar

How does Laravel handle concurrency?

Hello guys.

I would like to understand better how exactly does Laravel handle concurrency out of the box.

For example, I'm working on a project where a middleware was set up to handle media uploads to S3 via Laravel.

The cenario we are facing is that there can be thousands of requests at the same time.

Thinking about performance, what are good ways of handling these cases?

0 likes
2 replies
Snapey's avatar
Snapey
Best Answer
Level 122

Your web server will spawn new workers for each http request until it reaches the limit. The limit of workers should be adjusted according to the number of CPU and the amount of RAM available.

Each worker has its own independent instance of the application and is largely not aware of other instances. Obviously database records and cache are shared between workers.

In reality, it is unlikely that you are handling thousands of requests 'at the same time', unless you have a server farm and a team of devops.

1 like

Please or to participate in this conversation.