Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2010
    Posts
    3
    Plugin Contributions
    0

    Default Placing images in a CDN service

    Hello,

    Zen Cart is not designed for placing images remotely, such as at a CDN service.

    However, I wonder if someone has been able to manage a patched up solution to this.

    I was able to place the stylesheet in a CDN in this way:

    includes/templates/your_template/common/header_html.php
    around line 43:
    substitute:
    echo '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . $value . '" />'."\n";

    with:

    echo '<link rel="stylesheet" type="text/css" href="http://your_link_to_your_CDN/cdn_path/stylesheet.css" />'."\n";

    Where,
    your_template = your template

    cdn_path = what ever the path to wherever in your CDN you've placed your stylesheet(s)

    your_link_to_your_CDN = whatever link you are using to fetch files from your CDN


    This works like a charm, and has saved quite a bit of latency time in the case of our site.

    However, most of the latency time in the front-end comes from the images. It's easy to end up with 30 or 40 images in some pages, and sometimes the number of requests can be 50 or more. This is a normal situation these days.

    Perhaps, it is possible to trick zen cart to fetch images from a CDN using the same technique I used for the style sheets. However, I'm still looking where are those magic 'echo' statements where the path to the CDN can be placed safely.

    Although this system would make the system to manage images more involved (having to upload normally, and then also keeping track of what's in the CDN, among other things), it would reduce dramatically the latency times of the front-end.

    If somebody has played with this, please let me know. In the mean time I'll keep trying, and post here when I succeed.

    Thanks.

  2. #2
    Join Date
    Aug 2005
    Posts
    26,067
    Plugin Contributions
    9

    Default Re: Placing images in a CDN service

    most of the latency time in the front-end comes from the images. It's easy to end up with 30 or 40 images in some pages, and sometimes the number of requests can be 50 or more.
    Optimize images for the web and get a hosting service that is fast
    There is no need to jump through the hoops you are talking about
    Zen-Venom Get Bitten
    Get Your Business Found

  3. #3
    Join Date
    Jan 2004
    Posts
    58,283
    Blog Entries
    3
    Plugin Contributions
    106

    Default Re: Placing images in a CDN service

    I might suggest that you'll find it to be much less effort and expense if you just put your site onto a server that doesn't have the latency time problem.
    ie: move your hosting to a company and server that's properly tuned for your needs.
    I've seen way too many people cheap-out on low-cost hosting only to be perpetually frustrated because they're using an overloaded turtle when they could increase to a tortoise for a mere few dollars a month by choosing a better company and server.

    Or, you can spend tons of hours working out how to rewrite core systems which force you into paying additional costs for a CDN service, thus increasing your expense not only by the cost of the CDN but also your code development time and also the time to redo that coding with every upgrade that comes out. Shouldn't you be spending the time on growing your business, and not on coding?

    Just a thought.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Sep 2010
    Posts
    3
    Plugin Contributions
    0

    Default Re: Placing images in a CDN service

    Quote Originally Posted by kobra View Post
    Optimize images for the web and get a hosting service that is fast
    There is no need to jump through the hoops you are talking about
    Yes, that's also part of the solution. In fact, I've done that already and cut the number of images, compressed more the ones that were oversized, and used sprites wherever I could, taken out unnecessary image backgrounds, etc. I was able to cut the number of requests and saved a lot of latency time, thus far.

    I also use a good host: rackspace. I'm using Rackspace's 'Cloud Sites', which are supposed to behave well with zen cart (as they say in their marketing pages, but the don't). The MySQL servers (which remain shared) tend to get over loaded too often and the delays at the back-end stage can be substantial, which adds to the problem at the front-end level due still to the number of requests and distance. We're in the process of moving to a dedicated server somewhere else to solve that part of the problem, and allow us to optimize things a bit more.

    Still, and despite all of the above, there is no possible comparison with what it is possible to attain with having the images in a good CDN service, (without having to go to the extremes of Akamai). We are talking about proxy servers that have the images cached near the geographical location of the end user, and that is an ideal situation.

  5. #5
    Join Date
    Jan 2004
    Posts
    58,283
    Blog Entries
    3
    Plugin Contributions
    106

    Default Re: Placing images in a CDN service

    Quote Originally Posted by daniel20 View Post
    I also use a good host: rackspace.
    :cough:
    Quote Originally Posted by daniel20 View Post
    I'm using Rackspace's 'Cloud Sites', which are supposed to behave well
    I have yet to see anyone report consistently good performance from "cloud sites" when using dynamic database-driven systems, whether Zen Cart or otherwise.
    Quote Originally Posted by daniel20 View Post
    The MySQL servers (which remain shared) tend to get over loaded too often and the delays at the back-end stage can be substantial, which adds to the problem at the front-end level due still to the number of requests and distance.
    Exactly.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Aug 2005
    Posts
    26,067
    Plugin Contributions
    9

    Default Re: Placing images in a CDN service

    Still, and despite all of the above, there is no possible comparison with what it is possible to attain with having the images in a good CDN service,
    I beg to disagree...
    What are your current page parse times?
    admin > config > logging > display page parse time > set to on
    Zen-Venom Get Bitten
    Get Your Business Found

  7. #7
    Join Date
    Sep 2010
    Posts
    3
    Plugin Contributions
    0

    Default Re: Placing images in a CDN service

    Quote Originally Posted by kobra View Post
    I beg to disagree...
    What are your current page parse times?
    admin > config > logging > display page parse time > set to on
    First thing first: Thank you both for replying to this so fast and so in context.

    OK, I didn't enable the parse time display, but I went and got a cascade graph. I'm embarrassed for having chosen Rackspace without researching more. Here are the results a couple of minutes ago (not always it's been so bad, by the way):

    Load Time: 19.407s
    First Byte: 6.327s
    Start Render: 6.982s
    Requests: 56
    Document Complete: 19.407s

    This test was performed from Sydney.

    I chose one of my worse pages. By the way I'm using 120x120 in the thumbnails, because image downloading times are negligible in comparison to the request times shown in the graphs.

    Rackspace internal processing: 6.327s (totally unacceptable)
    Front-end for image download: about 13s This is what I mean. The number of requests is 56, which is not exaggeratedly high now-a-days.

    Of course that the users start seeing the page much before the rendering ends, but still even after we have finished moving the site to the new dedicated server located at ubiquity.com, (and I hope they are not another disappointment), it would be ideal if I could cut front-end time.

    But you both may be right: the major problem may be Rackspace. In fact, before Rackspace I had a humble VPS, which behaved much, but much better.

    I have a separate CDN that I'll use with ubiquity's server: I have 1Tb to spend in 1 year with MaxCDN for about $40.

    My customers are really in Australia and MaxCDN won't be having edge servers in Australia but in about 6 mths. So, I may not be able to see a very significant reduction in front-end times until that happens. Right now I'm still using Rackspace's CDN, which doesn't look much as a real CDN when compared to MaxCDN.

  8. #8
    Join Date
    Mar 2011
    Posts
    12
    Plugin Contributions
    0

    Default Re: Placing images in a CDN service

    Hi,

    Just wondering if u cracked the CDN for images in zen cart

    Am trying same and unable to find my way yet...

    Abhishek

 

 

Similar Threads

  1. Placing of Categories
    By butchx5 in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 18 Dec 2009, 11:48 AM
  2. Placing Images (Shadow/Glow/Etc) Around Outside Border of Entire Store
    By BigSash in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 11 Nov 2008, 01:46 AM
  3. placing my Catagories
    By BreezeBoogie in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 30 Jul 2007, 02:10 PM
  4. Placing extra product info images
    By hbtrading in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 12 Jun 2006, 05:14 AM

Bookmarks

Posting Permissions

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