Hello,

Thinking further, there is a possibility in the SOAPMappingRegistry create a
registry without parent, there are just no sample how to use it.
So I have  updated the sample, ComplexRequest. Maybe there are some
performance FAQ which could be updated?

Also I modified SOAPMappingRegistry , so it only creates necessary instances
of the base registries.

And finally I modified DeploymentDescriptor, so for Application Scope
services, it creates a registry without parent.
Please find patch attached

Thanks,
Pavel



> -----Original Message-----
> From: Pavel Ausianik 
> Sent: Tuesday, November 05, 2002 8:37 PM
> To: '[EMAIL PROTECTED]'
> Subject: Performance reserve
> 
> 
> Hello,
> 
> I have found another good source of the performance reserve, 
> which could be further 5-6% to current state, however I'm not 
> sure how to implement this.
> 
> The problem:  XMLJavaMappingRegistry.getKey takes up to 6-10% 
>  of all time (it also includes QNAme.toString(), etc.)
> 
> Simple println inserted into this function shows that a 
> request for every key comes twice apart, on any call, both in 
> the client & server, always going to the parent registry as 
> in following example:
> 
>   protected Deserializer queryDeserializer_(QName elementType,
>                                             String encodingStyleURI)
>   {
>     Deserializer ds = super.queryDeserializer_(elementType, 
> encodingStyleURI);
>     if (ds != null) {
>       return ds;
>     }
>     if (parent != null) {
>       ds = parent.queryDeserializer_(elementType, encodingStyleURI);
>       if (ds != null) {
>         return ds;
>       }
>     }
>     return null;
>   }
>  
> the same occurs in the querySerializer_, and queryJavaType_ 
> calls. First call fails since registry created does not have 
> entries for 
> At least this happens in the sample addressbook. Since this 
> occurs both on the server and client, that mean that registry 
> is not organized well in library itself. Maybe sample just 
> does not show how better the SOAPMappingRegistry should be 
> organized. Maybe for those users who have found that 
> SOAPMappingRegistry should be shared between all Calls we 
> should create not Registry with custom mapping + parent 
> Registry, but copy of standard registry , without parent at 
> all (for users who creates registry every time it is not 
> acceptable). ANother solution could make registry "learn" 
> from parent all mapping. 
> 
> Here is a output of printlns inserted in both getKey 
> functions (with Class and Qname), made for a single call of getAddress
> 
> CKEY org.apache.soap.rpc.Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> CKEY org.apache.soap.rpc.Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> CKEY java.lang.String + http://schemas.xmlsoap.org/soap/encoding/
> CKEY java.lang.String + http://schemas.xmlsoap.org/soap/encoding/
> CKEY java.lang.String + http://schemas.xmlsoap.org/soap/encoding/
> CKEY java.lang.String + http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://schemas.xmlsoap.org/soap/envelope/:Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://schemas.xmlsoap.org/soap/envelope/:Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY urn:xml-soap-address-demo:address + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY urn:xml-soap-address-demo:address + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://schemas.xmlsoap.org/soap/envelope/:Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://schemas.xmlsoap.org/soap/envelope/:Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY urn:xml-soap-address-demo:phone + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY urn:xml-soap-address-demo:phone + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://schemas.xmlsoap.org/soap/envelope/:Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://schemas.xmlsoap.org/soap/envelope/:Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://www.w3.org/2001/XMLSchema:string + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://www.w3.org/2001/XMLSchema:string + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://schemas.xmlsoap.org/soap/envelope/:Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://schemas.xmlsoap.org/soap/envelope/:Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://www.w3.org/2001/XMLSchema:int + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://www.w3.org/2001/XMLSchema:int + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://schemas.xmlsoap.org/soap/envelope/:Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://schemas.xmlsoap.org/soap/envelope/:Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://www.w3.org/2001/XMLSchema:string + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://www.w3.org/2001/XMLSchema:string + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://schemas.xmlsoap.org/soap/envelope/:Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://schemas.xmlsoap.org/soap/envelope/:Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://www.w3.org/2001/XMLSchema:int + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://www.w3.org/2001/XMLSchema:int + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://schemas.xmlsoap.org/soap/envelope/:Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://schemas.xmlsoap.org/soap/envelope/:Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://www.w3.org/2001/XMLSchema:int + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://www.w3.org/2001/XMLSchema:int + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://schemas.xmlsoap.org/soap/envelope/:Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://schemas.xmlsoap.org/soap/envelope/:Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://www.w3.org/2001/XMLSchema:string + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://www.w3.org/2001/XMLSchema:string + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://schemas.xmlsoap.org/soap/envelope/:Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://schemas.xmlsoap.org/soap/envelope/:Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://www.w3.org/2001/XMLSchema:string + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://www.w3.org/2001/XMLSchema:string + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://schemas.xmlsoap.org/soap/envelope/:Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://schemas.xmlsoap.org/soap/envelope/:Parameter + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://www.w3.org/2001/XMLSchema:string + 
> http://schemas.xmlsoap.org/soap/encoding/
> QKEY http://www.w3.org/2001/XMLSchema:string + 
> http://schemas.xmlsoap.org/soap/encoding/
> 
> Best regards,
> Pavel
> 
> 
> 
> 

Index: ComplexRequest.java
===================================================================
RCS file: /home/cvspublic/xml-soap/java/samples/addressbook/ComplexRequest.java,v
retrieving revision 1.1
diff -u -r1.1 ComplexRequest.java
--- ComplexRequest.java 4 Nov 2002 19:05:53 -0000       1.1
+++ ComplexRequest.java 6 Nov 2002 16:03:12 -0000
@@ -92,7 +92,8 @@
     // Number of running threads
     public static int numberRequests;
 
-    static SOAPMappingRegistry smr = new SOAPMappingRegistry();
+
+    static SOAPMappingRegistry smr = null;
 
     static String encodingStyleURI;
     static URL url;
@@ -240,8 +241,8 @@
       maxIterations = Integer.parseInt(args[2 - offset]);
       int numThreads = Integer.parseInt(args[3 - offset]);
 
-
-      smr = new SOAPMappingRegistry();
+      // Create registry, without parent, to improve performance
+      smr = new SOAPMappingRegistry(null, Constants.NS_URI_2001_SCHEMA_XSD);
       BeanSerializer beanSer = new BeanSerializer();
 
       // Map the types.
@@ -278,4 +279,3 @@
       System.out.println("Time to run " + maxIterations + " requests is " + 
((time2-time)/1000.0d) + " sec ");
     }
 }
-
Index: SOAPMappingRegistry.java
===================================================================
RCS file: 
/home/cvspublic/xml-soap/java/src/org/apache/soap/encoding/SOAPMappingRegistry.java,v
retrieving revision 1.33
diff -u -r1.33 SOAPMappingRegistry.java
--- SOAPMappingRegistry.java    6 Nov 2002 15:11:08 -0000       1.33
+++ SOAPMappingRegistry.java    6 Nov 2002 16:06:55 -0000
@@ -420,24 +420,37 @@
    * 2001 base registry is returned.
    */
   public static SOAPMappingRegistry getBaseRegistry (String schemaURI) {
-    synchronized (SOAPMappingRegistry.class) {
-      if (baseReg1999 == null) {
-       baseReg1999 =
-         new SOAPMappingRegistry (null, Constants.NS_URI_1999_SCHEMA_XSD);
-       baseReg2000 =
-         new SOAPMappingRegistry (null, Constants.NS_URI_2000_SCHEMA_XSD);
-       baseReg2001 =
-         new SOAPMappingRegistry (null, Constants.NS_URI_2001_SCHEMA_XSD);
+      if (schemaURI.equals(Constants.NS_URI_1999_SCHEMA_XSD)) {
+          if (baseReg1999 == null) {
+              synchronized (SOAPMappingRegistry.class) {
+                  if (baseReg1999 == null) {
+                      baseReg1999 =
+                              new SOAPMappingRegistry (null, 
+Constants.NS_URI_1999_SCHEMA_XSD);
+                  }
+              }
+          }
+          return baseReg1999;
+      }
+      if (schemaURI.equals( Constants.NS_URI_2000_SCHEMA_XSD)) {
+          if (baseReg2000 == null) {
+              synchronized (SOAPMappingRegistry.class) {
+                  if (baseReg2000 == null) {
+                      baseReg2000 =
+                              new SOAPMappingRegistry (null, 
+Constants.NS_URI_2000_SCHEMA_XSD);
+                  }
+              }
+          }
+          return baseReg2000;
+      }
+      if (baseReg2001 == null) {
+          synchronized (SOAPMappingRegistry.class) {
+              if (baseReg2001 == null) {
+                  baseReg2001 =
+                          new SOAPMappingRegistry (null, 
+Constants.NS_URI_2001_SCHEMA_XSD);
+              }
+          }
       }
-    }
-
-    if (schemaURI.equals(Constants.NS_URI_1999_SCHEMA_XSD)) {
-      return baseReg1999;
-    } else if (schemaURI.equals(Constants.NS_URI_2000_SCHEMA_XSD)) {
-      return baseReg2000;
-    } else {
       return baseReg2001;
-    }
   }
 
   /** Set the default encoding style.  If the query*() calls
Index: DeploymentDescriptor.java
===================================================================
RCS file: 
/home/cvspublic/xml-soap/java/src/org/apache/soap/server/DeploymentDescriptor.java,v
retrieving revision 1.35
diff -u -r1.35 DeploymentDescriptor.java
--- DeploymentDescriptor.java   30 Aug 2002 03:22:54 -0000      1.35
+++ DeploymentDescriptor.java   6 Nov 2002 16:10:21 -0000
@@ -140,12 +140,12 @@
   {
       return checkMustUnderstands;
   }
-  
+
   public void setCheckMustUnderstands(boolean doIt)
   {
       checkMustUnderstands = doIt;
   }
-  
+
   /**
    * Type of the service: message or procedural service. Defaults to being
    * a procedural service. The difference is that if its procedural then
@@ -487,7 +487,7 @@
                                           "missing in deployment descriptor");
     }
     dd.setID (id);
-    
+
     // If we've been marked as checking mustUnderstands, do it.
     String checkMustUnderstands = DOMUtils.getAttribute(root, "checkMustUnderstands");
     if (checkMustUnderstands != null) {
@@ -657,7 +657,7 @@
       methods[i] = st.nextToken ();
     }
     dd.setMethods (methods);
-    
+
     //read the fault listeners
     nl = root.getElementsByTagNameNS (Constants.NS_URI_XML_SOAP_DEPLOYMENT,
                                       "faultListener");
@@ -746,7 +746,7 @@
     lis.append("]");
 
     StringBuffer opts = new StringBuffer();
-    if (props != null) 
+    if (props != null)
       opts.append( props.toString() );
 
     return header + body + "methods='" + methodsStrbuf + "', " +
@@ -798,14 +798,21 @@
       }
 
       if (smr == null) {
-       SOAPMappingRegistry baseReg = SOAPMappingRegistry.getBaseRegistry (
-          Constants.NS_URI_CURRENT_SCHEMA_XSD);
        if (maps == null) {
-         dd.setCachedSMR (baseReg);
+          SOAPMappingRegistry baseReg = SOAPMappingRegistry.getBaseRegistry (
+              Constants.NS_URI_CURRENT_SCHEMA_XSD);
+          dd.setCachedSMR (baseReq);
          return baseReg;
        } else {
-         smr = new SOAPMappingRegistry (baseReg); 
-        }
+          if (dd.getScope() ==  SCOPE_APPLICATION) {
+            // If scope is application, use full registry
+            smr = new SOAPMappingRegistry (null,
+                    Constants.NS_URI_CURRENT_SCHEMA_XSD);
+          } else {
+            // Otherwise use registry with parent
+            smr = new SOAPMappingRegistry ();
+          }
+       }
       }
     }
 
@@ -816,7 +823,7 @@
         try {
           step = 0;
           Class javaType = null;
-          if (tm.javaType != null) 
+          if (tm.javaType != null)
             javaType = ctx.loadClass( tm.javaType );
           step = 1;
           Serializer s = null;

--
To unsubscribe, e-mail:   <mailto:soap-dev-unsubscribe@;xml.apache.org>
For additional commands, e-mail: <mailto:soap-dev-help@;xml.apache.org>

Reply via email to