dev@grizzly.java.net

Re: Chunking disabled in Rails grizzly adapter

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Thu, 11 Sep 2008 18:52:11 +0200

On Sep 11, 2008, at 18:04 , Vivek Pandey wrote:

> Oleksiy Stashok wrote:
>> Hello Vivek,
>>
>> currently under http-listener we have attributes and properties,
>> which are related to GF network configuration and web container
>> configuration. These properties are mixed up for now.
>> Yesterday, we discussed this issue on the meeting and came to
>> conclusion, that "disableChunking" http-listener property is
>> related to the WebContainer configuration, not HTTP in common.
> Maybe it is carryover from v2 but atleast the name suggests it is
> global http config for anything that listens on whichever port that
> the http-listener is tied to.
Right, but with v2 it was easy. Http-listener corresponded just to the
single web container adapter.

>> Otherwise we will come to issue, when it's not possible to set
>> different chunking mode for adapters, which are registered on the
>> same listener (web container adapter with chunking enabled and Ruby
>> adapter with the disabled chunking).
>> Once we will have grizzly-config done for v3, where we will
>> separate network configuration from web container - it will be even
>> moved under some web container related element.
>>
> grizzly-config in domain.xml, interesting. So this can contain
> config for each of the adapters?

Adapters are out of scope here.
grizzly-config (network-config) will just separate GF network settings
from other like web container ones.


>> So, each adapter should take care about enabling/disabling chunking
>> itself. If RubyAdapter wants to depend on web container property -
>> it's ok, but it needs to have the setup logic, which checks this
>> property and sets corresponding chunking mode.
>>
> In that case, can you point me to some code or tell me how do I get
> to http-listner properties from my Deployer? I register my grizzly
> adapter when Deployer.load() is called.
I could be wrong here.
Here is the code, which is now used by GrizzlyService under GFv3:
     @Inject(name="server-config") // for now
     Config config;
............
     public void somemethod() {
         HttpService httpService = config.getHttpService();
         for (HttpListener listener : httpService.getHttpListener()) {
                   ..........
         }
     }


> Also, Jeanfrancois mentioned providing something like
> GrizzlyResponse.setChunkingEnabled(false); IS this API integrated
> with the latest grizzly on v3 trunk? I will need this API if I have
> to use it.
Currently there is no API for Adapter to change chunking mode at the
runtime.
but you can do following in the adapter's constructor:

public class MyAdapter extends GrizzlyAdapter {

public MyAdapter() {
           chunkingDisabled = true;
}
.................
}

This API will be available with next Grizzly 1.8.6 integration [1]

Hope this will help.

Thanks.

WBR,
Alexey.

[1] 6046

>
>
> -vivek.
>> Thanks.
>>
>> WBR,
>> Alexey.
>>
>>
>>>>>>>>
>>>>>>>> just updated
>>>>>>>> https://glassfish.dev.java.net/issues/show_bug.cgi?id=5951
>>>>>>>>
>>>>>>>> actually it was just one devtest run, where this test failed,
>>>>>>>> but seems there were some side reasons of the fail. Since
>>>>>>>> 5.09.2008 this test is passing fine.
>>>>>>>>
>>>>>>>> As I mentioned before, currently in Grizzly each
>>>>>>>> GrizzlyAdapter has own chunking processing logic. It is not
>>>>>>>> centralized.
>>>>>>>>
>>>>>>>> For v3 it's not so easy to make chunking centralized. Because
>>>>>>>> at the startup Grizzly may not even know about all the
>>>>>>>> Adapters existed... Adapters could be registered at the
>>>>>>>> runtime.
>>>>>>>>
>>>>>>> Right, adapters are registered at runtime, I am registering
>>>>>>> RailsAdapter inside Deployer.load(). Since http listener knows
>>>>>>> about each adapter registered, can it not apply setting that
>>>>>>> it knows from the domain.xml? Looks like if you could set the
>>>>>>> chunking behavior dynamically for each registered adapters
>>>>>>> would be the way to go. The reason I say this is because
>>>>>>> HttpListner is the only entity and GrizzlyAdapters handle req/
>>>>>>> resp but the global properties should be enforced by the http-
>>>>>>> listner.
>>>>>> Well, currently there is no even mechanism to get all the
>>>>>> registered adapters. Currently we have mapper (URL <->
>>>>>> Adapter), which returns the adapter for the specific URL.
>>>>>> Another point... What if we want to register the single Adapter
>>>>>> on several GrizzlyProxies (different http-listeners), which
>>>>>> settings should be applied in this case?
>>>>> Is it not true that each http listener has a corresponding
>>>>> setting in domain.xml?
>>>>
>>>> Yes.
>>>>
>>>>>
>>>>>> Looks like the best solution would be move the chunking logic
>>>>>> outside the Adapter. But not sure this could be done for prelude.
>>>>>>
>>>>
>>>> Hum....chunking is enabled at the Request/Response level...it has
>>>> nothing to do with Adapter :-) I'm not sure I follow about moving
>>>> this out of the Adapter...it is already out (created in
>>>> DefaultProcessorTask). What needs to be done here is the
>>>> JRubyAdapter must call:
>>>>
>>>> GrizzlyResponse.setChunkingEnabled(false);
>>>>
>>>> on every request, hence the http-listener configuration is never
>>>> taken into account. Now this API is not exposed with the current
>>>> Grizzly version, hence some work for me today :-) I will file an
>>>> issue in Grizzly so next Grizzly integration will contains what
>>>> you need.
>>>
>>> The API is good but I am not sure I follow this for the issue I am
>>> dealing with here. Are you saying keep the chunking disabled by
>>> default? This is going to result into poor performance for large
>>> data transfer.
>>>
>>> In my view the fix should be done thru some kind of configuration
>>> to disable chunking not other way round and for that http-listener
>>> configuration is the right place to do so.
>>>
>>> -vivek.
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net <mailto:dev-unsubscribe_at_grizzly.dev.java.net
>>> >
>>> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net <mailto:dev-help_at_grizzly.dev.java.net
>>> >
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>