aboutsummaryrefslogtreecommitdiffstats
path: root/jrt/src/com/yahoo/jrt/Supervisor.java
diff options
context:
space:
mode:
Diffstat (limited to 'jrt/src/com/yahoo/jrt/Supervisor.java')
-rw-r--r--jrt/src/com/yahoo/jrt/Supervisor.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/jrt/src/com/yahoo/jrt/Supervisor.java b/jrt/src/com/yahoo/jrt/Supervisor.java
index d4168e97743..ed94adcadd1 100644
--- a/jrt/src/com/yahoo/jrt/Supervisor.java
+++ b/jrt/src/com/yahoo/jrt/Supervisor.java
@@ -15,6 +15,8 @@ import java.util.concurrent.atomic.AtomicReference;
**/
public class Supervisor {
+ private static final int SMALL_INPUT_BUFFER_SIZE = 20 * 1024; // Large enough too hold the typical application buffersize of 17k.
+ private static final int SMALL_OUTPUT_BUFFER_SIZE = 8 *1024; // Suitable small buffer usage with many connections and little traffic.
private final Transport transport;
private SessionHandler sessionHandler = null;
private final Object methodMapLock = new Object();
@@ -34,6 +36,16 @@ public class Supervisor {
}
/**
+ * Will optimize buffers size for small memory footprint
+ * Use this when you have many connections with very little traffic.
+ **/
+ public Supervisor enableSmallBuffers() {
+ setMaxInputBufferSize(SMALL_INPUT_BUFFER_SIZE);
+ setMaxOutputBufferSize(SMALL_OUTPUT_BUFFER_SIZE);
+ return this;
+ }
+
+ /**
* Set maximum input buffer size. This value will only affect
* connections that use a common input buffer when decoding
* incoming packets. Note that this value is not an absolute