Optimizing Kohana-based Websites for Speed and Scalability

Asked
Active3 hr before
Viewed126 times

1 Answers

speedoptimizingwebsites
90%

What I will say in this answer is not specific to Kohana, and can probably apply to lots of PHP projects., Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers ,Strictly related to Kohana (you probably already have done this, or not):,I totally agree with the XDebug and caching answers. Don't look into the Kohana layer for optimization until you've identified your biggest speed and scale bottlenecks.

Also - you must use caching. I prefer memcache and use it in my models like this:

public
function get($e_id) {
   $event_data = $this - > cache - > get('event_get_'.$e_id.Kohana::config('config.site_domain'));

   if ($event_data === NULL) {
      $this - > db_slave -
         > select('e_id,e_name') -
         > from('Events') -
         > where('e_id', $e_id);

      $result = $this - > db_slave - > get();
      $event_data = ($result - > count() == 1) ? $result - > current() : FALSE;

      $this - > cache - > set('event_get_'.$e_id.Kohana::config('config.site_domain'), $event_data, NULL, 300); // 5 minutes
   }

   return $event_data;
}

Other "speed-optimizing" queries related to "Optimizing Kohana-based Websites for Speed and Scalability"