views:

5127

answers:

8

There are a lot of MVC frameworks for PHP. Which one is the best in terms of scalability?

Is there any framework that supports splitting applications on many front end and database servers? Sharding? Other enterprise features?

Ideally the framework should support sites with thousands of concurrent users per server.

I would greatly appreciate if you could specify if your opinion comes from experience and what level of scale was supported by the system.


Edited to address first answers:

Some example of scalability features:

  • Really good caching system (in memory)
  • Advanced database library (support for deadlock retries, for example)
  • If ActiveRecord inspired, support for sharding
  • Does not rely on having front end and back end on the same server
  • Does not rely on application being single-tiered
  • Enterprise-level templating features in MVC
  • Support for database sessions or session server
  • etc...

Scalability is a very well defined term. Some frameworks trade off usability for scalability -- nothing wrong with that, of course -- but that's not what I need.

A: 

I don't know any framework featuring that aspect, and I believe scaling must be addressed on the application level. A framework can hardly do the scalable design job for an engineer.

So, I'd say: just pick the most lightweight, if you do need MVC.

Ivan Krechetov
A: 

Scalability is kind of a hollow term. There is no one thing, that defines scalability - In that sense, it's a bit like security.

troelskn
+8  A: 

Most scalability issues are architectural on a much higher level than the framework used. I don't know of any PHP framework that provides "out-of-the-box" support for splitting an application and sharding.

That said, any of the major PHP application frameworks should support you building your application in a way that will support multiple servers. The beauty of the shared-nothing architecture is that state is pushed to the database and you can add webservers as required. Most database servers support replication and master-slave operation that will let you scale out to a certain point on the front as well.

Sharding a database seems to always be a matter of sharding specfically for your domain/application, so it's a much harder problem.

My advice in this situation is always to think carefully: Are you going to need it?

Toby Hede
I don't know if I need sharding, but I would like that option if the framework is active-record based (in which case it could and should be supported at the framework level).
Sklivvz
+5  A: 

Frameworks I've touched

  • CakePHP - Certainly the most "MVC" complete framework I've used - very much Rails for PHP - you're pretty much bound to work within it's object / relationship model (without serious tinkering) - I've not used this in production however, so can't really comment on it's scalability

  • Zend Framework - Not really a MVC framework per-se - it's a collection of components that you can, if you so choose, wire together to form an MVC framework. Very flexible but very large (if you use it all). Some "community" concerns about performance, but that can be expected with all frameworks. Zend supports native caching of objects etc, and allows you to wire in memcache / apc / zend cache to increase performance. I've used this in small product environments with good results.

  • Code Igniter Not used this (yet), but hearing good things about it - especially on the performance front.

Rasmus Lerdorf (creator of PHP) spoke on the subject of php performance frameworks recently - basically you're never going to get stellar performance if you include a hulking great big framework - but if he had to pick any, it'd be Code Igniter (src

iAn
Performance is not the same thing as scalabilty, though
Toby Hede
Very true, but the better performing, the less prominent scalability becomes. There's a saying "that if you are worried about how to scale with a million users, wait until you have them: when you have a million users, congratulations"
iAn
That is so true... OTOH, many times you have to deliver a system that supports 1M users under load testing (even if the site is a failure).
Sklivvz
+2  A: 

Well, some people at yahoo think that Symfony scales pretty well :

http://www.symfony-project.org/blog/2008/05/08/yahoo-answers-powered-by-symfony

;-)

e-satis
+1  A: 

None of the frameworks currently support database sharding or deadlock retries to my knowledge. As scaling is mostly about the data access system any of the major frameworks could do the job for you. The view and controller aspects are all pretty similar between frameworks so just look for the architecture and style that you like most.

MOdMac
A: 

I would take Fuse Over Cake any day. I like some parts of Cake, but Fuse is definitely the easiest framework I've worked with, and it works intuitively rather than forcing you into complex syntax.

As far as scalability, the latest version of Fuse implements PDO, which is the favored way of doing database access in PHP - it's replacing all of the procedural data access functions. On top of PDO is the simple but (at least as far as I've found) robust Data Model structure, which makes it so that your data access is done via objects. Also, I have never seen a user/group ACL management system that works as easily and as completely as the one Fuse has implemented.

A: 

In benchmarks, PHPulse blows CkaePHP, Codeigniter, Symfony and Zend out of the water. It was used at a telecom where it had to handles a 10TB database and hundreds of connections coming in from multiple countries. It delivered the pages in split second timing.

This is mainly due to the fact that is is architected differently than other frameworks with a database handling the wite heirarchy and metadata allowing for page data to be indexed and cached (not the page itself). The saves on alot of string parsing and creation in trying to duplicate the heirarchy, permissions, an SEO url, site maps, breadcrumbs etc.

PHPulse as a standard is 5-10 times faster than other frameworks and can handle loads that cause other frameworks to crash. It has been tested with 10000 requests (1000 being done concurrently at a time) and was able to finish in 21 seconds while the other frameworks timed out.

If you want scalability and speed, I suggest PHPulse.