GTHell's avatar

Is Laravel scalable?

I know all of my project is just a one in a life time project that will never get scale. But out of curiosity, is it scalable? Get into argument with some JS warrior and spring warrior who just proud of theirs project being written in Java & Javascript but the code is pure spaghetti, no patter, no good practice and said that Laravel ain't scalable but JS framework. I can't find a good point to say that it is.

0 likes
19 replies
GTHell's avatar

@lostdreamer_nl php as a language is scalable but for Laravel as a framework, there's still question missing its answer.

D9705996's avatar

The choice of framework doesn't inherently imply an ability (or lack of) to scale. The main contributing factor on whether you can scale an application is related to your underlying architecture, both application and technology stack.

You can scale the number of request by load balancing the HTTP requests with a load balancer like HAProxy, Database can be scaled with a MySQL cluster, implementing an authentication scheme using token based authentication can remove the need to deal with session state (and the scaling issues this brings - sticky sessions!).

Have a look at the excellent Scaling Laravel series for more in depth details. A common theme though is as you scale an area ot your application/technology stack you inherently increase the complexity of the system as a whole e.g. more moving parts but you also increase the robustness of the solution (when architected correctly) to allow for redundancy and reduce single points of failure

1 like
douglasakula's avatar

Php as a language has matured - is faster, fully object oriented and coupled with the right technology stack - it should not be an issue when scaling is required

lostdreamer_nl's avatar

@gthell As i said, because PHP is fully scalable Laravel is as well.....

All you need to make sure is that your architecture can scale (DB / Redis / Elastic etc.)

Cronix's avatar

I used to have a laravel app that was originally on a single server. Now it's spread out across 7 servers and getting over 1.5M unique pageviews/month and growing. AWS autoscales it, so if I get more traffic it will just add more servers to handle the extra load. Is that what you mean by scalable? Laravel really has nothing to do with it.

2 likes
GTHell's avatar

@cronix not sure what other people think of what scalable is but to me it's about handling more request.

D9705996's avatar

The Wikipedia definition of scalability

Scalability is the capability of a system, network, or process to handle a growing amount of work, or its potential to be enlarged to accommodate that growth

1 like
jlrdw's avatar

Practically all modern web application languages are scalable. That is if you follow the definition of scalability.

As far as individual Frameworks some of them leave much to be desired.

But of course you do realize that even in laravel you don't even have to use the database facades, you can actually use your own database wrapper right inside laravel if you desire.

I wouldn't do that, but it came in handy once while converting an application from an older framework to laravel.

Taylor made it very very flexible to use.

Cronix's avatar

Ok. The answer is "Yes, laravel is scalable." Plenty of people are doing it. I guess we can debate semantics, but php or laravel really have little to do with it outside of how efficient your code is.

If you create a to-do app and it takes your app 128M of memory and 1 second per request, and mine uses 5M of memory and takes 200ms per request, obviously I can handle a lot more requests/second than you can on a single server. You can just throw more servers at it to handle a larger load. They sky is the limit.

1 like
Zenith2012's avatar

@CRONIX - Hi Cronix,

Any chance you could expand on your configuration. I've used php and mysql for years and I understand the principles of how to scale applications but never attempted it (mainly because I've never needed to).

In a project I'm just starting out on I've pushed the session data to the database. At the time I did thought it may also help if I ever need to scale the application to multiple servers in the future (I did it for other reasons).

How do you handle DB replication and when a new server spins up how does it retrieve the code base for your app, does it grab it from github or something similar?

tykus's avatar

Thanks for registering especially to post that comment on a thread that is more than 1 year old @nevercode

jlrdw's avatar

It's kind of like the inventor of PHP once said big companies are going to have in house custom Frameworks that's tailored to their needs.

I am sure a large company like FedEx would not want to update every 6 months. Same for a large insurance carriers like Humana, I could not even comprehend having to update every 6 months when you're dealing with tens of millions of Records just because oh wow a new version came out.

No reply is necessary or even applicable.

aurelianspodarec's avatar

@Cronix So you mean such companies woud not update the framework or they just create their own framework instead of using things like laravel?

Splashsky's avatar

That's inherently false. Laravel can handle any number of requests you throw at it so long as your infrastructure can support said weight. You really didn't provide any decent argument, especially since Laravel has a nice portfolio of mid-to-big business that use it.

JackEllis's avatar

@undrwd Thanks for sharing this. Laravel scales with ease, and I don't understand why people are claiming it doesn't :L

danroa96's avatar

The question is very ambiguous. Since PHP is a mature language, of course it is possible to build a system that scales to millions of requests. In fact, cloud providers have made this task easier with Load Balancing services that allow you to elastically provision servers, allowing for automatic server scaling and cost savings.

The real problem with scaling a system lies in the architecture of the system, which is agnostic to the framework or language. Laravel, like other frameworks, provides you with configurations by convention, which allows you to build a fairly scalable system at the beginning of almost every project. But since it's a framework, it doesn't solve all your problems, it just provides you with a way of working. As you progress through the build you must make design decisions and like any decision in software development there are no right or wrong answers, there are trade-offs.

Frameworks are designed to abstract you from bad decisions as much as possible, but if you don't bother to understand what makes a system scalable, little by little you will have to pay more money for your system to respond to the demand of requests and what is worse, your system will be more inflexible to changes and each change will cost you more, which will end up killing your system and then you will say "Laravel does not scale, let's make the system from scratch in this new framework" and there you will start again . So instead of asking, does Laravel scale? Ask yourself better, what makes a scalable system?

Please or to participate in this conversation.