improved siege like load tester
This commit is contained in:
parent
97c711613f
commit
89d0cb765f
|
@ -22,6 +22,7 @@ public class Siege
|
||||||
private final CountDownLatch _latch;
|
private final CountDownLatch _latch;
|
||||||
volatile int _status;
|
volatile int _status;
|
||||||
volatile int _count;
|
volatile int _count;
|
||||||
|
volatile long _bytes;
|
||||||
final List<String> _uris;
|
final List<String> _uris;
|
||||||
final int _repeats;
|
final int _repeats;
|
||||||
int _u;
|
int _u;
|
||||||
|
@ -70,9 +71,18 @@ public class Siege
|
||||||
{
|
{
|
||||||
_latch.countDown();
|
_latch.countDown();
|
||||||
long duration=System.currentTimeMillis()-_start;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -102,6 +102,7 @@ public class BlockingHttpConnection extends AbstractHttpConnection
|
||||||
// Reset the parser/generator
|
// Reset the parser/generator
|
||||||
progress=true;
|
progress=true;
|
||||||
reset();
|
reset();
|
||||||
|
_endp.flush();
|
||||||
|
|
||||||
// look for a switched connection instance?
|
// look for a switched connection instance?
|
||||||
if (_response.getStatus()==HttpStatus.SWITCHING_PROTOCOLS_101)
|
if (_response.getStatus()==HttpStatus.SWITCHING_PROTOCOLS_101)
|
||||||
|
@ -114,7 +115,7 @@ public class BlockingHttpConnection extends AbstractHttpConnection
|
||||||
// TODO Is this required?
|
// TODO Is this required?
|
||||||
if (!_generator.isPersistent() && !_endp.isOutputShutdown())
|
if (!_generator.isPersistent() && !_endp.isOutputShutdown())
|
||||||
{
|
{
|
||||||
System.err.println("Safety net oshut!!!");
|
LOG.warn("Safety net oshut!!! Please open a bugzilla");
|
||||||
_endp.shutdownOutput();
|
_endp.shutdownOutput();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue