cakephp performances in a big project
I have to develop a big application (an advertising platform, will get more than 10K users and 100K's of listings ) Is it a good idea to choose cakephp for building such a site ?
Thank 开发者_如何学运维a lot
Rasmus(inventor PHP) did not like cakephp much because it had(he benchmarked it a while back so things could have changed) real bad performance. He liked codeigniter the most because it had the best performance. Below the numbers(performance):
cakephp:
Response time: 0.19 secs
Transaction rate: 25.88 trans/sec
codeigniter:
Response time: 0.03 secs
Transaction rate: 305.90 trans/sec
As you can see it was slow as hell(could have changed. You should do a simple benchmark and test to be certain I guess).
The no-framework Framework
He also has this article explaining how he would write his architecture(without framework for best performance).
in the conclusion he says:
Many frameworks may look very appealing at first glance because they seem to reduce web application development to a couple of trivial steps leading to some code generation and often automatic schema detection, but these same shortcuts are likely to be your bottlenecks as well since they achieve this simplicity by sacrifizing flexibility and performance.
Going to disc will be a real performance killer.
This is the most important tip you should keep in mind.
My performance tips
- Use the latest php(5.3) because I read it has massive speed improvement over the older versions.
- Make sure you have enough memory. You need to store a lot of data in memory to get good performance.
- You really need APC(configure it properly) to achieve good performance because it will put PHP opcode in memory which will give you a huge boost.
- You should keep your active dataset in memory by using redis/memcached/etc.
- If you have to do long running tasks process them via a message queue(redis/gearmand/kestrel/etc)
- Follow YAHOO's best practices to speed up your website.
- Don't use a heavy PHP framework. Use something like Codeigniter(Benchmark it).
We had a Cake site that ran 20,000 uniques per day (with ~ 8,000 listings) without any trouble - and that was an install of maybe 3 years without update. So although not quite the scale you're talking about, I don't think it's quite as bad as some people would make out (and is undoubtedly faster these days).
I found CodeIgniter to be better all-round than Cake but that's a personal pref :)
Considering the fact that you expect to serve quite some users, I would advise you to either make your own script (I don't know how experienced you are though), or hiring someone to do it for you.
However, since you give hardly any details on your specific case, I'd suggest you either rephrase your question with more details, or visit an expert to have a chat. That would really help you, especially if you aren't experienced.
That is a horrible idea and wont scale. Keep it light weight and use memcache.
Maybe you could build the admin section of the app in CakePHP since that won't have as much traffic and you could just use regular PHP, Memcached, etc. for the high traffic parts of the site, for example serving the ads.
精彩评论