Apache bandwidth tuning in default config

View: New views
10 Messages — Rating Filter:   Alert me  

Apache bandwidth tuning in default config

by To+ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I've been playing recently with some firefox extensions for web developers:

FireBug: https://addons.mozilla.org/es-ES/firefox/addon/1843
PageSpeed: http://code.google.com/intl/es-ES/speed/page-speed/index.html
YSlow: http://developer.yahoo.com/yslow/

and found that enabling certain options in the koha's apache VirtualHosts configuration would improve a lot koha's performance in bandwidth use. Only the opac startup page bandwidht usage goes from 368.5K  to 118.3K.


Enable http compression using mod_deflate
---------------------------------------------------------------

Document this command for enabling this in Debian/Ubuntu

# a2enmod deflate

and add this lines to koha-http.conf in both VirtualHost definitions

   SetOutputFilter DEFLATE
   SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip

I specify not to apply useless compression to compresed images. Further options could be used. See http://httpd.apache.org/docs/2.0/mod/mod_deflate.html


Enable better caching features by setting explicit expiration far in the future for static content using mod_deflate
----------------------------------------------------------------------------------------------------------------------------------------------------------------

Document this command for enabling this in Debian/Ubuntu

# a2enmod expires

and add this lines to koha-http.conf in both VirtualHost definitions

   ExpiresActive On
   ExpiresDefault "modification plus 1 year"

as mod_expires only applies to files in the filesystem it is safe to rely on modification date. This could be fine-tuned, for example on a per filetype basis (see http://httpd.apache.org/docs/2.0/mod/mod_expires.html).

-----

PageSpeed in particular offers some recommendation on image sizes and provides an optimal image file for substitution. This could be analised.

To+.

--
Aparición con vida de Jorge Julio López.

_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha

Re: Apache bandwidth tuning in default config

by Pablo A. Bianchi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Does any koha developer interested in add this setup to koha default
installation? If not, why not?

2009/7/2 Tomás <tomascohen@...>
>
> I've been playing recently with some firefox extensions for web developers:
>
> FireBug: https://addons.mozilla.org/es-ES/firefox/addon/1843
> PageSpeed: http://code.google.com/intl/es-ES/speed/page-speed/index.html
> YSlow: http://developer.yahoo.com/yslow/
>
> and found that enabling certain options in the koha's apache VirtualHosts configuration would improve a lot koha's performance in bandwidth use. Only the opac startup page bandwidht usage goes from 368.5K  to 118.3K.
> [snip]
_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha

Re: Apache bandwidth tuning in default config

by Chris Cormack-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/8/17 Pablo A. Bianchi <pbianchi@...>:
> Does any koha developer interested in add this setup to koha default
> installation? If not, why not?

I'm sure they are, but I'm sure they are also busy.

But the beauty of a FLOSS project is that anyone can send a patch :)

Consider that a challenge :-)

Chris

>
> 2009/7/2 Tomás <tomascohen@...>
>>
>> I've been playing recently with some firefox extensions for web developers:
>>
>> FireBug: https://addons.mozilla.org/es-ES/firefox/addon/1843
>> PageSpeed: http://code.google.com/intl/es-ES/speed/page-speed/index.html
>> YSlow: http://developer.yahoo.com/yslow/
>>
>> and found that enabling certain options in the koha's apache VirtualHosts configuration would improve a lot koha's performance in bandwidth use. Only the opac startup page bandwidht usage goes from 368.5K  to 118.3K.
>> [snip]
> _______________________________________________
> Koha mailing list
> Koha@...
> http://lists.katipo.co.nz/mailman/listinfo/koha
>
_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha

Re: Apache bandwidth tuning in default config

by Pablo A. Bianchi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/8/16 Chris Cormack <chris@...>
>
> I'm sure they are, but I'm sure they are also busy.
>
> But the beauty of a FLOSS project is that anyone can send a patch :)

Thanks for your answer Chris. I'm aware of that aspect of FLOSS
projects. I also know that for a experienced developer this changes
take only 5 minutes and for me much more (never used GIT yet :$).
The purpose also was to know if someone think there is not a good idea
to made those changes, because is strange that being so simple nobody
say something about before.
Furthermore, this simples changes seems to be a very interesting
improve with an small effort, I was surprise no one responds (perhaps
it was a good reason).

> Consider that a challenge :-)

OK, despite the above, I will consider the challenge :-)
_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha

Parent Message unknown Re: Apache bandwidth tuning in default config

by MJ Ray-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

"Pablo A. Bianchi" <pbianchi@...>
> The purpose also was to know if someone think there is not a good idea
> to made those changes, because is strange that being so simple nobody
> say something about before.
> Furthermore, this simples changes seems to be a very interesting
> improve with an small effort, I was surprise no one responds (perhaps
> it was a good reason).

I didn't see it until now because it was sent to the wrong list
(should have gone to koha-devel) and two copies soon together may
have been misdetected as bulk mail.

deflate - I think enabling this would mean that we end support for
Apache 1.3.  Is that OK?

expires - I think this may mess up pre-production testing.

PageSpeed - mentioned but I don't know where to get the mentioned
files from.

I think we should put deflate and expires into the default config
file, but commented out with notes that the deflate is only for
Apache httpd 2.x and that expires should only be enabled once
you're finished messing with CSS and images.

