views:

1086

answers:

3

I have created a facebook application in cakephp. This application is very very slow as compared to other apps. What shall I do to increase it's speed.? Please suggest something as this issue is driving me nuts.. :-(

thanks

+2  A: 

Did you set debug to '0' in core.php? If not, that will give you a huge speed boost.

mgroves
thanks for your help, as suggested by you I did it but there's no speed gain at all :-(
Gaurav Sharma
+3  A: 

we use (soon used) cakephp as well for fb apps

cakephp seems just to be slow.

anyway maybe this helps:

my facebook specific tips and learnings:

  • reduce all api calls to the needed minimum
    • use fbml whereever you can
  • batch all api calls that are batchable
    • batch all fql api calls
  • cache the output of each api call you will need at the next page
    • cache it at memcache or do a ramdisk for cache::file

generic must-do's

  • use memcache
  • do not hit database if not 100% needed
  • do not hit the filesystem
  • do everything you can do async (crondispatcher)
  • use javascript effects to simulate quick response
Andreas Klinger
what is meant by "javascript effects to simulate quick response."?Can you please throw some light on this technique.
Gaurav Sharma
I think he's talking about asyncronous requests, i.e. Ajax
mgroves
basically yes ajax - if you submit a form which adds content to a form dont wait for the response of the server - display it as added contentif you delete content from somewhere send the response to the server and instantly fadeout the element etc
Andreas Klinger
so it means you are able to use ajax in facebook apps..? I have posted another problem here http://stackoverflow.com/questions/1186855/jquerys-ajax-not-working-in-facebook-apps where ajax was not working in the same application.
Gaurav Sharma
+1  A: 

It generally is not the server side code that's slow. I doubt CakePHP is slowing you down. It's the DB access, the Facebook API calls and the HTML rendering (Use YSlow!) that account for 80-90% of the time spent loading an application.

Pierre-Antoine LaFayette
thanks for your answer, but I think cakephp is slow because when I set the debug mode "on" I was shocked to see the number of queries it runs just to show records from a single table..
Gaurav Sharma
Then it is a DB access problem no? Have you tried profiling the server side code? Making multiple queries doesn't necessarily slow things down. Especially if your database doesn't have a lot of data.
Pierre-Antoine LaFayette

related questions