You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by ywtsang <yw...@gmail.com> on 2009/02/12 07:12:32 UTC

question about adding "synchronized" on mountsOnPath at WebRequestCodingStrategy

at 1.3.5

class: org.apache.wicket.protocol.http.request.WebRequestCodingStrategy
method: urlCodingStrategyForPath

the variable "mountsOnPath" is synchronized
is this necessary?

because the WebRequestCodingStrategy is initialized once by "request cycle
processor", which in turns is shared by all requests (i read this at Wicket
In Action)

so synchornized the "mountsOnPath" can produce a big lock contention problem
if we have many requests at the same time?


-- 
View this message in context: http://www.nabble.com/question-about-adding-%22synchronized%22-on-mountsOnPath-at-WebRequestCodingStrategy-tp21970542p21970542.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: question about adding "synchronized" on mountsOnPath at WebRequestCodingStrategy

Posted by Igor Vaynberg <ig...@gmail.com>.
has this shown up in the profiler during a load test?

-igor

On Wed, Feb 11, 2009 at 10:12 PM, ywtsang <yw...@gmail.com> wrote:
>
> at 1.3.5
>
> class: org.apache.wicket.protocol.http.request.WebRequestCodingStrategy
> method: urlCodingStrategyForPath
>
> the variable "mountsOnPath" is synchronized
> is this necessary?
>
> because the WebRequestCodingStrategy is initialized once by "request cycle
> processor", which in turns is shared by all requests (i read this at Wicket
> In Action)
>
> so synchornized the "mountsOnPath" can produce a big lock contention problem
> if we have many requests at the same time?
>
>
> --
> View this message in context: http://www.nabble.com/question-about-adding-%22synchronized%22-on-mountsOnPath-at-WebRequestCodingStrategy-tp21970542p21970542.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: question about adding "synchronized" on mountsOnPath at WebRequestCodingStrategy

Posted by dannyboy <da...@gmail.com>.
Hot spot is gone.

-Danny
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/question-about-adding-synchronized-on-mountsOnPath-at-WebRequestCodingStrategy-tp1878901p2274801.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: question about adding "synchronized" on mountsOnPath at WebRequestCodingStrategy

Posted by Igor Vaynberg <ig...@gmail.com>.
did it reduce it or is the hotspot completely gone?

-igor

On Wed, Jun 30, 2010 at 3:38 AM, dannyboy <da...@gmail.com> wrote:
>
> Optimization helped!
> Thank you for fixing it.
>
> Kind regards,
>
> Danny
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/question-about-adding-synchronized-on-mountsOnPath-at-WebRequestCodingStrategy-tp1878901p2272701.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: question about adding "synchronized" on mountsOnPath at WebRequestCodingStrategy

Posted by dannyboy <da...@gmail.com>.
Optimization helped!
Thank you for fixing it.

Kind regards,

Danny
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/question-about-adding-synchronized-on-mountsOnPath-at-WebRequestCodingStrategy-tp1878901p2272701.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: question about adding "synchronized" on mountsOnPath at WebRequestCodingStrategy

Posted by Igor Vaynberg <ig...@gmail.com>.
optimized, try with latest branch build.

-igor

On Tue, Jun 29, 2010 at 7:18 AM, dannyboy <da...@gmail.com> wrote:
>
> Dear Igor,
>
> We are experiencing serious synchronization problems here.
> I have added a screenshot of our yourkit.
>
> It the same with all blocked threads.
>
> If you need more proof/information please let me know.
>
> Info of our system:
>
> Description: Solaris 10
> Vendor : Sun Microsystems
> Vendor Version : 10
> CPU Speed : 64 @ 1167 MHz (1x64)
> OS Version : 5.10
> RAM : 32640 MB
> Architecture : sparc
>
> 32-bit version java 6 sun 1.6.0_16
> Tomcat 6
>
> http://apache-wicket.1842946.n4.nabble.com/file/n2272250/Screenshot-Bootstrap-2010-06-29-1.snapshot_%5B-home-dbollaer-Snapshots%5D_-_YourKit_Java_Profiler_9.0.5.png
>
> Kind Regards,
>
> Danny
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/question-about-adding-synchronized-on-mountsOnPath-at-WebRequestCodingStrategy-tp1878901p2272250.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: question about adding "synchronized" on mountsOnPath at WebRequestCodingStrategy

Posted by dannyboy <da...@gmail.com>.
Dear Igor,

We are experiencing serious synchronization problems here.
I have added a screenshot of our yourkit.

It the same with all blocked threads.

If you need more proof/information please let me know.

Info of our system:
	 
Description: Solaris 10	
Vendor : Sun Microsystems	 
Vendor Version : 10
CPU Speed : 64 @ 1167 MHz (1x64)
OS Version : 5.10
RAM : 32640 MB	 
Architecture : sparc

32-bit version java 6 sun 1.6.0_16
Tomcat 6

http://apache-wicket.1842946.n4.nabble.com/file/n2272250/Screenshot-Bootstrap-2010-06-29-1.snapshot_%5B-home-dbollaer-Snapshots%5D_-_YourKit_Java_Profiler_9.0.5.png 

Kind Regards,

Danny
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/question-about-adding-synchronized-on-mountsOnPath-at-WebRequestCodingStrategy-tp1878901p2272250.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: question about adding "synchronized" on mountsOnPath at WebRequestCodingStrategy

Posted by Igor Vaynberg <ig...@gmail.com>.
prove that it hurts and we will be happy to rewrite it.

-igor

