Re: Compressing traffic over RMI/IIOP

From: Ken Cavanaugh <Ken.Cavanaugh_at_Sun.COM>
Date: Mon, 15 Feb 2010 14:16:27 -0800

Andreas Kozma wrote:
> Dear All,
> we are using Glassfish 2.1 for an ERP project with standalone java rich clients. network traffic is starting to become an issue.
> while we found some articles on how to create custom socket factories that compress streams, we have found no indication how traffic could be compress using the Glassfish CORBA implementation.
> Can anybody provide us with some pointers? Your help is greatly appreciated.
> Kind regards,
> - Andreas Kozma
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
The ORB-level socket factories might be usable for this, in a
create special socket (where Socket.get(In|Out)putStream ->
create special (in|out)put stream implementation which wraps read/write).
You could probably make this work with something like
LZMA as the compression engine.

Problems with this include the fact that the socket factories for the
ORB in GF are already in use for handling CSIv2 (SSL), and there is
no provision for adding compression to the existing socket factories.
It's certainly doable, but not supported. I also don't know how much
of a problem compression engine dictionary state management would
be: the ORB may keep a single connection open for a VERY long time,
potentially sending/receiving many GB of data.

The ORB would also require a way to recognize whether or not compression
should be applied. Probably this is best handled per-connection: once
compression is enabled for a connection, it must always be enabled.
Usually this sort of thing gets shoved into a tagged component in an IOR,
but this would also interact with the ORB's connection management.

There is also the Java-level SocketImplFactory, which might be usable
for this purpose. Here you would have problems with getting only the
RMI-IIOP traffic compressed.

Basically, I don't think there is an easy way to add compression to the
implementation in GFv2.1 (or GFv3). This is also the first interest in such
a feature for GlassFish that I am aware of, so I haven't spent much time
thinking about it.