On Wed, Sep 12, 2012 at 5:59 PM, Amila Suriarachchi <[email protected]> wrote: > hi all, > > For SOAP message based content based routing, currently we use SOAPBuilder > and SOAPMessageFormater to build the soap envelop and serialize it. But > however in the content based routing the only message part required to read > is the parts that has the content need for routing. On the other hand there > is no need to build the response xml message if no mediation required for > response. > > Therefore we can make this perform better with the following steps. First at > the message builder level we create a buffered input stream to buffer the > read message and set this as a message context property. Then at the synapse > engine level we can copy this bufferedInput stream to out message context. > Now at the out message context we can access the buffered input stream and > use that to directly serialize the message from the input stream after > resetting the input stream. > > I have created the related patch here[1]. With this patch I could improve > the TPS for the following proxy services with 10k message from 1,700.7 to > 12,135.48 (25% gain). > > > <proxy name="CBRProxy" transports="https http" startOnLoad="true"> > > <target> > > <inSequence> > > <property name="passThroughProxy" value="true" scope="default" > type="STRING"/> > > <filter xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > source="//order[1]/symbol" regex="IBM"> > > <then> > > <send> > > <endpoint key="RealService"/> > > </send> > > </then> > > <else> > > <makefault version="soap11"> > > <code xmlns:sf11="http://schemas.xmlsoap.org/soap/envelope/" > value="sf11:Server"/> > > <reason value="First order must be for the symbol IBM"/> > > </makefault> > > <header name="To" action="remove"/> > > <property name="RESPONSE" value="true"/> > > <send/> > > </else> > > </filter> > > </inSequence> > > </target> > > <publishWSDL key="ProxyWSDL-embedded.wsdl"/> > > </proxy> > > > Here are the other improvements can be done for this method. > > Here user have to set whether it is a pass through proxy or not using a > property mediator. However we can use some mechanism where each synapse > mediator set a property if that change the incoming message. If the message > has not been changed that can be pass through like this.
There is another interesting option here that is less error prone. We could add a feature to Axiom that tracks changes to the object model. The idea would be to add a "version" property to OMContainer that is incremented every time the node or one of its descendants is modified. Of course this would only happen for modifications done programmatically, not for nodes added by the builder. This means that in an object model constructed from an input stream, the version of all nodes (and in particular the root node) would be 0 unless the document has been modified. Such a feature would probably have other interesting applications elsewhere. On the other hand, this will require more work because it needs to be designed carefully and we need to make sure that we have unit tests for all possible cases. > I have used buffered Input stream here. We may write a custom Input stream > reader to perform this job better. > > Currently Axiom xpath build the whole soap envelope. Therefore if we can > write an axiom xpath engine which only builds the required parts performance > can be further improved. > > I have created the patch basically demonstrate the concept. There can be > more efficient way of implementing as well. > > WDTY? > > Thanks, > > Amila. > > [1] https://issues.apache.org/jira/browse/SYNAPSE-909 > > > > -- > Amila Suriarachchi > WSO2 Inc. > blog: http://amilachinthaka.blogspot.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
