diff options
author | Benoit Foucher <benoit@zeroc.com> | 2007-05-23 12:51:51 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2007-05-23 12:51:51 +0000 |
commit | c1323acecce7e15c58a0842da68f9cfc357355b2 (patch) | |
tree | e3ccf8b3fcf50997a65b385b03b37e07ba011752 /java/ssl/jdk1.5/IceSSL/TransceiverI.java | |
parent | Added Ice.TCP.SndSize/Ice.TCP.RcvSize properties, fixed throughput issue on (diff) | |
download | ice-c1323acecce7e15c58a0842da68f9cfc357355b2.tar.bz2 ice-c1323acecce7e15c58a0842da68f9cfc357355b2.tar.xz ice-c1323acecce7e15c58a0842da68f9cfc357355b2.zip |
Added Ice.TCP.SndSize/Ice.TCP.RcvSize properties, fixed throughput
performance issue on Win32.
Diffstat (limited to 'java/ssl/jdk1.5/IceSSL/TransceiverI.java')
-rw-r--r-- | java/ssl/jdk1.5/IceSSL/TransceiverI.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/java/ssl/jdk1.5/IceSSL/TransceiverI.java b/java/ssl/jdk1.5/IceSSL/TransceiverI.java index 1cec3f88ec2..b43a340c703 100644 --- a/java/ssl/jdk1.5/IceSSL/TransceiverI.java +++ b/java/ssl/jdk1.5/IceSSL/TransceiverI.java @@ -394,6 +394,21 @@ final class TransceiverI implements IceInternal.Transceiver // Ignore. } _desc = IceInternal.Network.fdToString(_fd); + _maxPacketSize = 0; + if(System.getProperty("os.name").startsWith("Windows")) + { + // + // On Windows, limiting the buffer size is important to prevent + // poor throughput performances when transfering large amount of + // data. See Microsoft KB article KB823764. + // + _maxPacketSize = IceInternal.Network.getSendBufferSize(_fd) / 2; + if(_maxPacketSize < 512) + { + _maxPacketSize = 0; + } + } + // TODO: Buffer cache? _appInput = ByteBuffer.allocateDirect(engine.getSession().getApplicationBufferSize() * 2); _netInput = ByteBuffer.allocateDirect(engine.getSession().getPacketBufferSize() * 2); @@ -414,6 +429,15 @@ final class TransceiverI implements IceInternal.Transceiver flush(int timeout) { _netOutput.flip(); + + int size = _netOutput.limit(); + int packetSize = 0; + if(_maxPacketSize > 0 && size > _maxPacketSize) + { + packetSize = _maxPacketSize; + _netOutput.limit(_netOutput.position() + packetSize); + } + while(_netOutput.hasRemaining()) { try @@ -480,6 +504,21 @@ final class TransceiverI implements IceInternal.Transceiver se.initCause(ex); throw se; } + + if(packetSize > 0) + { + assert(_netOutput.position() == _netOutput.limit()); + int position = _netOutput.position(); + if(size - position > packetSize) + { + _netOutput.limit(position + packetSize); + } + else + { + packetSize = 0; + _netOutput.limit(size); + } + } } _netOutput.clear(); } @@ -803,6 +842,7 @@ final class TransceiverI implements IceInternal.Transceiver private Ice.Logger _logger; private Ice.Stats _stats; private String _desc; + private int _maxPacketSize; private ByteBuffer _appInput; // Holds clear-text data to be read by the application. private ByteBuffer _netInput; // Holds encrypted data read from the socket. private ByteBuffer _netOutput; // Holds encrypted data to be written to the socket. |