|
|||
|
Hey Guys,
My host is throttling my site's performance due to huge load on my shared server. I built the site with Zend Framework and it only gets around 1K to 2K unique visits a day, and I have heard of a lot more traffic than that without causing much load on a server. Anyway, apparently I need to optimize its performance. To first get me started, I took a look at the bootstrap file (index.php). It's size is ~9500KB or about 10MB. It is so large because I have a ton of router statements like this: // router for account activation $router->addRoute('activation', new Zend_Controller_Router_Route_Regex('activate-(.+)-(\d+)\.htm', array('controller' => 'auth', 'action' => 'activation'), array(1 => "code", 2 => "id"), 'activate-%s-%d.htm')); I had to add all of these to keep the link structure of the site before I added the Zend Framework. Is this not the best way to handle this? I would think not, because everyone visits this site needs to check ALL of these router regex's. Does it look like this is a major problem that could be causing me these headache? Any gurus in this forum got a good answer? Thanks! - Doug |
|
||||
|
that is fairly big... you may want to try some lighter method
__________________
Zym Framework - A Zend Framework extension library w/ demo app SpotSec Blog: http://spotsec.com/blog |
|
|||
|
Try this: Improving the performance of Zend_Controller PHP::Impact ( [str Blog] )
Maybe You are also using ajax which initiates framework on every request? |
|
|||
|
The above seems like a good method if you can recreate the link structure. However, I do not have that luxury.
Is this a limitation for using the MVC zend framework with bootstrap file? If you use too many routes in the bootstrap file, it can cripple your application??? If that is true, I wish I would have known that before I got this far into it. There has got to be a solution. I refuse to think that there is nothing I can do about this... Anyone have any other ideas? |
|
|||
|
// Create a routers
$router = $frontController->getRouter(); // returns a rewrite router by default // router for account activation $router->addRoute('activation', new Zend_Controller_Router_Route_Regex('activate-(.+)-(\d+)\.htm', array('controller' => 'auth', 'action' => 'activation'), array(1 => "code", 2 => "id"), 'activate-%s-%d.htm')); // router for articles $router->addRoute('article', new Zend_Controller_Router_Route_Regex('(\d+)/(\d+)/(\d+)/(.+)-(\d+)\.htm', array('controller' => 'article', 'action' => 'index'), array(1 => "year", 2 => "month", 3 => "day", 4 => "title", 5 => "articleId"), '%d/%d/%d/%s-%d.htm')); // router for affiliates $router->addRoute('affiliate', new Zend_Controller_Router_Route('affiliate/:aff/', array('controller' => 'affiliate', 'action' => 'index'))); // router for blog category $router->addRoute('blog', new Zend_Controller_Router_Route('blog', array('controller' => 'index', 'action' => 'category', "category" => "blog"))); // router for technology category $router->addRoute('technology', new Zend_Controller_Router_Route('technology', array('controller' => 'index', 'action' => 'category', "category" => "technology"))); // router for entertainment category $router->addRoute('entertainment', new Zend_Controller_Router_Route('entertainment', array('controller' => 'index', 'action' => 'category', "category" => "entertainment"))); // router for sports category $router->addRoute('sports', new Zend_Controller_Router_Route('sports', array('controller' => 'index', 'action' => 'category', "category" => "sports"))); // router for lifestyle category $router->addRoute('lifestyle', new Zend_Controller_Router_Route('lifestyle', array('controller' => 'index', 'action' => 'category', "category" => "lifestyle"))); // router for science category $router->addRoute('science', new Zend_Controller_Router_Route('science', array('controller' => 'index', 'action' => 'category', "category" => "science"))); // router for business category $router->addRoute('business', new Zend_Controller_Router_Route('business', array('controller' => 'index', 'action' => 'category', "category" => "business"))); // router for gaming category $router->addRoute('gaming', new Zend_Controller_Router_Route('gaming', array('controller' => 'index', 'action' => 'category', "category" => "gaming"))); // router for offbeat category $router->addRoute('offbeat', new Zend_Controller_Router_Route('offbeat', array('controller' => 'index', 'action' => 'category', "category" => "offbeat"))); // router for feature $router->addRoute('feature', new Zend_Controller_Router_Route_Static('feature', array('controller' => 'index', 'action' => 'feature'))); // router for the buy content page $router->addRoute('buy-content', new Zend_Controller_Router_Route_Static('buy-content', array('controller' => 'index', 'action' => 'content'))); // router for newsletter $router->addRoute('newsletter', new Zend_Controller_Router_Route_Static('newsletter', array('controller' => 'index', 'action' => 'newsletter'))); // router for Buying a cup of coffee $router->addRoute('donation', new Zend_Controller_Router_Route_Static('donation', array('controller' => 'index', 'action' => 'donation'))); // router for Registration $router->addRoute('register', new Zend_Controller_Router_Route_Static('register', array('controller' => 'index', 'action' => 'register'))); // router for About Page $router->addRoute('about', new Zend_Controller_Router_Route_Static('about', array('controller' => 'index', 'action' => 'about'))); // router for Contact Page $router->addRoute('contact', new Zend_Controller_Router_Route_Static('contact', array('controller' => 'index', 'action' => 'contact'))); // router for Advertising Page $router->addRoute('advertise', new Zend_Controller_Router_Route_Static('advertise', array('controller' => 'index', 'action' => 'advertise'))); // router for search $router->addRoute('search', new Zend_Controller_Router_Route_Static('search', array('controller' => 'index', 'action' => 'search'))); // router for tos $router->addRoute('tos', new Zend_Controller_Router_Route_Static('tos', array('controller' => 'index', 'action' => 'tos'))); // router for FAQ $router->addRoute('faq', new Zend_Controller_Router_Route_Static('faq', array('controller' => 'index', 'action' => 'faq'))); // router for sitemap $router->addRoute('sitemap', new Zend_Controller_Router_Route_Static('sitemap', array('controller' => 'index', 'action' => 'sitemap'))); // router for disclaimer $router->addRoute('disclaimer', new Zend_Controller_Router_Route_Static('disclaimer', array('controller' => 'index', 'action' => 'disclaimer'))); // router for privacy $router->addRoute('privacy', new Zend_Controller_Router_Route_Static('privacy', array('controller' => 'index', 'action' => 'privacy'))); // router for RSS Feed $router->addRoute('feed', new Zend_Controller_Router_Route_Regex('rss/[0-9+]\.xml', array('controller' => 'rss', 'action' => 'feed'), array(1 => "feedId"), 'rss/%d.xml')); // router for topic RSS Feeds $router->addRoute('feed', new Zend_Controller_Router_Route_Regex('rss/(.+)\.xml', array('controller' => 'rss', 'action' => 'feed'), array(1 => "feedId"), 'rss/%s.xml')); // router for xml sitemaps $router->addRoute('sitemapxml', new Zend_Controller_Router_Route_Static('sitemap.xml', array('controller' => 'index', 'action' => 'sitemapxml'))); I cannot think of anyway I can fix this situation short of changing the urls for everything?! Should I just forget it, suck up my pride, lose the link equity I built in those urls and just have them redone? |
![]() |
| Thread Tools | |
| Display Modes | |
|
|