Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 5 1 2 3 4 5
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
What :: UBB Compression with cgi_buffer.pm

Version :: 6.1.0 PB 2

Info :: As promised in the recent U-zine article. Now you can dramatically reduce bandwidth and download times with an easy to use perl module.

Demo :: https://www.ubbdev.com/ubbcgi/ultimatebb.cgi

Credits :: WiLD for pointing it out to us smile

Files :: https://www.ubbdev.com/hacks/6.1/Compress.zip

How To ::


Open ultimatebb.cgi, uncomment use strict; and use vars etc etc (lines #30 and #35) and add this:

require Modules::Compress::cgi_buffer;
import Compress::cgi_buffer
$cgi_buffer::generate_etag = 0;

immediately before your use strict; so that it looks like this:

require Modules::Compress::cgi_buffer;
import Compress::cgi_buffer
$cgi_buffer::generate_etag = 0;
use strict;
use Fcntl ':flock';
use UBBCGI qw(:cgi);
use UBBCGI::Carp qw(fatalsToBrowser set_message);

use vars qw(%etc etc


That should be all you need to do, tho you may want to clear cache... smile

[ 09-16-2001: Message edited by: AllenAyres ]


- Allen wavey
- What Drives You?
Sponsored Links
Joined: Sep 2000
Posts: 4,211
Master Hacker
Master Hacker
Joined: Sep 2000
Posts: 4,211
Runs so much faster over here. wink

Joined: Jan 2001
Posts: 1,940
Developer
Developer
Offline
Joined: Jan 2001
Posts: 1,940
Warning it requires Compress::Zlib which is not installed by default on most Perl-capable hosts.

q

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
As stated in the article wink

All recent versions of activestate perl come with it... and if you are able to install this perl module on your server, you should be able to install the other required modules from cpan smile


- Allen wavey
- What Drives You?
Joined: May 2001
Posts: 6,708
Member
Member
Offline
Joined: May 2001
Posts: 6,708
Sounds like one good mod. I'll give it a try soon. wink

Sponsored Links
Joined: Aug 2000
Posts: 874
Moderator / Developer
Moderator / Developer
Offline
Joined: Aug 2000
Posts: 874
is this better than mod_gzip?

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
I believe they both use Compress::Zlib - performance should be comparable. I have never checked out mod_gzip because it's written for apache and I've never used an apache server.

WiLD is doing some performance testing and said he would report back his results.

ISAPI compression on a windows server is supposed to perform better than both, but takes a little more work to set up for dynamic files. We're using it for the static files here.


- Allen wavey
- What Drives You?
Joined: Jun 2001
Posts: 94
Member
Member
Offline
Joined: Jun 2001
Posts: 94
Quote
quote:
Allen, where can i find httpcomp.dll??

this link http://www.microsoft.com/TechNet/iis/httpcomp.asp gives me an 404 not found error frown
TIA smile

Joined: Jan 2001
Posts: 1,940
Developer
Developer
Offline
Joined: Jan 2001
Posts: 1,940
Theoretically, it'll be the same but mod_gzip allows more tweaking (in terms of compression); this module does not (if it uses Compress::Zlib's default gzip mechanism, compression is set at 4 iirc; 1 would be best for speed purposes and CPU load).

Anyways, if you already have mod_gzip on your server and it's compressing CGI output, don't bother to install this hack; it'll just waste CPU clicks.

q

[ September 07, 2001: Message edited by: qasic ]

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Quote
quote:
Here's some more info:

http://support.microsoft.com/support/kb/articles/Q255/9/51.ASP

http://www.microsoft.com/technet/tr...chnol/iis/maintain/optimize/perflink.asp

Yes, if you've already installed some other form of compression, this would be redundant. It'd be like installing who's online twice smile


- Allen wavey
- What Drives You?
Sponsored Links
Joined: Jun 2001
Posts: 94
Member
Member
Offline
Joined: Jun 2001
Posts: 94
wow Allen this is awesome
w/o cgi_buffer.pm one thread with 2 replies generates ~17KB
with cgi_buffer.pm this same thread generates only ~3KB

thank you very much for this one Allen wink
rated [Linked Image] laugh

Joined: May 2001
Posts: 1,042
Likes: 7
Moderator
Moderator
Offline
Joined: May 2001
Posts: 1,042
Likes: 7
I really want to use this but each time i download cgi_buffer-0.3.tgz , it opens in winzip saying corrupt error.

Am i looking at the right download here? confused

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
I had the same problem... the download is trying to save it as a .tar file... be sure and save it as a .tgz file when you save it in the download. Winzip will then open it properly into a tar file and then unpack it after you've saved it to your computer.

Just a reminder this is for servers tht you are able to install perl modules on, either a dedicated server or a shared one a host doesn't mind installing perl modules for you.


- Allen wavey
- What Drives You?
Joined: Jan 2001
Posts: 1,940
Developer
Developer
Offline
Joined: Jan 2001
Posts: 1,940
Actually, just rename the file so it ends in .tar.gz and you'll have no problems.

qasic

Joined: May 2001
Posts: 1,042
Likes: 7
Moderator
Moderator
Offline
Joined: May 2001
Posts: 1,042
Likes: 7
n/m problem fixed. Dang! Pretty fast!

[ September 07, 2001: Message edited by: raiyan ]

Joined: Mar 2001
Posts: 7,394
LK Offline
Admin / Code Breaker
Admin / Code Breaker
Offline
Joined: Mar 2001
Posts: 7,394
Code
code:
Where can I get THIS file? tipsy

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
That's one of the modules mentioned that's required for using this. If you are using activestate perl, it's included. If not, I believe you can get all the modules from cpan.org


- Allen wavey
- What Drives You?
Joined: Mar 2001
Posts: 7,394
LK Offline
Admin / Code Breaker
Admin / Code Breaker
Offline
Joined: Mar 2001
Posts: 7,394
I'm using ActiveState Perl and it's not included here tipsy

I got some versions from there, but they aren't IO::String (like Convertor::Ethiopian::String, Brute::String)

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Maybe it's only the most recent version... I am using 629. Did you also install the perl package manager (PPM)?

Some links:

http://aspn.activestate.com/ASPN/Reference/Products/ASPNTOC-ACTIVEPERL-004

http://aspn.activestate.com/ASPN/Reference/Products/ActivePerl/lib/IO.html

hmmm... maybe I have it loaded from something else... if you see where the difference is, can you report back here? You might need to get the module from cpan after all smile


- Allen wavey
- What Drives You?
Joined: Jun 2001
Posts: 94
Member
Member
Offline
Joined: Jun 2001
Posts: 94
hey LK
grab it here
http://www.cpan.org/modules/by-module/IO/IO-String-1.01.tar.gz

PS laugh ont forget to save it as .tgz

Joined: Mar 2001
Posts: 7,394
LK Offline
Admin / Code Breaker
Admin / Code Breaker
Offline
Joined: Mar 2001
Posts: 7,394
Quote
quote:

Joined: Mar 2001
Posts: 7,394
LK Offline
Admin / Code Breaker
Admin / Code Breaker
Offline
Joined: Mar 2001
Posts: 7,394
Nevermind, fixed it, thanks hmiguelito tipsy

Allen, I just found the source to the JavaScript problems: this hack frown

[ September 08, 2001: Message edited by: LK ]

Joined: Jan 2000
Posts: 5,073
Admin Emeritus
Admin Emeritus
Joined: Jan 2000
Posts: 5,073
gzipped Javascript and CSS cause some browsers to behave poorly. Known issue... smash the vendors upside the head.


UBB.classic: Love it or hate it, it was mine.
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
hmmmm... it seems to be compressing all the pages except the forum summary, as they are all 5-10kb except the forum summary which is ~68kb.


- Allen wavey
- What Drives You?
Joined: Jun 2001
Posts: 94
Member
Member
Offline
Joined: Jun 2001
Posts: 94
yes me too frown
all except ultimatebb.cgi confused

Joined: Apr 2001
Posts: 4
Junior Member
Junior Member
Offline
Joined: Apr 2001
Posts: 4
Here's an idea for anyone who wants to try it and doesn't have root access to the server to install it.

You can create a directory in your 'Modules' directory called (lets just say) 'CGIBuffer' then copy the cgi_buffer.pm into that directory.

You can then use this code to use the cgi_buffer module:
Code
code:

I have not tested if it is actually compressing yet but there does seem to be an increase in speed when that code is used.

Let me know if it does not work and I will remove my post.

Thanks,
GewGaw

[ September 08, 2001: Message edited by: GewGaw ]

Joined: Apr 2001
Posts: 4
Junior Member
Junior Member
Offline
Joined: Apr 2001
Posts: 4
Quote
quote:
That is very correct qasic! I tested the situation on two separate virtual hosting accounts with two separate ISPs and it functioned fine. This would conclude that the two ISPs were running the required modules.

Thanks for pointing it out... something I overlooked to mention.

smile
GewGaw

Joined: Jun 2001
Posts: 94
Member
Member
Offline
Joined: Jun 2001
Posts: 94
so Allen
why isnt forum front page being zipped?

Joined: Apr 2001
Posts: 36
Member
Member
Offline
Joined: Apr 2001
Posts: 36
Could this also work on UBB 6.05? Cause I hate upgrading especially after applying like 40 hacks.. smirk

And upgrading to UBB 6.1 is a too big leap for me. wink

Grtz.,
Michael

Joined: Jan 2001
Posts: 1,940
Developer
Developer
Offline
Joined: Jan 2001
Posts: 1,940
In theory, it should work as long as you have the required modules installed.

Joined: Apr 2001
Posts: 36
Member
Member
Offline
Joined: Apr 2001
Posts: 36
Thanks for the answer.. wink

So it would save bandwith? Even on a 6.05 board (ofcourse) with the right modules installed? wink

Joined: Jan 2001
Posts: 1,940
Developer
Developer
Offline
Joined: Jan 2001
Posts: 1,940
Yup.

Joined: Jul 2001
Posts: 1,111
Member
Member
Offline
Joined: Jul 2001
Posts: 1,111
testing it on my 6.05 tonight laugh wish me luck

[ September 09, 2001: Message edited by: Anime-loo ]

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
It should work on the 6.0x series, the problem might come in the coding of that series.. 6.1x code has been cleaned up tremendously and uncommenting the use strict; is no biggie.

That would be my only concern. smile


- Allen wavey
- What Drives You?
Joined: Jul 2001
Posts: 1,111
Member
Member
Offline
Joined: Jul 2001
Posts: 1,111
Quote
quote:
smile thanks for the input ^_^, we just decided to wait till next weekend to try it on the main forums tho were ganna put it on are test forums tonight and see how it works out

Joined: Aug 2001
Posts: 94
Member
Member
Offline
Joined: Aug 2001
Posts: 94
Quote
quote:
hi have added this cant tell if it has worked would i get an error if it dont work ???
i dont have access to perl, im using a test board with a free host (F2S) because im shopping around for hosting smile

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
You should get an error if the required modules aren't installed. Right click on one of your thread pages with a few replies and see if it is ridiculously small in the 5-10kb range smile


- Allen wavey
- What Drives You?
Joined: Aug 2001
Posts: 94
Member
Member
Offline
Joined: Aug 2001
Posts: 94
yeah got in touch with f2s to see if they support it and they do smile

wow its so zippy does it save bandwidth aswell smile

GREAT JOB GUYS smile

Joined: Sep 2001
Posts: 2
Junior Member
Junior Member
Offline
Joined: Sep 2001
Posts: 2
Wow , never thougt my hints would make it into THE UBBDEV-Zone smile Hope that this helps many Board-Admins and Users as well. At least, I love this hack laugh

@all: As somebody said, all pages are compressed, except the forum-overview. I dont have any Idea why this happens. Did someone find out why this might happen?

Willi

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Haven't found out yet.. but it makes a huge difference elsewhere smile Thanks for the pointers as well. I wrote to the author to see if he might still be developing this further, haven't heard anything yet.

The next version of this will be developed to where it can be used on most any server - shared or dedicated... warnings will be issued tho regarding using this on a shared server and cpu usage.


- Allen wavey
- What Drives You?
Page 1 of 5 1 2 3 4 5

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
AllenAyres
AllenAyres
Texas
Posts: 21,079
Joined: March 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)