gzip works great!

gzip works great!

Postby bigdogglen on Thu Dec 29, 2005 5:59 pm

One of the things that LifeType doesn't come with by default is a way to gzip it's pages. If you don't know what gzip is you can google it and find some pretty good docs, etc.

If your server supports it (you'll know right away :shock: ), add this code at the very top of each php page:

Code: Select all
<?php ob_start("ob_gzhandler"); ?>


I added this command to admin.php and blog.php to test it, and it has shrunken the page sizes and load times of the blogs at least 50%. I only tried it on those two pages, but I bet it could work on other php pages as well. Admins, is this legit? Will it mess with LifeType's performance in other things?
bigdogglen
 
Posts: 146
Joined: Fri May 06, 2005 2:09 pm

Postby phunkphorce on Fri Dec 30, 2005 9:37 am

I don't think this should have any negative effect.

We could add this in the next release, would you mind creating a feature request in bugs.lifetype.net?
phunkphorce
Lifetype Expert
 
Posts: 9028
Joined: Mon Aug 25, 2003 6:34 am
Location: Suomessa

Postby youngmug on Fri Dec 30, 2005 3:11 pm

You can also add this line in your .htaccess:

Code: Select all
php_flag zlib.output_compression On


That will turn on gzlip compression for all pages without a need to edit the pages themselves.
youngmug
Lifetype Expert
 
Posts: 145
Joined: Thu Aug 12, 2004 2:01 am
Location: California, USA

Postby jondaley on Sat Dec 31, 2005 11:15 am

I think it is alright. We want to avoid adding it to the .htaccess file by default, maybe leave it commented or something, so we don't get people saying "how come I get a 500 error when I load LifeType?? Doesn't happen with {insert name of other inferior blog product here} :)
jondaley
Lifetype Expert
 
Posts: 5971
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

sounds good!

Postby poolie on Sat Dec 31, 2005 11:15 am

does anyone have any experience if that uses a lot of serverpower/usage?

edit: i guess i found some answers here: http://www.frontpagewebmaster.com/m-266054/tm.htm
the wiki loves you, the api is your friend.
kulando Blog Hosting.
poolie
 
Posts: 157
Joined: Sat Apr 16, 2005 4:44 pm
Location: Germany

Postby jondaley on Sat Dec 31, 2005 11:32 am

Looks like a nice forum thread there. I found this link there too:
http://www.seoconsultants.com/articles/ ... ession.asp

Avoid the needless recompression of images as this may actually increase their file size or introduce distortion.


As well as a thingy that will check the potential for compression on your pages. On my lifetype main page, it reports an decreased size of 80%
jondaley
Lifetype Expert
 
Posts: 5971
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Postby jondaley on Sat Dec 31, 2005 11:37 am

In my php.ini. Not totally sure what it means, other than probably some people will have trouble. So, as long as it isn't on by default, I think it should be alright.

; Note: You cannot use both "mb_output_handler" with "ob_iconv_handler"
; and you cannot use both "ob_gzhandler" and "zlib.output_compression".
;output_handler =

; Note: You need to use zlib.output_handler instead of the standard
; output_handler, or otherwise the output will be corrupted.
zlib.output_compression = Off
jondaley
Lifetype Expert
 
Posts: 5971
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Postby jondaley on Sat Dec 31, 2005 12:01 pm

Installed it on my blog, and I can't see any noticeable server usage change.
jondaley
Lifetype Expert
 
Posts: 5971
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Postby bigdogglen on Sat Dec 31, 2005 12:12 pm

Not trying to compare LifeType to other CMS alternatives but... :D
many of them have the ability to turn on gzip in the admin page. It's just a simple checkbox or radio button.
bigdogglen
 
Posts: 146
Joined: Fri May 06, 2005 2:09 pm

Postby poolie on Sat Dec 31, 2005 1:29 pm

yeah i know that of oscommerce which has that option.
hmm with some thousand blogs on a system this sounds interesting, i give it a try.
the wiki loves you, the api is your friend.
kulando Blog Hosting.
poolie
 
Posts: 157
Joined: Sat Apr 16, 2005 4:44 pm
Location: Germany

Postby jondaley on Mon Jan 02, 2006 4:58 pm

Seems like a bit of a scary admin flag to me - particularly if the admin pages are compressed too. We would add a php.ini or append to .htaccess file, and everything comes crashing down when the server doesn't support that option.
jondaley
Lifetype Expert
 
Posts: 5971
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Postby markwu on Mon Jan 02, 2006 8:43 pm

Maybe try this:

Code: Select all
if ( !(@ini_get('zlib.output_compression') == '1' || @ini_get('output_handler') == 'ob_gzhandler' || @version_compare(PHP_VERSION, '4.2.0') == -1) ) {
    ob_start('ob_gzhandler');
}


It will activate gzip handler only when server allowed.

Mark
markwu
Lifetype Expert
 
Posts: 920
Joined: Wed Mar 31, 2004 1:59 pm

Postby Guest on Wed Jan 04, 2006 3:45 am

any side effect when using this?

say.

CPU load VS bandwdith trade-off ?
Guest
 

Postby Guest on Wed Jan 04, 2006 4:04 am

why not use apache mod_gzip ?
Guest
 

Postby jondaley on Wed Jan 04, 2006 8:42 am

There is a cpu load vs bandwidth tradeoff, but I have not noticed it on my blog. For people who already get in trouble with their hosts about using too much CPU, this is not going to help.

I think mod_gzip (or mod_deflate) are fine options as well. You have to teach it to compress php output, and I imagine some people might not have that module available to them.
jondaley
Lifetype Expert
 
Posts: 5971
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Next

Return to Configuration and Installation

cron