What is the performance and scalability of [1] vs [2] ?

CPU, Heap, PermGen, GC, horizontal scalability, vertical scalability, latency 
added, throughput ?
 
TIA

Luca

On 20 Feb 2014, at 17:54, Krishantha Dinesh <[email protected]> wrote:

> currently i am involving some significant development with WSO2 ESB. for that 
> i need to to some comparison and URL construction. (basically string 
> operations) those task can do using filter mediator as well as script 
> mediator. but when use filter mediator code become so bulky and ugly :( when 
> use script mediator its easy to read , maintainable and nice... 
> since those are non functional iam concern about performance. 
> 
> for example (given two example are NOT same or relevant)
> 
> [1]
>     <script language="js">
>         <![CDATA[        
>             var apiUrl = mc.getProperty('uri.var.apiUrl')+'/v1/people/';
>             var id = mc.getProperty('uri.var.id');
>             var publicProfileUrl = mc.getProperty('uri.var.publicProfileUrl');
>             var searchCriteria = mc.getProperty('uri.var.searchCriteria');
>             var query ='';
>             var start = mc.getProperty('uri.var.start');
>             var count = mc.getProperty('uri.var.count');
>             var modified = mc.getProperty('uri.var.modified');
>             var modifiedSince = mc.getProperty('uri.var.modifiedSince');
> 
>             if(id!="")
>             {
>                 query ='';
>                 query=apiUrl+'id=' + mc.getProperty('uri.var.id') + 
> '/connections';
>             }
> 
>             else if(publicProfileUrl!="")
>             {
>                 query ='';
>                 query=apiUrl+'url=' +
>                 mc.getProperty('uri.var.publicProfileUrl') + '/connections';
>             }
> 
>             else
>             {
>                 query ='';
>                 query=apiUrl+'~/connections';
>             }
>                         
>             if(searchCriteria!="")
>             {
>                 query=query + ':' + '(' + 
> mc.getProperty('uri.var.searchCriteria') + ')';
>             }    
>                         
>             query = query + '?oauth2_access_token=' + 
> mc.getProperty('uri.var.accessToken');
>                         
>             if(start!="")
>             {
>                 query=query + '&start=' + mc.getProperty('uri.var.start');
>             }
> 
>             if(count!="")
>             {
>                 query=query + '&count=' + mc.getProperty('uri.var.count');
>             }
> 
>             if(modified!="")
>             {
>                 query=query + '&modified=' + 
> mc.getProperty('uri.var.modified');
>             }
> 
>             if(modifiedSince!="")
>             {
>                 query=query + '&modified-since=' +
>                 mc.getProperty('uri.var.modifiedSince');
>             }
>             
>             query = query + '&format=json';            
>             mc.setProperty('uri.var.query', query);
> 
>          ]]></script>
> 
> 
> [2] filter
> 
> 
> <filter
>             xpath="not(get-property('uri.var.companyId') = '') or 
> not(get-property('uri.var.universalName') = '') or 
> not(get-property('uri.var.emailDomains') = '') or 
> not(get-property('uri.var.companyAdmin') = '')">
>             <then>
>                 <filter
>                     xpath="not(get-property('uri.var.companyId') = '') and 
> not(get-property('uri.var.universalName') = '')">
>                     <then>
>                         <call>
>                             <endpoint>
>                                 <http method="get"
>                                     
> uri-template="{uri.var.apiUrl}/v1/companies::({uri.var.companyId},universal-name={uri.var.universalName})?oauth2_access_token={uri.var.accessToken}&amp;format=json"
>  />
>                             </endpoint>
>                         </call>
>                     </then>
>                     <else>
>                         <filter xpath="not(get-property('uri.var.companyId') 
> = '')">
>                             <then>
>                                 <call>
>                                     <endpoint>
>                                         <http method="get"
>                                             
> uri-template="{uri.var.apiUrl}/v1/companies/{uri.var.companyId}?oauth2_access_token={uri.var.accessToken}&amp;format=json"
>  />
>                                     </endpoint>
>                                 </call>
>                             </then>
>                             <else>
>                                 <filter 
> xpath="not(get-property('uri.var.universalName') = '')">
>                                     <then>
>                                         <call>
>                                             <endpoint>
>                                                 <http method="get"
>                                                     
> uri-template="{uri.var.apiUrl}/v1/companies/universal-name={uri.var.universalName}?oauth2_access_token={uri.var.accessToken}&amp;format=json"
>  />
>                                             </endpoint>
>                                         </call>
>                                     </then>
>                                     <else>
>                                         <filter 
> xpath="not(get-property('uri.var.emailDomains') = '')">
>                                             <then>
>                                                 <call>
>                                                     <endpoint>
>                                                         <http method="get"
>                                                             
> uri-template="{uri.var.apiUrl}/v1/companies?email-domain={uri.var.emailDomains}&amp;oauth2_access_token={uri.var.accessToken}&amp;format=json"
>  />
>                                                     </endpoint>
>                                                 </call>
>                                             </then>
>                                             <else>
>                                                 <filter 
> xpath="not(get-property('uri.var.companyAdmin') = '')">
>                                                     <then>
>                                                         <call>
>                                                             <endpoint>
>                                                                 <http 
> method="get"
>                                                                     
> uri-template="{uri.var.apiUrl}/v1/companies?is-company-admin={uri.var.companyAdmin}&amp;oauth2_access_token={uri.var.accessToken}&amp;format=json"
>  />
>                                                             </endpoint>
>                                                         </call>
>                                                     </then>
>                                                 </filter>
>                                             </else>
>                                         </filter>
>                                     </else>
>                                 </filter>
>                             </else>
>                         </filter>
>                     </else>
>                 </filter>
>             </then>
>             <else>
>                 <call>
>                     <endpoint>
>                         <http method="get"
>                             
> uri-template="{uri.var.apiUrl}/v1/companies?oauth2_access_token={uri.var.accessToken}&amp;format=json"
>  />
>                     </endpoint>
>                 </call>
>             </else>
>         </filter>        
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to