You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Henri Gomez <hg...@apache.org> on 2003/10/06 13:37:15 UTC

Http Connector / Gzip

Hi to all,

What about using regexp in HTTP 1.1 connector to include/exclude
browser which could/couldn't use gzip compression ?

May be it could be use also to drop to HTTP 1.0 browser which
claims to be 1.1 compatible, but are not.

CF: Apache HTTPD server


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Http Connector / Gzip

Posted by Henri Gomez <hg...@apache.org>.
 >>>


Here is the patch against latest remy changes ...

Re: Http Connector / Gzip

Posted by Henri Gomez <hg...@apache.org>.
Remy Maucherat a écrit :

> Henri Gomez wrote:
> 
>> Could I commit my changes and start working on an optimizing version ?
> 
> 
> Yes, of course. There's no big rush to start optimizing this ;-) (it's 
> really disabled by default, right ?)
> 

Yes, since the restrictedUserAgents and restrictedUserAgents are set to 
null in Http11Protocol until someone set the properties in server.xml.

Trust me ;-)

BTW, I'll update the build.xml but we need to have regexp.jar loaded 
somewhere in jtc...


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Http Connector / Gzip

Posted by Remy Maucherat <re...@apache.org>.
Henri Gomez wrote:
> Could I commit my changes and start working on an optimizing version ?

Yes, of course. There's no big rush to start optimizing this ;-) (it's 
really disabled by default, right ?)

Remy



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Http Connector / Gzip

Posted by Henri Gomez <hg...@apache.org>.
>>
>>
>> Well I take my inspiration from what is done in some TC 4.1 Valves...
> 
> 
> I know ;-)
> Some problematic stuff went away, though (the various mappers), but some 
> remain.
> 
> This feature would really need to be seriously optimized, as ideally 
> this would be enabled by default.
> 
>> We could do better as usually...
> 
> 
> Yes.

Could I commit my changes and start working on an optimizing version ?


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Http Connector / Gzip

Posted by Henri Gomez <hg...@apache.org>.
Remy Maucherat a écrit :

> Henri Gomez wrote:
> 
>> Remy Maucherat a écrit :
>>
>>> +0 if disabled by default; -1 otherwise.
>>> All this stuff is inefficient, as it uses Strings. Ie, we take the 
>>> byte array we have for the header value, convert it to a String, and 
>>> then regexp will likely convert it to something else to work with it 
>>> (likely a char array). This is bad, obviously :-(
>>>
>>> I don't know if the JDK 1.4 stuff can work with bytes, but in any 
>>> case, the benchmarks seem a lot faster.
>>>
>>> So we need a simple byte-based regexp :) (sort of like the mapper)

May be CharacterIterator could be better in our case ?

public boolean match(CharacterIterator search, int i)




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Http Connector / Gzip

Posted by Remy Maucherat <re...@apache.org>.
Henri Gomez wrote:

> Remy Maucherat a écrit :
> 
>> +0 if disabled by default; -1 otherwise.
>> All this stuff is inefficient, as it uses Strings. Ie, we take the 
>> byte array we have for the header value, convert it to a String, and 
>> then regexp will likely convert it to something else to work with it 
>> (likely a char array). This is bad, obviously :-(
>>
>> I don't know if the JDK 1.4 stuff can work with bytes, but in any 
>> case, the benchmarks seem a lot faster.
>>
>> So we need a simple byte-based regexp :) (sort of like the mapper)
> 
> 
> Well I take my inspiration from what is done in some TC 4.1 Valves...

I know ;-)
Some problematic stuff went away, though (the various mappers), but some 
remain.

This feature would really need to be seriously optimized, as ideally 
this would be enabled by default.

> We could do better as usually...

Yes.

Remy



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Http Connector / Gzip

Posted by Henri Gomez <hg...@apache.org>.
Remy Maucherat a écrit :

> Henri Gomez wrote:
> 
>> Remy Maucherat a écrit :
>>
>>> Henri Gomez wrote:
>>>
>>>> Hi to all,
>>>>
>>>> What about using regexp in HTTP 1.1 connector to include/exclude
>>>> browser which could/couldn't use gzip compression ?
>>>>
>>>> May be it could be use also to drop to HTTP 1.0 browser which
>>>> claims to be 1.1 compatible, but are not.
>>>>
>>>> CF: Apache HTTPD server
>>>
>>>
>>>
>>>
>>> Well, I thought regexp was rather slow in Java, so it could be a 
>>> problem if using a generic regexp library.
>>>
>>
>> You could find attached a patch to make use of regexp in HTTP 1.1.
>>
>> It check via jakarta-regexp which browser should be exclude from
>> gzip but also from HTTP 1.1 (even if they claim to be compatible).
>>
>> (regexp is also used in some valves)
>>
>> With such add-on we mimic what HTTP teams does in Apache 2.0 via
>> BrowserMatch.
>>
>> Nota their approach may be better since BrowserMatch set some properties
>> like :
>>
>> nokeepalive, downgrade-1.0, force-response-1.0, nogzip....
>>
>> Something which may be nice to implements (may we could use attributes
>> or notes ?)
>>
>>
>> You should note that if no restrictedUserAgents or
>> noCompressionUserAgents are set in HTTP connector settings,
>> there is no check done, so no performance penalty.
>>
>> There is case where it should be done so better have provision for....
> 
> 
> +0 if disabled by default; -1 otherwise.
> All this stuff is inefficient, as it uses Strings. Ie, we take the byte 
> array we have for the header value, convert it to a String, and then 
> regexp will likely convert it to something else to work with it (likely 
> a char array). This is bad, obviously :-(
> 
> I don't know if the JDK 1.4 stuff can work with bytes, but in any case, 
> the benchmarks seem a lot faster.
> 
> So we need a simple byte-based regexp :) (sort of like the mapper)

