[muscle] Re: Muscle 3.11b Java check

  • From: Lior Okman <lior.okman@xxxxxxxxxxxxxxxxxxxxxxxx>
  • To: jaf@xxxxxxxxxxxx
  • Date: Wed, 01 Mar 2006 10:42:53 +0200

Jeremy Friesner wrote:

>Hi Lior,
>  
>
Hi Jeremy,

Please note that my email address isn't "lior at netvision.net.il". I
got this mail via the mailing list.

>I'm getting ready to release muscle 3.11, and as part of that I finally went 
>through and tested/exercised the changes you made to speed up the Java client 
>code.  The code looks good, but I did make a few minor changes.  I've posted 
>a new archive of the code in its current state, in case you (or anyone else) 
>would like to check things over before I post the new version.  The 3.11-beta 
>archive is here:
>
>   http://www.lcscanada.com/jaf/muscle-3.11b-2-28-2006.zip
>
>  
>
I'm attaching a minor patch to this version.

The only change is that instead of requiring a SocketChannel in the
AbstractMessageIOGateway, the interface requires a ByteChannel. The same
with MessageTransceiver, in case the channel is provided via the
constructors. This allows for using the MessageTransceiver class to
read/write from any channel implementing ByteChannel - e.g. a FileChannel.

>Changes I made to the Java code include:
>
>[...]
>- MessageTransceiver now starts off with a 64KB receive buffer (instead of 
>2MB).  This buffer will of course be resized larger when necessary.  When 
>resizing the buffer, the code now tries to resize the buffer to at least 
>double the previous size, to minimize the number of resizes necessary.
>
>  
>
The reason I chose a larger buffer in the first place is to minimize the
number of resizes as much as possible and also to read as much data as
possible from the channel at once. If there is a workload consisting of
a large amount of small messages, reading 64K at a time is less
efficient than reading up to 2Mb at a time. Maybe there should be
another parameter available to set the initial buffer size, and use 64K
as a default?

>[...]
>-Jeremy
>
>  
>
I'm also attaching a new build.xml for the java directory. This
build.xml file allows for packaging the java client in two ways:
including jzlib and without jzlib.

Lior
<?xml version="1.0" encoding="utf-8" ?>
<project default="jar" name="Build the muscle jar for this version" basedir=".">

    <target name="init">
        <mkdir dir="src"/>
        <mkdir dir="bin"/>
        <copy todir="src/com">
            <fileset dir="com"/>
        </copy>
    </target>
        
    <target name="build" depends="init" >
        <javac destdir="bin" debug="on">
                <src path="src" />
        </javac>
    </target>
    
    <target name="minimaljar" depends="build">
        <jar destfile="muscle.jar" basedir="bin" index="true" 
excludes="com/jcraft/**.*" >
          <manifest>
                    <attribute name="Built-By" value="${user.name}"/>
                    <section name="common">
                      <attribute name="Specification-Title" value="Muscle"/>
                      <attribute name="Specification-Version" value="3.11"/>
                      <attribute name="Specification-Vendor" value="Level 
Control Systems"/>
                    </section>
          </manifest>
          
        </jar>
    </target>


    <target name="jar" depends="build">
        <jar destfile="muscle.jar" basedir="bin" index="true" >
          <manifest>
                    <attribute name="Built-By" value="${user.name}"/>
                    <section name="common">
                      <attribute name="Specification-Title" value="Muscle"/>
                      <attribute name="Specification-Version" value="3.11"/>
                      <attribute name="Specification-Vendor" value="Level 
Control Systems"/>
                    </section>
          </manifest>
          
        </jar>
    </target>

    <target name='clean'>
        <delete file='muscle.jar'/>
        <delete dir='src'/>
        <delete dir='bin'/>
    </target>
</project>

Other related posts: