Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Contention in ServletHolder.handle()

Daniel,

I made a change to ServletHolder. See
https://bugs.eclipse.org/bugs/show_bug.cgi?id=434715

Jan

On 12/05/2014, Jan Bartel <janb@xxxxxxxxxxx> wrote:
> Daniel,
>
> The only reason you would set the initOrder is to avoid the extra call
> to getServlet() in the handle() method. It won't make any difference
> to whether your servlet is properly initialized or not, as the code
> specifically handles an externally provided servlet instance on
> startup.
>
> Jan
>
> On 12/05/2014, Daniel Feist <dfeist@xxxxxxxxx> wrote:
>> After doing some performance testing, while contention shows in
>> profiler clearly the performance impact is not significant I don't
>> thnk, so this would just be minor cleanup/optimization.
>>
>> Was i right when i set I need to use "initOrder" to ensure it gets
>> initialized at startup?
>>
>> I should really just be implementing a handler, but current
>> implementation uses a servlet.
>>
>> thanks!
>>
>> On Mon, May 12, 2014 at 5:15 PM, Jan Bartel <janb@xxxxxxxxxxx> wrote:
>>> Daniel,
>>>
>>> let me see if I can prevent the call to getServlet() in the case where
>>> you provide a pre-constructed servlet. I'll do some testing and get
>>> back to you - I need to confirm that the handling of that would be ok
>>> for cases where the servlet may have been made unavailable etc etc as
>>> well.
>>>
>>> Jan
>>>
>>> On 12/05/2014, Daniel Feist <dfeist@xxxxxxxxx> wrote:
>>>> Hi,
>>>>
>>>> Yes.  I agree this is needed is 'initOnStartup' is not configured, was
>>>> trying to work out why the synchonrized block was needed at all for
>>>> the 'initOnStartup' case though.
>>>>
>>>> That said, the reason reason I was seeing contention is probably
>>>> primarily due to org.eclipse.jetty.servlet.ServletHolder.getServlet()
>>>> because my servlet doesn't have 'initOnStartup' set.
>>>>
>>>> In my use case I embed jetty and provide Jetty with a
>>>> pre-instantiated/configured servlet instance wrapped in a
>>>> ServletHolder.  I guess i need to set the somewhat unobvious initOrder
>>>> to non-0 to configure this and reduce the contention?
>>>>
>>>> thanks!
>>>>
>>>>
>>>>
>>>> On Mon, May 12, 2014 at 11:15 AM, Jan Bartel <janb@xxxxxxxxxxx> wrote:
>>>>> Daniel,
>>>>>
>>>>> Not sure exactly the lines in ServletHolder you're referring to, but I
>>>>> assume its the synchronized block around line 652? If so, then this
>>>>> code guards the initial startup of a servlet - if it isn't
>>>>> load-on-startup, then any request coming in can initialize it.
>>>>> Therefore, if you have multiple concurrent requests, you need to
>>>>> protect the servlet startup so it happens only once.
>>>>>
>>>>> Jan
>>>>>
>>>>> On 8 May 2014 22:43, Daniel Feist <dfeist@xxxxxxxxx> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I've been doing some testing/benchmarking of Jetty 8 with Mule ESB
>>>>>> and
>>>>>> seeming a decent amount of contention where it doesn't seem that
>>>>>> synchronization is required.
>>>>>>
>>>>>> My test scenario is just a simple echo, all i do is read the request
>>>>>> stream and then respond.  The contention i'm seeing can be seen here:
>>>>>>
>>>>>> https://www.dropbox.com/s/bbkdsk7ndfpzoj9/Screen%20Shot%202014-05-08%20at%209.35.34%20PM.png
>>>>>>
>>>>>> Inspecting the code, I can't understand why this needs to even be
>>>>>> synchonrized.
>>>>>>
>>>>>> Any thoughts? Is there a config option I should be using that i'm
>>>>>> not?
>>>>>>  Is my test scenario unrealistic?
>>>>>>
>>>>>> thanks!
>>>>>> Dan
>>>>>> _______________________________________________
>>>>>> jetty-users mailing list
>>>>>> jetty-users@xxxxxxxxxxx
>>>>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Jan Bartel <janb@xxxxxxxxxxx>
>>>>> www.webtide.com
>>>>> 'Expert Jetty/CometD developer,production,operations advice'
>>>>> _______________________________________________
>>>>> jetty-users mailing list
>>>>> jetty-users@xxxxxxxxxxx
>>>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>>> _______________________________________________
>>>> jetty-users mailing list
>>>> jetty-users@xxxxxxxxxxx
>>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>>>
>>>
>>>
>>> --
>>> Jan Bartel <janb@xxxxxxxxxxx>
>>> www.webtide.com
>>> 'Expert Jetty/CometD developer,production,operations advice'
>>> _______________________________________________
>>> jetty-users mailing list
>>> jetty-users@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>> _______________________________________________
>> jetty-users mailing list
>> jetty-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>
>
>
> --
> Jan Bartel <janb@xxxxxxxxxxx>
> www.webtide.com
> 'Expert Jetty/CometD developer,production,operations advice'
>


-- 
Jan Bartel <janb@xxxxxxxxxxx>
www.webtide.com
'Expert Jetty/CometD developer,production,operations advice'


Back to the top