Return-Path: Delivered-To: apmail-synapse-dev-archive@www.apache.org Received: (qmail 78316 invoked from network); 10 Sep 2009 01:59:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 10 Sep 2009 01:59:38 -0000 Received: (qmail 38466 invoked by uid 500); 10 Sep 2009 01:59:38 -0000 Delivered-To: apmail-synapse-dev-archive@synapse.apache.org Received: (qmail 38368 invoked by uid 500); 10 Sep 2009 01:59:37 -0000 Mailing-List: contact dev-help@synapse.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@synapse.apache.org Delivered-To: mailing list dev@synapse.apache.org Received: (qmail 38360 invoked by uid 99); 10 Sep 2009 01:59:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Sep 2009 01:59:37 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ruwan.linton@gmail.com designates 209.85.221.191 as permitted sender) Received: from [209.85.221.191] (HELO mail-qy0-f191.google.com) (209.85.221.191) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Sep 2009 01:59:28 +0000 Received: by qyk29 with SMTP id 29so4217826qyk.16 for ; Wed, 09 Sep 2009 18:59:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=oXHUV4+0IlomWGaGz1KIV54W4qINhUz8ptAE+RoD5mE=; b=KEUeK3omvy1+YUS5KP3zdPECMXCouMVohqv3Uzkm9wnzd6tGtpYFWUneKq2xblxggT OV+PKMStYDEXjPR3c4rJJ1xDEZAZIFKJopbOE5b6XUdllXXFBVuSsXzUW9oejT4eM+Qh vtpyxNdj3gbnKrrccFoNe899mNlOEJdlRrSBw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=eHV5S1aZ9EP/YkCx7PKsn2uX6vmA5SxiceYq9kbgJytkwcRSCXyth8F6rrV2bxpwMJ rUUiFpFvEuc4BWrgHQ/faveltgzP5dYNTOKAKwOjgRvv+rNfoIQ+AdcpUmgskia9SJ5b kcfmswscMcATrd5J9uIhalLDpl108pKiIU8Og= MIME-Version: 1.0 Received: by 10.229.10.229 with SMTP id q37mr580871qcq.106.1252547947078; Wed, 09 Sep 2009 18:59:07 -0700 (PDT) In-Reply-To: References: <558af1840909090548h35dcc51weacecbf230076e50@mail.gmail.com> Date: Thu, 10 Sep 2009 07:29:07 +0530 Message-ID: <672a01200909091859w48105dbds371e2c4e9c4dd2c4@mail.gmail.com> Subject: Re: Concurrent Access to Dynamic Resources From: Ruwan Linton To: dev@synapse.apache.org Content-Type: multipart/alternative; boundary=0016364ed7dc73264d04732f8b10 X-Virus-Checked: Checked by ClamAV on apache.org --0016364ed7dc73264d04732f8b10 Content-Type: text/plain; charset=ISO-8859-1 Hiranya, We need to introduce synchronization, true. But that has to be done very carefully and I don't think synchronizing the getter method is the right solution for this, as Supun explained that will be a performance bottleneck when Synapse is under a considerable amount of load. Will have a look and propose a more scalable solution, in the mean time you may investigate into this more as well. Thanks, Ruwan On Wed, Sep 9, 2009 at 7:52 PM, Supun Kamburugamuva wrote: > Hi, > I think this is the price that we have to pay for enabling > dynamic behavior. If the ESB is under huge load and we synchronize these > methods it won't scale anyway. > > Having two threads load the same resource is tolerable if one thread > doesn't access the resource while it is initialized halfway way. > > One suggestion, I think if we can move the > > initialized = true; line 166 > > statement in the AbstractEndpoint.java to the bottom of the init method it > will be more safer. > > Thanks, > Supun.. > > On Wed, Sep 9, 2009 at 5:48 AM, Hiranya Jayathilaka wrote: > >> Hi Devs, >> The Axis2MessageContext class uses SynapseConfiguration#getEndpoint and >> SynapseConfiguration#getSequence methods to gain access to dynamic endpoints >> and sequences when they are not present in the message context's local >> store. However these method calls are not synchronized and from the looks of >> it I feel that if two message contexts try to access the same dynamic >> resource at the same time there is a chance that SynapseConfiguration would >> perform two remote registry lookups to fetch the same resource. This won't >> really cause any erroneous behavior but if the ESB is under a huge load >> where each message is trying to load a particular dynamic resource things >> may get out of hands. >> >> So does it make sense to bring in some synchronization into the picture? >> Or have I missed something and the above theory is not applicable? >> >> Thanks >> -- >> Hiranya Jayathilaka >> Software Engineer; >> WSO2 Inc.; http://wso2.org >> E-mail: hiranya@wso2.com; Mobile: +94 77 633 3491 >> Blog: http://techfeast-hiranya.blogspot.com >> > > > > -- > Software Engineer, WSO2 Inc > http://wso2.org > supunk.blogspot.com > > > -- Ruwan Linton Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb WSO2 Inc.; http://wso2.org email: ruwan@wso2.com; cell: +94 77 341 3097 blog: http://ruwansblog.blogspot.com --0016364ed7dc73264d04732f8b10 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hiranya,

We need to introduce synchronization, true. But that has to= be done very carefully and I don't think synchronizing the getter meth= od is the right solution for this, as Supun explained that will be a perfor= mance bottleneck when Synapse is under a considerable amount of load.

Will have a look and propose a more scalable solution, in the mean time= you may investigate into this more as well.

Thanks,
Ruwan
On Wed, Sep 9, 2009 at 7:52 PM, Supun Kamburuga= muva <supun06@gma= il.com> wrote:
Hi,

I think this is the price that we have to pay for enabling dynamic=A0= behavior. If the ESB is under huge load and we synchronize these methods it= won't scale anyway.=A0

Having two threads load the same resource is=A0tolerabl= e=A0if one thread doesn't access the=A0resource=A0while it is initializ= ed halfway way.=A0

One suggestion, I think if we can move the=A0

initialized =3D true;=A0line 166

<= div>statement in the AbstractEndpoint.java to the bottom of the init method= it will be more safer.

Thanks,
Supun..

On Wed, Sep 9, 2009 at 5:48 A= M, Hiranya Jayathilaka <hiranya911@gmail.com> wrote:
Hi Devs,

=
The Axis2MessageContext class uses SynapseConfiguration#getEndpo= int and SynapseConfiguration#getSequence methods to gain access to dynamic = endpoints and sequences when they are not present in the message context= 9;s local store. However these method calls are not synchronized and from t= he looks of it I feel that if two message contexts try to access the same d= ynamic resource at the same time there is a chance that SynapseConfiguratio= n would perform two remote registry lookups to fetch the same resource. Thi= s won't really cause any erroneous behavior but if the ESB is under a h= uge load where each message is trying to load a particular dynamic resource= things may get out of hands.

So does it make sense to bring in some synchronization = into the picture? Or have I missed something and the above theory is not ap= plicable?=A0

Thanks
--
Hiranya Jayat= hilaka
Software Engineer;
WSO2 Inc.; =A0http://wso2.org
E-mail: hiranya@wso2.com; =A0Mobile: +94 77 633 3491
Blog: = http://= techfeast-hiranya.blogspot.com



--
Software Engineer, WSO2 Inc
http://wso2.org
supunk.blogspot.com





--
Ruwan Linton
Technic= al Lead & Product Manager; WSO2 ESB; ht= tp://wso2.org/esb
WSO2 Inc.; http://wso2= .org
email: ruwan@wso2.com; cell: +94 77 3= 41 3097
blog: http://ruwansbl= og.blogspot.com
--0016364ed7dc73264d04732f8b10--