On Thu, Feb 12, 2009 at 4:55 PM, ywtsang <yw...@gmail.com> wrote:
>
> i don't have concrete stress test results to support if this "synchronized"
> hurts the performance badly
>
> but instead i was trying to throw a question on the code to see if it is
> necessary to use "synchronized" at the case (in fact, i don't support adding
> mount paths dynamically during runtime, so it is just read-only and not
> necessary to have it synchronized)
>
> btw, i also find other places in the codes have the similar situation , e.g.
>
> WebRequestCodingStrategy#getMountEncoder
>
>
> and if there are too much unnecessary synchronized codes, i think it hurts
>
>
>
> Thomas Mäder-2 wrote:
>>
>> Root of all evil! Root of all evil! ;-)
>>
>> On Thu, Feb 12, 2009 at 6:41 PM, Johan Compagner
>> <jc...@gmail.com>wrote:
>>
>>> And for 1.4+ we could make that map concurrent if that isnt already the
>>> case
>>>
>>>
>>>
>>
>> --
>> Thomas Mäder
>> Wicket & Eclipse Consulting
>> www.devotek-it.ch
>>
>>
>
> --
> View this message in context: http://www.nabble.com/question-about-adding-%22synchronized%22-on-mountsOnPath-at-WebRequestCodingStrategy-tp21970542p21988196.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: question about adding "synchronized" on mountsOnPath at WebRequestCodingStrategy

Posted by ywtsang <yw...@gmail.com>.
i don't have concrete stress test results to support if this "synchronized"
hurts the performance badly

but instead i was trying to throw a question on the code to see if it is
necessary to use "synchronized" at the case (in fact, i don't support adding
mount paths dynamically during runtime, so it is just read-only and not
necessary to have it synchronized)

btw, i also find other places in the codes have the similar situation , e.g.

WebRequestCodingStrategy#getMountEncoder


and if there are too much unnecessary synchronized codes, i think it hurts



Thomas Mäder-2 wrote:
> 
> Root of all evil! Root of all evil! ;-)
> 
> On Thu, Feb 12, 2009 at 6:41 PM, Johan Compagner
> <jc...@gmail.com>wrote:
> 
>> And for 1.4+ we could make that map concurrent if that isnt already the
>> case
>>
>>
>>
> 
> -- 
> Thomas Mäder
> Wicket & Eclipse Consulting
> www.devotek-it.ch
> 
> 

-- 
View this message in context: http://www.nabble.com/question-about-adding-%22synchronized%22-on-mountsOnPath-at-WebRequestCodingStrategy-tp21970542p21988196.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: question about adding "synchronized" on mountsOnPath at WebRequestCodingStrategy

Posted by Thomas Mäder <th...@devotek-it.ch>.
Root of all evil! Root of all evil! ;-)

On Thu, Feb 12, 2009 at 6:41 PM, Johan Compagner <jc...@gmail.com>wrote:

> And for 1.4+ we could make that map concurrent if that isnt already the
> case
>
>
>

-- 
Thomas Mäder
Wicket & Eclipse Consulting
www.devotek-it.ch

Re: question about adding "synchronized" on mountsOnPath at WebRequestCodingStrategy

Posted by Johan Compagner <jc...@gmail.com>.
And for 1.4+ we could make that map concurrent if that isnt already the case

On 12/02/2009, Thomas Mäder <th...@devotek-it.ch> wrote:
> The synchronizationn is around a HashMap lookup. Considering how much longer
> it takes to actually process a request, I very much doubt that there is much
> contention. Modern VM's are MUCH better at handling slight contention (like
> 2-4 contending threads) than older VMs. Don't worry!
>
> Thomas
>
> On Thu, Feb 12, 2009 at 7:12 AM, ywtsang <yw...@gmail.com> wrote:
>
>>
>> at 1.3.5
>>
>> class: org.apache.wicket.protocol.http.request.WebRequestCodingStrategy
>> method: urlCodingStrategyForPath
>>
>> the variable "mountsOnPath" is synchronized
>> is this necessary?
>>
>> because the WebRequestCodingStrategy is initialized once by "request cycle
>> processor", which in turns is shared by all requests (i read this at
>> Wicket
>> In Action)
>>
>> so synchornized the "mountsOnPath" can produce a big lock contention
>> problem
>> if we have many requests at the same time?
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/question-about-adding-%22synchronized%22-on-mountsOnPath-at-WebRequestCodingStrategy-tp21970542p21970542.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> --
> Thomas Mäder
> Wicket & Eclipse Consulting
> www.devotek-it.ch
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: question about adding "synchronized" on mountsOnPath at WebRequestCodingStrategy

Posted by Thomas Mäder <th...@devotek-it.ch>.
The synchronizationn is around a HashMap lookup. Considering how much longer
it takes to actually process a request, I very much doubt that there is much
contention. Modern VM's are MUCH better at handling slight contention (like
2-4 contending threads) than older VMs. Don't worry!

Thomas

On Thu, Feb 12, 2009 at 7:12 AM, ywtsang <yw...@gmail.com> wrote:

>
> at 1.3.5
>
> class: org.apache.wicket.protocol.http.request.WebRequestCodingStrategy
> method: urlCodingStrategyForPath
>
> the variable "mountsOnPath" is synchronized
> is this necessary?
>
> because the WebRequestCodingStrategy is initialized once by "request cycle
> processor", which in turns is shared by all requests (i read this at Wicket
> In Action)
>
> so synchornized the "mountsOnPath" can produce a big lock contention
> problem
> if we have many requests at the same time?
>
>
> --
> View this message in context:
> http://www.nabble.com/question-about-adding-%22synchronized%22-on-mountsOnPath-at-WebRequestCodingStrategy-tp21970542p21970542.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Thomas Mäder
Wicket & Eclipse Consulting
www.devotek-it.ch