Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
copy to CDN - or sync uploads/ to cdn
#1
i spent a few days optimizing some GS sites, researching yslow and google page speed hints.

I decided to use versioning for static files so i activated caching via .htaccess and moved the template to a cdn. GS is performing a lot faster.

Now i have the problem to sync data/uploads/ to my CDN . I use a few scripts, manually modify the links to point to the new location, and that works fine for me.

I guess other users could benefit of that technique, so if someone wants to write a plugin or add that feature to the core, i'm willing to help.
Reply
#2
How did I miss this topic?

marrco Wrote:I activated caching via .htaccess […]
Good move. I put this up on our issue tracker mid July but I haven’t included a .htaccess with caching in any build yet.

How does yours compare to this performance .htaccess, or are you using the same?

marrco Wrote:I guess other users could benefit of that technique, so if someone wants to write a plugin or add that feature to the core, I'm willing to help.

I’d love to give this a try. Shouldn’t be too hard when you’ve already got it to work right? My biggest problem is that I don’t have access to any CDN.
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#3
Quote:I activated caching via .htaccess […]
Good move. I put this up on our issue tracker mid July but I haven’t included a .htaccess with caching in any build yet.

How does yours compare to this performance .htaccess, or are you using the same?

My approach is to keep all static files on a CDN, serve only gzipped css and js and use far future expires to get the best caching. Of course i do versioning, so in my teplates i can reference sitescripts_12.js or sitestyle_08.css

this is my actual .htaccess

- - - -
AddDefaultCharset iso-8859-1
RewriteEngine on

ExpiresActive On
ExpiresDefault A60

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header unset Last-Modified
ExpiresDefault A1209600
Header append Cache-Control "public"
</FilesMatch>

<FilesMatch "\.(html|htm|php)$">
ExpiresDefault A1800
Header append Cache-Control "private, proxy-revalidate"
</FilesMatch>

Header unset ETag
FileETag None

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript text/javascript application/xhtml+xml
</IfModule>

# Usually it RewriteBase is just '/', but
# replace it with your subdirectory path
# RewriteBase www.sitename.com

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9-]+)/?$ index.php?id=$1 [QSA,L]
- - - -
Reply
#4
now the CDN part.
i map cdn.sitename.com to amazon cloudfront distribution, then i use a modified version of this script http://cdn.ww.ossdl.de/syncer.sh to sync only the data/uploads/ folder, using the newest version of s3cmd (available only via cvs at the moment) http://s3tools.org/s3cmd so i have support to the -rr switch

finally i manually modify my pages to link images to cdn.sitename.com

so i think a plugin has to
-- configuration part
-) have huge note telling about the risk of working with cache, far future expires and the need of using versioning
-) ask for amazon/google storage for developers access keys
-) ask for upload bucket name and the distribution domain (cdn.sitename.com)

-- hooked to changedata-save (not sure)
-) sync the data/upload/ running the script
-) modify all xml pages to link to cdn.sitename.com

additionaly I also modify the template, compress and join js using closure compiler service http://closure-compiler.appspot.com/home then join all css and encode and include background images in the files using http://duris.ru/ , finally i manually GZIP the files keeping the same name, and upload to the cdn setting the content type to gzipped and a far future expire date. Of course each time i modify the css or the js i have to redo all of that, including modify the templates to do versioning.

low server load, faster pages, better user experience and a better yslow score too.
Reply




Users browsing this thread: 1 Guest(s)