Archived

This forum has been archived. Please start a new discussion on GitHub.

Enforcing compression problem

Hi all,

I am trying to setting up a sample test case demonstrating the compression capabilities but i got problems ensuring a message is compressed.
I have built the test case on the IceGrid example found in demoj/IceGrid/simple.
I have first added two new commands for the client:
b xxxx which sends a sequence of xxxx bytes
z xxxx which sends the same sequence but through a (i expect) proxy using compression.

Runtime: Ice 3.3.1
Platform: Windows XP SP2

I also modified the hello.ice definition:
module Demo {
        sequence<byte> Message;

        interface Hello {
	    idempotent void sayHello();
            void send(Message m);
            void shutdown();
	};
};
The client code is modified so that two proxies are created:
		HelloPrx hello = null;
		HelloPrx helloBzip = null;
		try {
			hello = HelloPrxHelper.checkedCast(communicator().stringToProxy(
					"hello"));
			System.err.println("Connected!\n"+hello.ice_getConnection()._toString());
			helloBzip = HelloPrxHelper.uncheckedCast(hello.ice_compress(true));
			if (helloBzip != null) {
				System.err.println("Compression is available!\n"+helloBzip.ice_getConnection()._toString());
			}
		} catch (Ice.NotRegisteredException ex) {
		}
In my 'b' command i call hello.send(buffer), and in the 'z' command i call helloBzip.send(buffer).

The server is running inside its node, like the original sample, and i modified the config parameters to allow large messages and having an endpoint with the '-z' hint:
         <server id="SimpleServer" activation="on-demand" exe="java">
            <option>-Xmx512M</option>
            <option>Server</option>
            <env>CLASSPATH=${ICE_LIB};bin</env>
            <properties>
               <property name="Ice.MessageSizeMax" value="102400"/>
               <property name="Ice.CacheMessageBuffers" value="0"/>
               <property name="Ice.Trace.Protocol" value="2"/>
            </properties>
            <adapter name="Hello" endpoints="default -p 9999 -z" id="${server}.Hello">
               <object identity="hello" type="::Demo::Hello" property="Identity"/>
            </adapter>
         </server>
The client configuration is also modified accordingly:
Ice.MessageSizeMax=102400
Ice.Trace.Network=1
Ice.Trace.Protocol=1

At runtime, everything is fine, the message is sent, the server activates on demand, etc.
But, the compression is never used, as the following trace shows:
==> z 100000000
[ 19/05/09 09:16:59:254 Protocol: sending request
  message type = 0 (request)
  compression status = 0 (not compressed; do not compress response, if any)
  message size = 100000044
  request id = 2
  identity = hello
  facet =
  operation = send
  mode = 0 (normal)
  context =  ]
[ 19/05/09 09:17:00:145 Protocol: received reply
  message type = 2 (reply)
  compression status = 0 (not compressed; do not compress response, if any)
  message size = 25
  request id = 2
  reply status = 0 (ok) ]
Sent 100000000 bytes in 1232.320588ms
==> [ 19/05/09 09:17:53:069 Protocol: sending close connection
  message type = 4 (close connection)
  compression status = 0 (not compressed; do not compress response, if any)
  message size = 14 ]
[ 19/05/09 09:17:53:069 Network: closing tcp connection
  local address = 127.0.0.1:4494
  remote address = 127.0.0.1:4061 ]
[ 19/05/09 09:18:05:070 Protocol: sending close connection
  message type = 4 (close connection)
  compression status = 0 (not compressed; do not compress response, if any)
  message size = 14 ]
[ 19/05/09 09:18:05:085 Network: closing tcp connection
  local address = 10.222.144.233:4527
  remote address = 10.222.144.233:9999 ]
I certainly did a naive assumption that using a proxy created by hello.ice_compress(true) will enable the compression facility for each call!

(I also noted that in the registry, the published endpoints do not display the '-z' flag, but i'm not sure if this is relevant or not in the admin GUI...)

where did i get wrong?
What are your recommendations to force the use of the compression in the application?

Thanks for your help.

Regards

Comments

  • benoit
    benoit Rennes, France
    Hi Christophe,

    Using ice_compress(true) on the proxy is fine to enable compression. However, with Ice for Java you also need the ant.jar file to be in your CLASSPATH for compression to be enabled as this Jar contains the Bzip2 compression routines required by Ice. Do you have it in your CLASSPATH?

    This is documented in the java/INSTALL file of the source distribution however I didn't see any mention of this in our binary distributions... we'll correct this for the next release.

    Cheers,
    Benoit.
  • Thank you Benoit, i missed the ant.jar stuff.

    After adding the library to both the server and client CLASSPATH, it works as expected.

    Cheers.