Category: Optimization

  • Speeding up client/server response times

    In the past 6 months I’ve switched jobs from being a web developer to being a server side game developer.  So far it’s been an excellent career shift.  I get to focus on my true passions, intelligent back-end code and no longer having to waste my time with frustrating design challenges (there is a separate team that does that).

    Having said that, when developing large Facebook virtual worlds, there are a lot of client/server communication.  For example, each time someone buys something, each time you buy something, etc…  Currently, a lot of games wait for the server to respond, but why should we?  There are a lot of server calls that are done for informational purposes; just to keep the database up-to-date.  So I ask you, why should the end user wait for the server to catch up?  Let’s examine a simple approach to alleviate the need for the client to wait. (more…)

  • Optimizing CakePHP Websites

    CakePHP offers a lot of functionality to us as developers. The ability to develop websites rapidly provides a trade-off in how quickly the website will load. As we expand our skills, we will learn the techniques that will slow down/speed up performance.

    Objectives

    • Apply techniques to speed up CakePHP’s load time
    • Optimize our queries
    • Cache query results

    (more…)

  • Caching Queries in CakePHP

    If you haven’t noticed already, at times CakePHP can be a little slow loading!  The reason for this is quite simple.  Rapid Application Development.  To allow for RAD, sometimes we must give up something, in this scenario it’s a bit of speed when loading.  Don’t worry, CakePHP offers some excellent utilities to help with this.

    The one I will focus on today is caching our CakePHP query results.  The key to this is, we are caching the results, not the queries themselves.  If you know databases well, you may be thinking, “why do I want to cache queries, doesn’t my database server do this already?”  The answer to the question is, yes it does.  However, CakePHP still needs to call the database query and parse your results.  What I’m proposing, will avoid both of those steps and allow you to just retrieve the results.

    This process not only avoids excess load on the database, it also reduces PHP’s processing time that CakePHP has to do to provide you with such useful arrays. (more…)

  • Optimize your CSS and JS with CakePHP in minutes

    One of my first articles discussed YSlow.  An excellent Mozilla add-on to help you understand why your web page may be loading slowly.

    In that article, I describe the importance of gzip, minify, and grouping your Javascript and CSS code into one file each.

    Just recently I was surfing CakePHP’s bakery and found a nice add-on to simplify the process and make it super easy. (more…)

  • When to use element() and when to requestAction()

    Several times a week it seems, someone at my office is asking, “Jamie, should I use $this->element() or $this->requestAction()?”

    Every time they ask, I ask them back, “What do you need to do?”

    There are a few simple ways to determine if using an element is better or a request action is better. (more…)