improved siege like load tester

This commit is contained in:
Greg Wilkins 2011-11-17 14:45:41 +11:00
parent 97c711613f
commit 89d0cb765f
2 changed files with 13 additions and 2 deletions

View File

@ -22,6 +22,7 @@ public class Siege
private final CountDownLatch _latch;
volatile int _status;
volatile int _count;
volatile long _bytes;
final List<String> _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);
}
/* ------------------------------------------------------------ */
/**

View File

@ -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();
}
}