From 59623e0aa841f4d7a94d8d671e27183df8205922 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sat, 12 Nov 2016 18:25:45 +0100 Subject: [PATCH] CONTRIB: tcploop: support sending plain strings By passing "S:" instead of S it's possible to send a pre-defined string, which is convenient to write HTTP requests or responses. Example : produce two responses, one in keep-alive, one not for ab : ./tcploop 8001 L W N2 A R S:"HTTP/1.0 200 OK\r\nConnection: keep-alive\r\nContent-length: 50\r\n\r\n0123456789.123456789.123456789.123456789.123456789" R S:"HTTP/1.0 200 OK\r\nContent-length: 50\r\n\r\n0123456789.123456789.123456789.123456789.123456789" With 20 such keep-alive responses and 10 parallel processes, ab achieves 350kreq/s, so it should be possible to get precise timings. --- contrib/tcploop/tcploop.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/contrib/tcploop/tcploop.c b/contrib/tcploop/tcploop.c index 5dfc3aee7..8b9a0a0a7 100644 --- a/contrib/tcploop/tcploop.c +++ b/contrib/tcploop/tcploop.c @@ -102,6 +102,7 @@ __attribute__((noreturn)) void usage(int code, const char *arg0) " Q : disable TCP Quick-ack\n" " R[] : Read this amount of bytes. 0=infinite. unset=any amount.\n" " S[] : Send this amount of bytes. 0=infinite. unset=any amount.\n" + " S: : Send this exact string. \\r, \\n, \\t, \\\\ supported.\n" " E[] : Echo this amount of bytes. 0=infinite. unset=any amount.\n" " W[