Forum Moderators: phranque

Message Too Old, No Replies

Optimizing Performance

         

Stealth1

3:14 am on Mar 21, 2010 (gmt 0)

10+ Year Member



I am trying to clean up my site and improve the speed as much as I can. Just uses Yslow initially to see what I can improve.

The part I am looking to improve is my oscommerce webstore which I have spent alot of time improving and it is fairly fast.

Yslow is indicating the following things as being issues.

F - Use a Content Delivery Network (CDN)
Grade F on Use a Content Delivery Network (CDN)
There are 13 static components that are not on CDN.

F - Add Expires Headers
Grade F on Add Expires headers
There are 12 static components without a far-future expiration date.

F - Configure Entity Tags (Etags)
Grade F on Configure entity tags (ETags)
There are 11 components with misconfigured ETags

All of these refer to basically the same things, some images used for the design/layout of my site, one for the SSL seal and one for the stylesheet.css.

I have Gzip Compression set to 1, 9 is the maximum but i'm not sure if there is any negative effects setting it to maximum.

I am wanting to use expires headers to specify certain objects expiring down the road but I can't seem to find information on how to do this.

Thanks in advance

JS_Harris

5:13 am on Mar 21, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Less is more when it comes to speed and performance.

Before digging into all of the "report card" symptoms look at the source code of a page you want optimized. Next figure out how much of the code can simply be removed or condensed. Do you really need all of the fancy javascript effects? The cool gizmos? The redundant sitewide code? The large image files? The whitespace... etc ?

When you've minimized what's on the page you'll get better results maximizing what is left. Clean up the room before you shampoo the carpets!

Stealth1

5:42 am on Mar 21, 2010 (gmt 0)

10+ Year Member



Thanks for the Reply

To be honest I am lost when it comes to code, I can implement it when I am told what to do and understand how to use certain things but that's the extent of my experience.

My site is pretty fast overall right now I would just like to clean up these little things as they seem to be the only major things causing slowness.

phranque

10:10 am on Mar 21, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld [webmasterworld.com], Stealth1!

what type of server are you using?

unless you are in the big leagues using a CDN will be cost-prohibitive, so don't worry about failing that one.

ETags are unique identifiers for web resources.
if the content changes, the ETag changes, so it is easy to identify if something has changed and therefore needs to be transmitted since the last time it was requested if the ETag is provided.

using an Expires header allows the requested resource to stay cached longer since it is then not requested again until it expires.

the method for configuring the server to send the ETag and Expires headers depends on the server type.
for example using the mod_expires apache module you can specify the ExpiresDefault Directive [httpd.apache.org] to provide an expires header a fixed length of time into the future for all files served from an image directory.

londrum

12:11 pm on Mar 21, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



you can set the expire headers with the .htaccess file

# cache gif, jpg, and png files for one week
<FilesMatch ".(gif|jpg|png)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>


best thing to do with Etags is just disable them. you can do that with the .htaccess file as well

# disable etags
FileETag none

phranque

1:11 pm on Mar 21, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



you should use mod_expires to set up max-age in the cache control header.
read this WebmasterWorld writeup about how to Set up Cache Control and Expires headers [webmasterworld.com].

and i would suggest using:
FileETag All

Stealth1

3:58 pm on Mar 21, 2010 (gmt 0)

10+ Year Member



phranque - I am on an Apache server.

Is it ok to disable ETag's? Is there any benefit to having them?

I will take a look at that info on the expires header and cache control stuff.

Can this code be used on the .swf file for the godaddy ssl and for the .css files as well?

# cache gif, jpg, and png files for one week
<FilesMatch ".(gif|jpg|png)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>

phranque

8:41 pm on Mar 21, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



there is no single "correct" answer regarding ETags - it depends a lot on your server configuration and application.
lots of discussion about ETags here:
"High Performance Web Sites: Rule 13 – Configure ETags (Yahoo! Developer Network Blog)" [developer.yahoo.net]

mack

9:17 pm on Mar 21, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



By going right back to your source code its amazing just how much white space can be removed. This can all add up to quite an improvement in load speeds and bandwidth usage especially if the source you edit is a template for a dynamic site.

Mack.

Stealth1

9:32 pm on Mar 21, 2010 (gmt 0)

10+ Year Member



I am on a shared hosting plan, not sure if things are stored on multiple servers or not which is what I am reading as being the problem with Etags?

If I put the below in my .htaccess file does it automatically start making etags for objects?

FileETag All

Stealth1

9:38 pm on Mar 21, 2010 (gmt 0)

10+ Year Member



Should I set Gzip compression higher than 1 of 9?

I have come across this code which was suggested to be used in combination with the OScommerce Gzip compression to remove whitespace etc.

function compress_buffer ($buffer) {
# Return the compressed buffer
return str_replace("\n", ' ', preg_replace('/\>\s+\</', '> <', $buffer));
}