Performance
Hi
I am new to phreeze
I like all features, but I worry about performance....
Can someone tell me about?
Thanks
The best performance comparison for frameworks that I know of is the Tech Empower benchmarks at http://www.techempower.com/benchmarks/#section=data-r6&hw=ec2&test=query
I link to Round 6 results here because starting with Round 7 I neglected to make some updates to the benchmark code and so Phreeze doesn't appear in the round 7 and 8 DB tests. (I finally had time to submit a pull request so it will be back for round 9)
Phreeze shows up as nearly the fastest PHP framework (nearly as fast as raw PHP) in the benchmarks on EC2, but for some reason shows very poor performance on their i7 hardware - which has been nearly impossible for me to duplicate and figure out what the heck is going on because I do not have access to their own hardware. I've since updated Phreeze and I'm looking forward to the Round 9 results where Phreeze will show up again in the query tests and I'm hoping the i7 results might be more consistent now. (my suspicion, I'm hoping, was that it was an Nginx configuration rather than the PHP code).
However, even though Phreeze should have fast performance - pure speed is only one factor. Phreeze supports caching with memcache as well as master/slave database connections for a replicated DB setup. So in some cases a tiny bit of speed can be traded for the ability to scale up your system with load balanced app servers, DB replication and caching.
Thanks for your reply!
Can you tell me about ORM ?
I read here on some issue about join many tables, you said 5 - 10 tables can cause slow.
Can we use mysql "view" and then query it?
Are you tested it with a large database with many relation?
Thanks
If I said something about 5-10 tables, I may have been talking about a specific situation. But, anyway, there's no limitation to the number of joins.
Basically Phreeze has three methods of dealing with joins. The first is using only the ORM (ie not writing any SQL code) and then configuring the "fetching strategies". On the tutorial video page there is a video that shows how to do this - the video title is "SQL Query Debugging" http://phreeze.com/phreeze/documentation/videos.php
The 2nd way to handle joins is to create what are called "Reporters" which allows you to write any custom SQL that you like. So you can put in any number of joins that you choose. There's a video called "Basic Training 5: Reporters" that explains them.
The third way is to use DB Views - which to answer your other question - yes Phreeze will work with Views. It defaults to read-only mode but you can even override that if your view supports updates.
As for me personally - the biggest tables that I currently work with in Phreeze have somewhere around 3 million records. Obviously there's hardly any situations where you would try to load all of those records into memory. I also have many extremely complex "Reporter" queries that do all kinds of things including aggregate data etc. Phreeze has been in use on several very high volume sites for almost five years, so it is pretty stable.
Hope that helps!
Hi Jason. Could you show how to override the read-only mode for views. I have updateable views and would like each user view to update the underlying tables. Thanks in advance!
No problem, if you want your view to be editable, just open up the Controller for that View -"MyViewController.php" for example.
In the Create, Update and Delete methods you will see TODO lines instructing you to comment out the next line (where it throws an exception). Basically just replace this:
// TODO: views are read-only by default. uncomment at your own discretion
throw new Exception('Database views are read-only and cannot be updated');
with this:
// TODO: views are read-only by default. uncomment at your own discretion
// throw new Exception('Database views are read-only and cannot be updated');
Thanks Jason. I'm creating a new issue regarding database triggers in another thread to keep this one clean