From 89d0cb765ffda68f16efe8c2b458cf0e87649d53 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 17 Nov 2011 14:45:41 +1100 Subject: [PATCH] improved siege like load tester --- .../test/java/org/eclipse/jetty/client/Siege.java | 12 +++++++++++- .../eclipse/jetty/server/BlockingHttpConnection.java | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/Siege.java b/jetty-client/src/test/java/org/eclipse/jetty/client/Siege.java index d8fa2f9585c..62d4347b346 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/Siege.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/Siege.java @@ -22,6 +22,7 @@ public class Siege private final CountDownLatch _latch; volatile int _status; volatile int _count; + volatile long _bytes; final List _uris; final int _repeats; int _u; @@ -70,9 +71,18 @@ public class Siege { _latch.countDown(); long duration=System.currentTimeMillis()-_start; - System.err.printf("Got %d/%d in %dms %d%n",_count,_uris.size()*_repeats,duration,_latch.getCount()); + System.err.printf("Got %d/%d with %dB in %dms %d%n",_count,_uris.size()*_repeats,_bytes,duration,_latch.getCount()); } } + + + /* ------------------------------------------------------------ */ + @Override + protected void onResponseContent(Buffer content) throws IOException + { + _bytes+=content.length(); + super.onResponseContent(content); + } /* ------------------------------------------------------------ */ /** diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/BlockingHttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/BlockingHttpConnection.java index eb8f4a6dc63..20797d9a62c 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/BlockingHttpConnection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/BlockingHttpConnection.java @@ -102,6 +102,7 @@ public class BlockingHttpConnection extends AbstractHttpConnection // Reset the parser/generator progress=true; reset(); + _endp.flush(); // look for a switched connection instance? if (_response.getStatus()==HttpStatus.SWITCHING_PROTOCOLS_101) @@ -114,7 +115,7 @@ public class BlockingHttpConnection extends AbstractHttpConnection // TODO Is this required? if (!_generator.isPersistent() && !_endp.isOutputShutdown()) { - System.err.println("Safety net oshut!!!"); + LOG.warn("Safety net oshut!!! Please open a bugzilla"); _endp.shutdownOutput(); } }