Does that sound right?
--
MJ Ray (slef)  LMS developer and webmaster at     | software
www.software.coop http://mjr.towers.org.uk        |  .... co
IMO only: see http://mjr.towers.org.uk/email.html |  .... op
_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha

Re: Apache bandwidth tuning in default config

by Galen Charlton-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

On Mon, Aug 17, 2009 at 4:05 AM, MJ Ray<mjr@...> wrote:
> deflate - I think enabling this would mean that we end support for
> Apache 1.3.  Is that OK?

Possibly.  I think it's OK to require Apache 2 for users who have
sufficient control of their server, but for those needing to install
in single mode, I wonder if there are many web hosting providers left
who only run 1.3.

> I think we should put deflate and expires into the default config
> file, but commented out with notes that the deflate is only for
> Apache httpd 2.x and that expires should only be enabled once
> you're finished messing with CSS and images.
>
> Does that sound right?

That sounds good to me.

Regards,

Galen
--
Galen Charlton
gmcharlt@...
_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha

Parent Message unknown Re: Apache bandwidth tuning in default config

by MJ Ray-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Galen Charlton <gmcharlt@...>
> On Mon, Aug 17, 2009 at 4:05 AM, MJ Ray<mjr@...> wrote:
> > deflate - I think enabling this would mean that we end support for
> > Apache 1.3.  Is that OK?
>
> Possibly.  I think it's OK to require Apache 2 for users who have
> sufficient control of their server, but for those needing to install
> in single mode, I wonder if there are many web hosting providers left
> who only run 1.3.

I suspect there may be some education-sector users who have still not
upgraded to 2.x and need time to update their policy, but I hope that
they'll reply to this email and let us know!

Regards,
--
MJ Ray (slef)  LMS developer and webmaster at     | software
www.software.coop http://mjr.towers.org.uk        |  .... co
IMO only: see http://mjr.towers.org.uk/email.html |  .... op
_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha

Re: Apache bandwidth tuning in default config

by Pablo A. Bianchi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Aug 17, 2009 at 7:40 AM, Galen Charlton <gmcharlt@...> wrote:
> On Mon, Aug 17, 2009 at 4:05 AM, MJ Ray<mjr@...> wrote:
>> I think we should put deflate and expires into the default config
>> file, but commented out with notes that the deflate is only for
>> Apache httpd 2.x and that expires should only be enabled once
>> you're finished messing with CSS and images.
>>
>> Does that sound right?
>
> That sounds good to me.

Sounds good to me too!
Another possibility for deflate is to ask on installation script which
version of Apache is being used (or autodetect it?).

Regards,
Pablo
_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha

Re: Apache bandwidth tuning in default config

by Pablo A. Bianchi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Aug 17, 2009 at 8:41 AM, MJ Ray <mjr@...> wrote:
>
> I suspect there may be some education-sector users who have still not
> upgraded to 2.x and need time to update their policy, but I hope that
> they'll reply to this email and let us know!

This configuration on Koha's apache virtualhost setup could work for
Apache 2.x (deflate) and 1.x (gzip)?

<IfModule mod_gzip.c>
    mod_gzip_on yes
    mod_gzip_dechunk yes
    mod_gzip_keep_workfiles No
    mod_gzip_can_negotiate yes
    mod_gzip_update_static No
    mod_gzip_temp_dir /tmp
    mod_gzip_minimum_file_size 512
    mod_gzip_maximum_file_size 1000000
    mod_gzip_maximum_inmem_size 1000000
    mod_gzip_handle_methods GET POST
    mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\["
    mod_gzip_item_exclude mime ^image/.*
    mod_gzip_item_exclude rspheader Content-Type:image/*
    mod_gzip_item_include file \.js$
    mod_gzip_item_include mime ^application/x-javascript$
    mod_gzip_item_include file \.php$
    mod_gzip_item_include mime ^text/html$
    mod_gzip_item_include file \.css$
    mod_gzip_item_include mime ^text/css$
</IfModule>

<IfModule mod_deflate.c>

    # Compress content with type html, text, and css, ...
    AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
    AddOutputFilterByType DEFLATE application/xml
application/xhtml+xml application/rss+xml application/javascript
application/x-javascript

    DeflateCompressionLevel 9

    # Properly handle old browsers that do not support compression
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    DeflateFilterNote Input instream
    DeflateFilterNote Output outstream
    DeflateFilterNote Ratio ratio

    LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
    <IfModule mod_headers.c>
        #properly handle requests coming from behind proxies
        Header append Vary User-Agent
    </IfModule>
</IfModule>
_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha

Re: Apache bandwidth tuning in default config

by Galen Charlton-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Pablo,

On Thu, Aug 20, 2009 at 5:46 PM, Pablo A. Bianchi<pbianchi@...> wrote:
> This configuration on Koha's apache virtualhost setup could work for
> Apache 2.x (deflate) and 1.x (gzip)?

Looks good to me - could you submit as a Git patch against HEAD, or if
you're not set up to do that, let me know and I'll do it.  I can test
against Apache 2; if anybody's willing to test for Apache 1.3, please
speak up.

Regards,

Galen
--
Galen Charlton
gmcharlt@...
_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha