On Mar 25, 2014, at 11:25 AM, Yann Simon <yann.simon...@gmail.com> wrote:

> 2014-03-20 15:28 GMT+01:00 Yann Simon <yann.simon...@gmail.com>:
>> Thanks for all your input, I think I have now an implementation that
>> works on Tomcat and Jetty.
>> 
>> By testing it, I've found something that can be an interesting
>> information for you.
>> 
>> The upload variant with forking a new thread is very very slow.
>> My non scientific tests by uploading a file from 1.4 GB:
>> - with tomca 8.0.3:
>> /upload2: 4.5 s
>> /upload (with new Thread): 2 mn

Have you looked closer to see where the time is being spent?  Perhaps with 
thread dumps, a debugger or a profiler?

Also, have you tried with the 8.0.5 release that is up for vote?

Dan

>> 
>> - with jetty 9.1:
>> /upload2: 3.6 s
>> /upload (with new Thread): 4.1 s
>> 
>> I tested it by removing all Thread.sleep from
>> https://github.com/yanns/servlet31_async/blob/master/src/main/java/com/yann/ReadListenerImpl.java#L24
> 
> Should I fill an issue for this?
> 
>> 
>> Cheers,
>> Yann
>> 
>> 2014-03-20 9:36 GMT+01:00 Yann Simon <yann.simon...@gmail.com>:
>>> One option I am trying is to ignore onAllDataRead and to use
>>> sevletInputStream.isFinished to know when the body is totally
>>> consumed:
>>> 
>>> https://github.com/yanns/servlet31_async/blob/master/src/main/java/com/yann/ReadListenerImpl.java#L55
>>> 
>>> Is it a dumb idea?
>>> 
>>> 2014-03-20 7:42 GMT+01:00 Yann Simon <yann.simon...@gmail.com>:
>>>> Thanks Rémy and Mark for the quick feedback and explanations!
>>>> 
>>>> On Mar 19, 2014 6:40 PM, "Mark Thomas" <ma...@apache.org> wrote:
>>>>> 
>>>>> On 19/03/2014 17:04, Rémy Maucherat wrote:
>>>>>> 2014-03-19 17:47 GMT+01:00 Yann Simon <yann.simon...@gmail.com>:
>>>>>> 
>>>>>>>> This is because you're forking a thread, it won't concurrently invoke
>>>>>>>> the
>>>>>>>> two events (which would be invalid).
>>>>>>> 
>>>>>>> Can you explain more please? I have difficulties to understand your
>>>>>>> sentence.
>>>>>>> 
>>>>>> 
>>>>>> It means the container has to wait until onReadPossible completes to
>>>>>> call
>>>>>> onDataAvailable.
>>>>> 
>>>>> I think Rémy meant Tomcat waits for onReadPossible() to complete before
>>>>> calling onAllDataRead()
>>>>> 
>>>>> If you look at the traces from the sample code, you'll see that the
>>>>> 
>>>>> onDataAvailable end
>>>>> 
>>>>> message always appears before
>>>>> 
>>>>> onAllDataRead
>>>>> 
>>>>> which is all you can rely on. You are seeing slightly odd behaviour
>>>>> because you are spawning a new thread to do the read. If you do that you
>>>>> have to handle the case that your new thread may trigger the
>>>>> onAllDataRead event and handle it appropriately. I don't see anything
>>>>> for Tomcat to do here.
>>>>> 
>>>>> Mark
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>>>>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>>>> 
>>>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to