Scott, Thank you for you big work for submitting this all staff. Comparing my sources with cvs, I agree that only change left is SOAPMappingRegistry (only optimizes startup) + DeploymentDescriptor + ComplexRequest from examples. However after XMLMappingREgistry was changed to do not use string keys, the importance of this change reduced - the main performance boost was for reducing number of call for getKey() function, but there no such a function anymore.
I as I wrote the big performance reserve left for those who uses xerces 2 - is disable deffered node expansion feature. I asked a question on xerces forum, and all who answered said this feature better be disabled by default. You can read a thread by the following URL http://marc.theaimsgroup.com/?l=xerces-j-dev&m=103780269004690&w=2. I would propose hardcode disabling this function if factory class is org.apache.xerces.jaxp.DocumentBuilderFactoryImpl. There also interesting links there which compares different DOM parsers, and gives a possibility to improve application performance even further, by choosing proper library. The correct performance for some cases (not for all sure) is 2-3 times better than it was in Apache SOAP 2.3.1. It would be interesting to compare current performance to Axis. Best regardws, Pavel > -----Original Message----- > From: Scott Nichol [mailto:[EMAIL PROTECTED]] > Sent: Thursday, November 21, 2002 12:25 AM > To: [EMAIL PROTECTED] > Subject: Re: cvs commit: > xml-soap/java/src/org/apache/soap/util/xml XMLParserUtils.java > > > Pavel, > > I committed this code for now. > > I believe the only outstanding patch submission from you is > SOAPMappingRegistry. I know it's hard to believe, but I will > get to it > eventually! > > Thanks for all the work on the MIME stuff. It is a great performance > boost. > > Scott Nichol > > ----- Original Message ----- > From: <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, November 20, 2002 4:54 PM > Subject: cvs commit: xml-soap/java/src/org/apache/soap/util/xml > XMLParserUtils.java > > > > snichol 2002/11/20 13:54:25 > > > > Modified: java/src/org/apache/soap/rpc Call.java > > java/src/org/apache/soap/server/http > RPCRouterServlet.java > > java/src/org/apache/soap/util/xml XMLParserUtils.java > > Log: > > Submitted by: Pavel Ausianik <[EMAIL PROTECTED]> > > > > Please see what I propose to solve problem with many allocated > > DocumentBuilders. > > Other classes were DocumentBuilder is used can be easily > adopted in > the same > > way as Call is. > > > > See thread at > http://marc.theaimsgroup.com/?l=soap-dev&m=103582304223623&w=2 > > for discussion of document builder pooling. > > > > Revision Changes Path > > 1.24 +10 -4 > xml-soap/java/src/org/apache/soap/rpc/Call.java > > > > Index: Call.java > > > =================================================================== > > RCS file: > /home/cvs/xml-soap/java/src/org/apache/soap/rpc/Call.java,v > > retrieving revision 1.23 > > retrieving revision 1.24 > > diff -u -r1.23 -r1.24 > > --- Call.java 20 Nov 2002 21:34:42 -0000 1.23 > > +++ Call.java 20 Nov 2002 21:54:25 -0000 1.24 > > @@ -90,7 +90,6 @@ > > */ > > public class Call extends RPCMessage > > { > > - private DocumentBuilder xdb; > > private SOAPMappingRegistry smr = null; > > private SOAPTransport st = null;; > > private int to = 0; > > @@ -452,8 +451,15 @@ > > } > > > > // if the DOM parser hasn't been created yet, do it now > > - if (xdb == null) > > - xdb = XMLParserUtils.getXMLDocBuilder(); > > - return xdb.parse(input); > > + DocumentBuilder xdb = > XMLParserUtils.getXMLDocBuilderFromPool(); > > + Document doc = null; > > + // if the DOM parser hasn't been created yet, do it now > > + try { > > + doc = xdb.parse(input); > > + } > > + finally { > > + XMLParserUtils.returnDocumentBuilderToPool(xdb); > > + } > > + return doc; > > } > > } > > > > > > > > 1.44 +14 -10 > xml-soap/java/src/org/apache/soap/server/http/RPCRouterServlet.java > > > > Index: RPCRouterServlet.java > > > =================================================================== > > RCS file: > /home/cvs/xml-soap/java/src/org/apache/soap/server/http/RPCRou terServlet > .java,v > > retrieving revision 1.43 > > retrieving revision 1.44 > > diff -u -r1.43 -r1.44 > > --- RPCRouterServlet.java 20 Nov 2002 21:34:42 -0000 1.43 > > +++ RPCRouterServlet.java 20 Nov 2002 21:54:25 -0000 1.44 > > @@ -307,17 +307,21 @@ > > // EnvelopeEditor > > // Note: XMLParser that is specified by > init-param isused > in > > // this process. > > - DocumentBuilder xdb = > XMLParserUtils.getXMLDocBuilder(); > > + DocumentBuilder xdb = > XMLParserUtils.getXMLDocBuilderFromPool(); > > > > - callEnv = > > - ServerHTTPUtils.readEnvelopeFromRequest(xdb, > > - > req.getContentType(), > > - > req.getContentLength(), > > - > req.getInputStream(), > > - editor, > > - res, > > - reqCtx, > > - > ServerHTTPUtils.getHeaders(req)); > > + try { > > + callEnv = > > + ServerHTTPUtils.readEnvelopeFromRequest(xdb, > > + > req.getContentType(), > > + > req.getContentLength(), > > + > req.getInputStream(), > > + editor, > > + res, > > + reqCtx, > > + > ServerHTTPUtils.getHeaders(req)); > > + } finally { > > + XMLParserUtils.returnDocumentBuilderToPool(xdb); > > + } > > if (callEnv == null) > > return; > > call = > RPCRouter.extractCallFromEnvelope(serviceManager, > callEnv, > > > > > > > > 1.8 +38 -12 > xml-soap/java/src/org/apache/soap/util/xml/XMLParserUtils.java > > > > Index: XMLParserUtils.java > > > =================================================================== > > RCS file: > /home/cvs/xml-soap/java/src/org/apache/soap/util/xml/XMLParser Utils.java > ,v > > retrieving revision 1.7 > > retrieving revision 1.8 > > diff -u -r1.7 -r1.8 > > --- XMLParserUtils.java 30 Oct 2002 02:43:04 -0000 1.7 > > +++ XMLParserUtils.java 20 Nov 2002 21:54:25 -0000 1.8 > > @@ -57,7 +57,8 @@ > > > > package org.apache.soap.util.xml; > > > > -import java.util.HashMap; > > +import java.util.List; > > +import java.util.ArrayList; > > import javax.xml.parsers.*; > > import org.xml.sax.*; > > import org.xml.sax.helpers.*; > > @@ -73,7 +74,7 @@ > > */ > > public class XMLParserUtils { > > private static DocumentBuilderFactory dbf = null; > > - private static HashMap docBuilderTable = new HashMap (); > > + private static List allocatedBuildersList = new ArrayList(10); > > > > static { > > // Create a default instance. > > @@ -167,20 +168,45 @@ > > */ > > synchronized public static DocumentBuilder getXMLDocBuilder() > > throws IllegalArgumentException { > > - // if a document builder has already been created for this > thread > > - // then just reuse that. otherwise create a new one and > remember it. > > - Thread t = Thread.currentThread (); > > - DocumentBuilder db = (DocumentBuilder) > docBuilderTable.get (t); > > - if (db != null) { > > - return db; > > - } else { > > try { > > - db = dbf.newDocumentBuilder(); > > - docBuilderTable.put (t, db); > > - return db; > > + return dbf.newDocumentBuilder(); > > } catch (ParserConfigurationException pce) { > > throw new IllegalArgumentException(pce.toString()); > > } > > } > > + > > + > > + /** > > + * Use this method to get a JAXP document builder. > > + * This method either returns a previosly allocated > DocumentBuilder > > + * or creates a namespace aware, nonvalidating > > + * instance of the XML parser. > > + * > > + * @return DocumentBuilder an instance of a document builder, > > + * or null if a ParserConfigurationException was thrown. > > + */ > > + synchronized public static DocumentBuilder > getXMLDocBuilderFromPool() { > > + // First check if we have DocBuider available > > + DocumentBuilder builder = null; > > + int size = allocatedBuildersList.size(); > > + if ( size > 0) { > > + builder = > (DocumentBuilder)allocatedBuildersList.get(size-1); > > + allocatedBuildersList.remove(size-1); > > + } else > > + // Not available - create a new DocumentBuilder > > + builder = XMLParserUtils.getXMLDocBuilder(); > > + > > + return builder; > > + } > > + > > + /** > > + * Return a JAXP document builder, previosly allocated > by method > > + * getXMLDocBuilderFromPool() for further reuse > > + * > > + * @param builder a DocumentBuilder to release > > + */ > > + synchronized public static void > returnDocumentBuilderToPool(DocumentBuilder builder) { > > + if (builder != null) > > + allocatedBuildersList.add(builder); > > } > > } > > > > > > > > > > -- > > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > > > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>