Hi Chanika, IMO we can do little improvements to your code.
1. Please use string constants in 'getRegexForLocation' method. 2. In 'getRegexForLocation' method you can use StringBuilder.append instead of concatenating strings with "+" operator 3. In 'getRegexForLocation' you can use *StringTokenizer *instead of split operation since you are iterating through the split array. Regards, Venura On Mon, Jan 6, 2014 at 8:54 PM, Chanika Geeganage <[email protected]> wrote: > Please find the attached diff files for the changes done, as per the > offline chat had with Sagara regarding this problem. > > Here are the load test results > > > No of Threads Without the fix (tps) With the > fix (tps) > 1 > 410 400 > 5 > 2100 2080 > 100 > 6260 6250 > > Thanks > > > On Sat, Jan 4, 2014 at 8:51 AM, Chanika Geeganage <[email protected]>wrote: > >> >> >> >> On Sat, Jan 4, 2014 at 6:30 AM, Sagara Gunathunga <[email protected]>wrote: >> >>> >>> >>> >>> On Fri, Jan 3, 2014 at 5:06 PM, Chanika Geeganage <[email protected]>wrote: >>> >>>> Hi, >>>> >>>> To fix that properly, we can compile the regex at deployment time and >>>> keep that compiled pattern as the key. But that will break the exciting >>>> code because of API changes. It is a utill class and as others are using it >>>> we can't change the API. >>>> >>> >>> >>> Shall we have a chat on this Monday morning ? Let's see whether we can >>> find another workaround. >>> >> >> Sure. Will do >> >>> >>> >>> Thanks ! >>> >>>> >>>> Thanks >>>> >>>> >>>> On Fri, Jan 3, 2014 at 4:07 PM, Samisa Abeysinghe <[email protected]>wrote: >>>> >>>>> Is there any other way to fix the perf drop while fixing the issue? >>>>> >>>>> Thanks, >>>>> Samisa... >>>>> >>>>> >>>>> Samisa Abeysinghe >>>>> >>>>> Vice President Developer Evangelism >>>>> >>>>> WSO2 Inc. >>>>> http://wso2.com >>>>> >>>>> >>>>> >>>>> On Fri, Jan 3, 2014 at 3:36 PM, Chanika Geeganage <[email protected]>wrote: >>>>> >>>>>> Hi Samisa, >>>>>> >>>>>> The fix is for a issue occurred when we define multiple resources in >>>>>> a data service with the same resource name. For an example lets say we >>>>>> want >>>>>> to define following resources in a data service. (This is described in >>>>>> this >>>>>> thread) >>>>>> >>>>>> >>>>>> products/{id} >>>>>> products/{id}/name/{name} >>>>>> >>>>>> The current implementation does not give the desired output as it >>>>>> keeps only the resource name as the key. According to the given fix it >>>>>> keeps a regex as the key and it compiles all regex in the map each time >>>>>> we >>>>>> invoke a request. That is why there is a performance drop. >>>>>> >>>>>> Thanks >>>>>> >>>>>> >>>>>> >>>>>> On Fri, Jan 3, 2014 at 3:20 PM, Samisa Abeysinghe <[email protected]>wrote: >>>>>> >>>>>>> Why do we have a drop of TPS with the fix? Should we not optimize >>>>>>> this for better performance? >>>>>>> >>>>>>> Thanks, >>>>>>> Samisa... >>>>>>> >>>>>>> >>>>>>> Samisa Abeysinghe >>>>>>> >>>>>>> Vice President Developer Evangelism >>>>>>> >>>>>>> WSO2 Inc. >>>>>>> http://wso2.com >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Fri, Jan 3, 2014 at 1:28 PM, Chanika Geeganage >>>>>>> <[email protected]>wrote: >>>>>>> >>>>>>>> Hi, >>>>>>>> >>>>>>>> Here I have attached the changed code for the suggested solution >>>>>>>> (using a regex as the key). I ran some load tests and the results are >>>>>>>> listed below. >>>>>>>> >>>>>>>> No of Threads Without the fix (tps) >>>>>>>> With the fix (tps) >>>>>>>> 1 >>>>>>>> 410 315 >>>>>>>> 5 >>>>>>>> 2010 1900 >>>>>>>> 100 >>>>>>>> 6260 6200 >>>>>>>> >>>>>>>> Is it OK to proceed with this fix? >>>>>>>> >>>>>>>> Thanks >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Thu, Dec 19, 2013 at 7:37 AM, Chanika Geeganage < >>>>>>>> [email protected]> wrote: >>>>>>>> >>>>>>>>> Hi Sameera, >>>>>>>>> >>>>>>>>> getConstantFromHTTPLocation method in [1] is used to maintain the >>>>>>>>> map in deployment time and getOperationFromHTTPLocation method is >>>>>>>>> called >>>>>>>>> when you invoke the rest service in [2] >>>>>>>>> >>>>>>>>> [1] >>>>>>>>> https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.2.0/dependencies/axis2/1.6.1-wso2v10/modules/kernel/src/org/apache/axis2/wsdl/WSDLUtil.java >>>>>>>>> >>>>>>>>> [2] >>>>>>>>> https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.2.0/dependencies/axis2/1.6.1-wso2v10/modules/kernel/src/org/apache/axis2/dispatchers/HTTPLocationBasedDispatcher.java >>>>>>>>> >>>>>>>>> Thanks >>>>>>>>> >>>>>>>>> >>>>>>>>> On Thu, Dec 19, 2013 at 12:51 AM, Sameera Jayasoma < >>>>>>>>> [email protected]> wrote: >>>>>>>>> >>>>>>>>>> Hi Chanika, >>>>>>>>>> >>>>>>>>>> Can you please gimme me some pointers to the relevant code blocks >>>>>>>>>> which are responsible for this situation? >>>>>>>>>> >>>>>>>>>> Thanks, >>>>>>>>>> Sameera. >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Wed, Dec 18, 2013 at 3:29 PM, Chanika Geeganage < >>>>>>>>>> [email protected]> wrote: >>>>>>>>>> >>>>>>>>>>> Hi, >>>>>>>>>>> >>>>>>>>>>> This issue was come across when we invoke a rest resource >>>>>>>>>>> deployed in DSS. According to the current implementation it fails to >>>>>>>>>>> delegate different requests for same base URL. For an example lets >>>>>>>>>>> say we >>>>>>>>>>> want to have following resources in the dataservice config >>>>>>>>>>> >>>>>>>>>>> products/{id} >>>>>>>>>>> products/{id}/name/{name} >>>>>>>>>>> >>>>>>>>>>> According to the current implementation it maintains a map to >>>>>>>>>>> keep the resource info in the deployment time. It keeps a string of >>>>>>>>>>> the >>>>>>>>>>> HTTP method + the resource name as the key and the relevant axis2 >>>>>>>>>>> operation as the value. Therefore in the example both resources >>>>>>>>>>> having the >>>>>>>>>>> same key and the value is replaced by the last one. >>>>>>>>>>> >>>>>>>>>>> So as a solution, a regex for the resource is kept in the map as >>>>>>>>>>> the key, and when we invoke the resource it compares the regex with >>>>>>>>>>> the >>>>>>>>>>> request url. But this will hit a performance issue, as we have to >>>>>>>>>>> compile >>>>>>>>>>> all regex in the map each time we invoke resource. >>>>>>>>>>> >>>>>>>>>>> Any input regarding this is appreciated. >>>>>>>>>>> >>>>>>>>>>> Thanks >>>>>>>>>>> -- >>>>>>>>>>> Best Regards.. >>>>>>>>>>> >>>>>>>>>>> Chanika Geeganage >>>>>>>>>>> Software Engineer >>>>>>>>>>> WSO2, Inc.; http://wso2.com >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> _______________________________________________ >>>>>>>>>>> Architecture mailing list >>>>>>>>>>> [email protected] >>>>>>>>>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> Sameera Jayasoma, >>>>>>>>>> Architect, >>>>>>>>>> >>>>>>>>>> WSO2, Inc. (http://wso2.com) >>>>>>>>>> email: [email protected] >>>>>>>>>> blog: http://sameera.adahas.org >>>>>>>>>> twitter: https://twitter.com/sameerajayasoma >>>>>>>>>> flickr: http://www.flickr.com/photos/sameera-jayasoma/collections >>>>>>>>>> Mobile: 0094776364456 >>>>>>>>>> >>>>>>>>>> Lean . Enterprise . Middleware >>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>>> Architecture mailing list >>>>>>>>>> [email protected] >>>>>>>>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Best Regards.. >>>>>>>>> >>>>>>>>> Chanika Geeganage >>>>>>>>> Software Engineer >>>>>>>>> WSO2, Inc.; http://wso2.com >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> Best Regards.. >>>>>>>> >>>>>>>> Chanika Geeganage >>>>>>>> Software Engineer >>>>>>>> WSO2, Inc.; http://wso2.com >>>>>>>> >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> Architecture mailing list >>>>>>>> [email protected] >>>>>>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Architecture mailing list >>>>>>> [email protected] >>>>>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Best Regards.. >>>>>> >>>>>> Chanika Geeganage >>>>>> Software Engineer >>>>>> WSO2, Inc.; http://wso2.com >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> Architecture mailing list >>>>>> [email protected] >>>>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture >>>>>> >>>>>> >>>>> >>>>> _______________________________________________ >>>>> Architecture mailing list >>>>> [email protected] >>>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture >>>>> >>>>> >>>> >>>> >>>> -- >>>> Best Regards.. >>>> >>>> Chanika Geeganage >>>> Software Engineer >>>> WSO2, Inc.; http://wso2.com >>>> >>>> >>>> _______________________________________________ >>>> Architecture mailing list >>>> [email protected] >>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture >>>> >>>> >>> >>> >>> -- >>> Sagara Gunathunga >>> >>> Senior Technical Lead; WSO2, Inc.; http://wso2.com >>> V.P Apache Web Services; http://ws.apache.org/ >>> Linkedin; http://www.linkedin.com/in/ssagara >>> Blog ; http://ssagara.blogspot.com >>> >>> >> >> >> -- >> Best Regards.. >> >> Chanika Geeganage >> Software Engineer >> WSO2, Inc.; http://wso2.com >> >> > > > -- > Best Regards.. > > Chanika Geeganage > Software Engineer > WSO2, Inc.; http://wso2.com > > > _______________________________________________ > Architecture mailing list > [email protected] > https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture > > -- Senior Software Engineer Mobile: +94 71 82 300 20
_______________________________________________ Architecture mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