Well I take my inspiration from what is done in some TC 4.1 Valves...

We could do better as usually...




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Http Connector / Gzip

Posted by Remy Maucherat <re...@apache.org>.
Henri Gomez wrote:

> Remy Maucherat a écrit :
> 
>> Henri Gomez wrote:
>>
>>> Hi to all,
>>>
>>> What about using regexp in HTTP 1.1 connector to include/exclude
>>> browser which could/couldn't use gzip compression ?
>>>
>>> May be it could be use also to drop to HTTP 1.0 browser which
>>> claims to be 1.1 compatible, but are not.
>>>
>>> CF: Apache HTTPD server
>>
>>
>>
>> Well, I thought regexp was rather slow in Java, so it could be a 
>> problem if using a generic regexp library.
>>
> 
> You could find attached a patch to make use of regexp in HTTP 1.1.
> 
> It check via jakarta-regexp which browser should be exclude from
> gzip but also from HTTP 1.1 (even if they claim to be compatible).
> 
> (regexp is also used in some valves)
> 
> With such add-on we mimic what HTTP teams does in Apache 2.0 via
> BrowserMatch.
> 
> Nota their approach may be better since BrowserMatch set some properties
> like :
> 
> nokeepalive, downgrade-1.0, force-response-1.0, nogzip....
> 
> Something which may be nice to implements (may we could use attributes
> or notes ?)
> 
> 
> You should note that if no restrictedUserAgents or
> noCompressionUserAgents are set in HTTP connector settings,
> there is no check done, so no performance penalty.
> 
> There is case where it should be done so better have provision for....

+0 if disabled by default; -1 otherwise.
All this stuff is inefficient, as it uses Strings. Ie, we take the byte 
array we have for the header value, convert it to a String, and then 
regexp will likely convert it to something else to work with it (likely 
a char array). This is bad, obviously :-(

I don't know if the JDK 1.4 stuff can work with bytes, but in any case, 
the benchmarks seem a lot faster.

So we need a simple byte-based regexp :) (sort of like the mapper)

Remy



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Http Connector / Gzip

Posted by Henri Gomez <hg...@apache.org>.
Remy Maucherat a écrit :
> Henri Gomez wrote:
> 
>> Hi to all,
>>
>> What about using regexp in HTTP 1.1 connector to include/exclude
>> browser which could/couldn't use gzip compression ?
>>
>> May be it could be use also to drop to HTTP 1.0 browser which
>> claims to be 1.1 compatible, but are not.
>>
>> CF: Apache HTTPD server
> 
> 
> Well, I thought regexp was rather slow in Java, so it could be a problem 
> if using a generic regexp library.
> 

You could find attached a patch to make use of regexp in HTTP 1.1.

It check via jakarta-regexp which browser should be exclude from
gzip but also from HTTP 1.1 (even if they claim to be compatible).

(regexp is also used in some valves)

With such add-on we mimic what HTTP teams does in Apache 2.0 via
BrowserMatch.

Nota their approach may be better since BrowserMatch set some properties
like :

nokeepalive, downgrade-1.0, force-response-1.0, nogzip....

Something which may be nice to implements (may we could use attributes
or notes ?)


You should note that if no restrictedUserAgents or
noCompressionUserAgents are set in HTTP connector settings,
there is no check done, so no performance penalty.

There is case where it should be done so better have provision for....

Regards






Re: Http Connector / Gzip

Posted by Henri Gomez <hg...@apache.org>.
Remy Maucherat a écrit :

> Henri Gomez wrote:
> 
>> Hi to all,
>>
>> What about using regexp in HTTP 1.1 connector to include/exclude
>> browser which could/couldn't use gzip compression ?
>>
>> May be it could be use also to drop to HTTP 1.0 browser which
>> claims to be 1.1 compatible, but are not.
>>
>> CF: Apache HTTPD server
> 
> 
> Well, I thought regexp was rather slow in Java, so it could be a problem 
> if using a generic regexp library.

jakarta-regexp is too slow ?


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Http Connector / Gzip

Posted by Remy Maucherat <re...@apache.org>.
Henri Gomez wrote:

> Hi to all,
> 
> What about using regexp in HTTP 1.1 connector to include/exclude
> browser which could/couldn't use gzip compression ?
> 
> May be it could be use also to drop to HTTP 1.0 browser which
> claims to be 1.1 compatible, but are not.
> 
> CF: Apache HTTPD server

Well, I thought regexp was rather slow in Java, so it could be a problem 
if using a generic regexp library.

Remy



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org