+ Reply to Thread
Results 1 to 7 of 7

Thread: Causing HUGE load on the Server

  1. #1
    dlbrown06 is offline Junior Member
    Join Date
    Mar 2008
    Posts
    11

    Default Causing HUGE load on the Server

    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

  2. #2
    SpotSec's Avatar
    SpotSec is offline Senior Member
    Join Date
    Feb 2007
    Location
    United States
    Posts
    122

    Default

    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

  3. #3
    dlbrown06 is offline Junior Member
    Join Date
    Mar 2008
    Posts
    11

    Default

    I understand that it is fairly big, thats why I am in here asking is there is a better method to do this?

  4. #4
    xorock is offline Junior Member
    Join Date
    Mar 2008
    Posts
    17

    Default

    Try this: Improving the performance of Zend_Controller PHP::Impact ( [str Blog] )

    Maybe You are also using ajax which initiates framework on every request?

  5. #5
    dlbrown06 is offline Junior Member
    Join Date
    Mar 2008
    Posts
    11

    Default

    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?

  6. #6
    gog
    gog is offline Junior Member
    Join Date
    Jul 2008
    Posts
    8

    Default

    Your script has 10 MB ?!?!?!?!?

    How many routes do you have on your site?

  7. #7
    dlbrown06 is offline Junior Member
    Join Date
    Mar 2008
    Posts
    11

    Default

    // 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?

+ Reply to Thread

Similar Threads

  1. Cannot Load Class
    By socceroos in forum General Q&A on Zend Framework
    Replies: 4
    Last Post: 07-26-2010, 11:41 PM
  2. Migration from cgi server to a apache server
    By benni87 in forum Installation & Configuration
    Replies: 0
    Last Post: 12-21-2009, 01:48 PM
  3. Incredible memory usage on public server, normal on dev server
    By jollyr0ger in forum General Q&A on Zend Framework
    Replies: 0
    Last Post: 11-05-2009, 01:58 PM
  4. Replies: 0
    Last Post: 07-29-2009, 12:06 PM
  5. What's causing this error message? ZF setup
    By shibuya in forum Installation & Configuration
    Replies: 27
    Last Post: 06-21-2009, 07:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts