8 Replies Latest reply on Oct 10, 2007 7:19 PM by Ron Sigal

    Config for EJB3 over servlet-invoker with compression

    Marc Reis Novice

      Hi,

      I am trying to get compression for the http communication between client and server.
      We are using JBoss 4.2.0.
      The communication over HTTP via the servlet-invoker works fine.
      Now we wanted to add compression to it. So there are two points that I see were this could be done (three with apache in mind).(My primary question upfront: what am I missing for the CompressionMarshaller to work?)

      1.) Add the compression="force" attribute in the jboss-web(tomcat) config for the http connector. (-> seems like application/octet-streams don?t get zipped)
      2.) Use the org.jboss.remoting.marshal.compress.CompressingMarshaller/CompressingUnMarshaller (-> probably missing some config, nothing happens here) in the ejb3 connector.

      For one I am wondering which would be best practice (if both is possible). In general I want to compress all there is.
      I have tried numerous config permutations, but none offer the result I would expect.

      Concerning the CompressingMarshaller it seems that I am missing some more config. I guess I need to somehow tell the servlet-invoker to talk gzip, since there is no difference with defining the CompressingMarshaller and "normal" communication.
      When tomcat compression is enabled, it seems that some data is compressed, but the main payload is transmitted as application/octet-stream and does not seem to get compressed
      I sniffed the communication with wire shark to see what is happening "down there". Just using the CompressionMarshaller shows no sign of gzip?ed data anywhere, so I guess I am somehow bypassing it.

      Sincerely Marc

      The config in ejb3-deployer/META-INF/jboss-service.xml

      ?
      <mbean code="org.jboss.remoting.transport.Connector"
       name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3">
       <depends>jboss.aop:service=AspectDeployer</depends>
       <attribute name="InvokerLocator">servlet://${jboss.bind.address}:8080/servlet-invoker/ServerInvokerServlet</attribu
      te>
       <attribute name="Configuration">
       <handlers>
       <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
       </handlers>
       <attribute name="dataType" isParam="true">serializable</attribute>
       <attribute name="marshaller" isParam="true">
       org.jboss.remoting.marshal.compress.CompressingMarshaller
       </attribute>
       <attribute name="unmarshaller" isParam="true">
       org.jboss.remoting.marshal.compress.CompressingUnMarshaller
       </attribute>
       </attribute>
       </mbean>
      ?


        • 1. Re: Config for EJB3 over servlet-invoker with compression
          Ron Sigal Master

          If the Connector MBean has an InvokerLocator attribute, the attributes inside the Configuration attribute will be ignored. So the references to the CompressingMarshaller and CompressingUnMarshaller are being lost.

          • 2. Re: Config for EJB3 over servlet-invoker with compression
            Marc Reis Novice

            Hi,
            thanks for the info!
            I tried configuring it :

             <mbean code="org.jboss.remoting.transport.Connector" name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3">
             <depends>jboss.aop:service=AspectDeployer</depends>
             <attribute name="Configuration">
             <config>
             <invoker transport="servlet">
             <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
             <attribute name="serverBindPort">8080</attribute>
             <attribute name="path">servlet-invoker/ServerInvokerServlet</attribute>
             <attribute name="dataType" isParam="true">serializable
             </attribute>
             <attribute name="marshaller" isParam="true">org.jboss.remoting.marshal.compress.CompressingMarshaller
             </attribute>
             <attribute name="unmarshaller" isParam="true">org.jboss.remoting.marshal.compress.CompressingUnMarshaller
             </attribute>
             </invoker>
             <handlers>
             <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
             </handlers>
             </config>
             </attribute>
             </mbean
            


            The Server WARN's when starting up
            ...
            14:41:07,203 INFO [TransactionManagerService] Binding TransactionManager JNDI Reference
            
            14:41:08,562 WARN [MarshalFactory] Found marshaller fully qualified class name within locator parameters, but was unable to load class: org.jboss.remoting.marshal.compress.CompressingMarshaller
            
            14:41:11,390 INFO [EJB3Deployer] Starting java:comp multiplexer
            ...
            

            and then throws an exception somewhat later
            14:41:37,312 INFO [TomcatDeployer] deploy, ctxPath=/servlet-invoker, warUrl=.../deploy/servlet-invoker.war/
            14:41:37,656 ERROR [[/servlet-invoker]] Servlet /servlet-invoker threw load() exception
            javax.servlet.ServletException: Can not find servlet server invoker with same locator as specified (servlet://localhost:8080/servlet-invoker/ServerInvokerServlet)
             at org.jboss.remoting.transport.servlet.web.ServerInvokerServlet.getInvokerFromInvokerUrl(ServerInvokerServlet.java:198)
             at org.jboss.remoting.transport.servlet.web.ServerInvokerServlet.init(ServerInvokerServlet.java:66)
             at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
             at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
            


            I tried the config of the attribute's dataType, marshaller, unmarshaller under the element , then both above mentioned messages wont appear, but there is no compression.
            I guess I am still messing up the config. Any help is greatly appreciated!

            Sincerely
            Marc

            • 3. Re: Config for EJB3 over servlet-invoker with compression
              Marc Reis Novice

              Hi,

              I have tried different configs and watched the amount of Data transfered.
              I did it with CompressionMarshaller, Tomcat Connectors compress=force and none.

              I configured the compressionMarschaller for ejb3 in the /deploy/ejb3.deployer/META-INF/ jboss-service.xml like this:

              <mbean code="org.jboss.remoting.transport.Connector"
               name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3">
               <depends>jboss.aop:service=AspectDeployer</depends>
               <attribute name="Configuration">
               <config>
               <invoker transport="servlet">
               <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
               <attribute name="serverBindPort">8080</attribute>
               <attribute name="path">servlet-invoker/ServerInvokerServlet</attribute>
               </invoker>
               <handlers>
               <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
               </handlers>
               <attribute name="dataType" isParam="true">serializable
               </attribute>
               <attribute name="marshaller" isParam="true">org.jboss.remoting.marshal.compress.CompressingMarshaller
               </attribute>
               <attribute name="unmarshaller" isParam="true">org.jboss.remoting.marshal.compress.CompressingUnMarshaller
               </attribute>
               </config>
               </attribute>
               </mbean>


              The results are not very representative since they are rather small, but none the less:
              Config Receive KB Sent KB
              CompressionMarshaller 497,28 69,81
              Http and CompMarshaller 485,31 69,81
              Http 483,33 58,11
              none 494,28 58,11
              


              I would plain the gap to the overhead in compression here, but as said, I dont get (see) any "gziped" Data on the wire when using the compressionMarshaller.
              Sincerely
              Marc

              • 4. Re: Config for EJB3 over servlet-invoker with compression
                Ron Sigal Master

                Based on your July 23 note, I guess you worked out the configuration problems, but just in case, here a couple of comments.


                ...
                14:41:07,203 INFO [TransactionManagerService] Binding TransactionManager JNDI Reference

                14:41:08,562 WARN [MarshalFactory] Found marshaller fully qualified class name within locator parameters, but was unable to load class: org.jboss.remoting.marshal.compress.CompressingMarshaller

                14:41:11,390 INFO [EJB3Deployer] Starting java:comp multiplexer
                ...


                This part surprises me. org.jboss.remoting.marshal.MarshalFactory.getMarshaller() looks for a datatype first and tries to get a marshaller based on the datatype. Given that "serializable" is a built-in datatype, it should retrieve a SerializableMarshaller and go away happy. I'm not sure why it's going on to look for a marshaller based on the marshaller's class name. Maybe turn on TRACE logging and see what you get. In any case, you want to take out the datatype=serializable.

                The other error message suggests a mismatch between the InvokerLocator constructed from the Connector MBean in the jboss-service.xml file and the InvokerLocator found in the web.xml file. The message

                14:41:37,656 ERROR [[/servlet-invoker]] Servlet /servlet-invoker threw load() exception
                javax.servlet.ServletException: Can not find servlet server invoker with same locator as specified (
                servlet://localhost:8080/servlet-invoker/ServerInvokerServlet)
                


                comes from org.jboss.remoting.transport.servlet.web.ServerInvokerServlet using the the InvokerLocator found in the web.xml file to find a matching server invoker. However, the server invoker constructed in accordance with the jboss-service.xml file has an InvokerLocator with parameters like marshaller, unmarshaller, and datatype in it. But ServerInvokerServlet is looking for "servlet://localhost:8080/servlet-invoker/ServerInvokerServlet", which must be what appears in your web.xml file. I.e., you want to change the InvokerLocator in web.xml to match the InvokerLocator of the actual server. If you set the logging level to DEBUG or TRACE and look in the server log file, you should see a message like "... started for locator ..." with the real InvokerLocator.

                Concerning the unimpressive compression performance, the jboss-service.xml file from July 23 still has the "datatype" - maybe you're not really using the CompressingMarshaller ... ?

                • 5. Re: Config for EJB3 over servlet-invoker with compression
                  Marc Reis Novice

                  Hi Ron,
                  thanks the help!
                  The error messages from the marshaller and the InvokerLocator where due to the missconfiguration in my Jul 7 posting. With the config as under Jul 23 they wont appear. Sorry I did not make that clear.

                  As to the compression. I removed the dataType element in the configuration. But unfourtunatly this does no difference to the compression.
                  I have loged the remoting with TRACE level to see what happens when I invoke:

                  2007-08-15 14:18:59,848 TRACE org.jboss.remoting.ServerInvoker] org.jboss.remoting.transport.servlet.ServletServerInvoker@1270107 successfully dispatched invocation, returning org.jboss.aop.joinpoint.InvocationResponse@d5cc1f from subsystem 'AOP' to client 4sgm2f-1u5hp7-f5dshz0z-1-f5dsiry7-4g
                  2007-08-15 14:18:59,848 TRACE [org.jboss.remoting.serialization.impl.java.JavaSerializationManager] Creating ObjectOutputStream
                  2007-08-15 14:18:59,876 TRACE [org.jboss.remoting.transport.servlet.web.ServerInvokerServlet] processRequest, ContentLength: 1039
                  2007-08-15 14:18:59,876 TRACE [org.jboss.remoting.transport.servlet.web.ServerInvokerServlet] processRequest, ContentType: application/octet-stream
                  2007-08-15 14:18:59,877 TRACE [org.jboss.remoting.serialization.impl.java.JavaSerializationManager] Creating ObjectInputStreamWithClassLoader
                  2007-08-15 14:18:59,877 TRACE [org.jboss.remoting.ServerInvoker] org.jboss.remoting.transport.servlet.ServletServerInvoker@1270107 received [advisedMethod=null, unadvisedMethod=null, metadata=[metaData={DISPATCHER={OID=[type=AS_ISvalue=jboss.j2ee:ear=th.ear,jar=lm-ejb.jar,name=UserBean,service=EJB3,element=ProxyFactory]}, REMOTING={SUBSYSTEM=[type=AS_ISvalue=AOP], INVOKER_LOCATOR=[type=AS_ISvalue=InvokerLocator [servlet://o06.company.com:8080/servlet-invoker/ServerInvokerServlet]]}}], targetObject=null, arguments=null]
                  2007-08-15 14:18:59,878 TRACE [org.jboss.remoting.ServerInvoker] org.jboss.remoting.transport.servlet.ServletServerInvoker@1270107 dispatching InvocationRequest[133f619, AOP, [advisedMethod=null, unadvisedMethod=null, metadata=[metaData={DISPATCHER={OID=[type=AS_ISvalue=jboss.j2ee:ear=th.ear,jar=lm-ejb.jar,name=UserBean,service=EJB3,element=ProxyFactory]}, REMOTING={SUBSYSTEM=[type=AS_ISvalue=AOP], INVOKER_LOCATOR=[type=AS_ISvalue=InvokerLocator [servlet://o06.company.com:8080/servlet-invoker/ServerInvokerServlet]]}}], targetObject=null, arguments=null]] from client 4sgm2f-1u5hp7-f5dshz0z-1-f5dsirzi-4i to subsystem 'AOP'
                  2007-08-15 14:18:59,879 TRACE [org.jboss.remoting.ServerInvoker] org.jboss.remoting.transport.servlet.ServletServerInvoker@1270107 successfully dispatched invocation, returning org.jboss.aop.joinpoint.InvocationResponse@61ef35 from subsystem 'AOP' to client 4sgm2f-1u5hp7-f5dshz0z-1-f5dsirzi-4i
                  2007-08-15 14:18:59,879 TRACE [org.jboss.remoting.serialization.impl.java.JavaSerializationManager] Creating ObjectOutputStream
                  2007-08-15 14:19:40,209 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] Periodic recovery - first pass <Mi, 15 Aug 2007 14:19:40>
                  


                  Sincerely
                  Marc

                  • 6. Re: Config for EJB3 over servlet-invoker with compression
                    Ron Sigal Master

                    Hi Marc,

                    Sorry I'm so late in replying. I just noticed something in your mbean configuration: the marshaller and unmarshaller attributes should be under the invoker element:

                    <mbean code="org.jboss.remoting.transport.Connector"
                     name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3">
                     <depends>jboss.aop:service=AspectDeployer</depends>
                     <attribute name="Configuration">
                     <config>
                     <invoker transport="servlet">
                     <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
                     <attribute name="serverBindPort">8080</attribute>
                     <attribute name="path">servlet-invoker/ServerInvokerServlet</attribute>
                     <attribute name="marshaller" isParam="true">org.jboss.remoting.marshal.compress.CompressingMarshaller</attribute>
                     <attribute name="unmarshaller" isParam="true">org.jboss.remoting.marshal.compress.CompressingUnMarshaller</attribute>
                     </invoker>
                     <handlers>
                     <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
                     </handlers>
                     </config>
                     </attribute>
                    </mbean>
                    


                    • 7. Re: Config for EJB3 over servlet-invoker with compression
                      Marc Reis Novice

                      Thank you Ron,
                      with that it worked!

                      Sincerely Marc

                      • 8. Re: Config for EJB3 over servlet-invoker with compression
                        Ron Sigal Master

                        And all's well that ends well. Thanks.

                        -Ron