|
|
|
||||
|
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() |
|
|||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
|
Thread Tools |
|
|
#1 |
|
Confirmed User
Join Date: May 2001
Posts: 2,944
|
Speed up your pages. Use less bandwidth.
A client just installed this on his site and reported a 42K (80%) reduction in the data delivered when visiting his main page. That makes for faster load times and a major bandwidth saving.
This method utilizes gzip which is available by default on most servers these days. It can be used on any type of site, but since images are not gzipped, the main benefit is for sites using lots of text and/or code. Blogs are obviously prime candidates and also the reason I went this route rather than mod_gzip. It causes problems with WP-Cache, as does telling WordPress to deliver gzipped pages. I also wanted a solution which would gzip all the pages on a site, not only php pages generated by WordPress, but also static HTML pages. I did not want to have to add code to every page. And I didn't want any problems with Zend. This appears to satisfy all those conditions. Save this code to a file called compress.php: Code:
<?php $file = $_SERVER["PATH_TRANSLATED"]; readfile($file); ?> Code:
<?php ob_start("ob_gzhandler"); ?>
Code:
<?php ob_flush(); ?> Code:
AddHandler compress .html Action compress /compress.php php_value auto_prepend_file /full_server_path_to_your_root_directory/begin_gzip.php php_value auto_append_file /full_server_path_to_your_root_directory/end_gzip.php I have tested this on several sites for more than a month, primarily sites using WordPress 2.1 and WP-Cache2, plus a variety of other plugins and scripts. The only glitch seems to be with scripts such as Comus which have slow-running routines for things like creating thumbnails. What happens is that you click the button to begin the process and you will not see an intermediate page (telling you the work is in progress). Everything functions as it should, but you will not see anything until the next page comes up when the job is complete. As far as your surfers are concerned, the site runs normally and there are no browser incompatibilities. If an old browser doesn't understand gzip, it simply gets "regular" code and text. There may be a very small-payoff in processor load, but unless your server is close to the edge, nothing that will make any practical difference. If you follow the instructions and it does not work, beyond checking that your server has gzip (plain gzip, not mod_gzip) enabled, I should assume you are using something it doesn't like and give up. But it will only take 5 minutes to find out and if all is okay, the savings can be significant. |
|
|
|
|
|
#2 |
|
Confirmed User
Join Date: Aug 2006
Posts: 7,875
|
some really techie stuff here
__________________
![]() Join the fucking best in big tit sponsors!!! |
|
|
|
|
|
#3 |
|
Confirmed User
Join Date: May 2001
Posts: 2,944
|
|
|
|
|
|
|
#4 |
|
So Fucking Banned
Join Date: Oct 2003
Location: In a house.
Posts: 9,465
|
of course, you could just move on to apache2 and stop worrying.
It would also be interesting to see what the implications are of this strategy on CPU usage. It would appear that you are handing your server a ton of processing work to do to keep serving pages. At what point do you run out of processing before you run out of bandwidth? |
|
|
|
|
|
#5 |
|
Confirmed User
Join Date: Oct 2002
Location: European Union
Posts: 1,752
|
Can external css files be compressed in some way?
|
|
|
|
|
|
#6 |
|
Spread The Pink!
Join Date: Nov 2004
Location: pinktown!
Posts: 8,229
|
__________________
tassy*PINK * ICQ ~ 318*097*066 * |
|
|
|
|
|
#7 | |
|
Confirmed User
Join Date: May 2001
Posts: 2,944
|
Apache2, like the most recent versions of mySQL and to a lesser extent, PHP, tend to solve some problems while introducing others: at least until everyone catches up with them. For that reason, I must admit I tend to upgrade underlying stuff slowly.
Quote:
|
|
|
|
|
|
|
#8 |
|
RIP Dodger. BEST.CAT.EVER
Industry Role:
Join Date: Dec 2002
Location: NYC Area
Posts: 18,450
|
will that work in conjunction with mod_gzip?
__________________
-uno icq: 111-914 CrazyBabe.com - porn art MojoHost - For all your hosting needs, present and future. Tell them I sent ya! |
|
|
|
|
|
#9 |
|
Confirmed User
Join Date: May 2001
Posts: 2,944
|
No idea. I specifically wanted to avoid mod_gzip although somewhat embarrassingly, I can't even remember why now. Anyway I checked it out first and there was at least one of the requirements I mentioned in my first post, that it didn't meet.
The main thing is this takes a couple of minutes to set up and as long as it takes to delete those lines from htaccess, if it doesn't work and no damage done. |
|
|
|
|
|
#10 |
|
Too lazy to set a custom title
Industry Role:
Join Date: Sep 2005
Location: Canada
Posts: 10,492
|
Do you think we could apply that to GFY? Things are loading so slowly lately :P
__________________
skype: lordofthecameltoe |
|
|
|
|
|
#12 |
|
making it rain
Industry Role:
Join Date: Oct 2003
Location: seattle
Posts: 22,243
|
I'm the same way, every time I try to go with Apache2 on a new box it lasts for about a day before I get frustrated and go back to 1.3.
|
|
|
|
|
|
#13 |
|
Confirmed User
Join Date: May 2001
Location: ICQ: 25285313
Posts: 993
|
Regarding the CPU use comment...
On 95%+ of all dedicated servers (likely more, but I don't care to try to filter statistics on a sunday afternoon...) CPU is basically idle. Customers have unfortunately been duped by crap marketing from hosting providers basically telling them MORE BIGGER BETTER with regards to CPU, and thus we have to compete in that arena (even though during pre-sales, we absolutely try to point out that the dual xeon for your 2mbit of traffic is likely overkill). In almost all cases, your largest bottleneck will be disk I/O. Period. Gzip in this manner helps with that, as the files are smaller. mod_gzip trades cpu use for bandwidth savings - so it's a tradeoff you have to decide if it's worth it or not. That said... If you can use mod_gzip instead of this solution - do so. It will be a huge savings in CPU, probably by a factor of 10 or more. However, as Jayeff mentions mod_gzip doesn't play nicely with some applications making this a great solution for those PHP pages that you otherwise couldn't gain bandwidth savings on. Good post!
__________________
Quality affordable hosting. |
|
|
|