diff options
author | Joseph Henry <joseph.henry@gmail.com> | 2015-11-03 18:10:39 -0800 |
---|---|---|
committer | Joseph Henry <joseph.henry@gmail.com> | 2015-11-03 18:10:39 -0800 |
commit | 4b079872102da8ba482cf0868294d761729b24fe (patch) | |
tree | 24aca32494121b8776dad578749a8d2ea97108fb | |
parent | df391c84133e1af2945d1a484fe64420cc668fa2 (diff) | |
download | infinitytier-4b079872102da8ba482cf0868294d761729b24fe.tar.gz infinitytier-4b079872102da8ba482cf0868294d761729b24fe.zip |
Added throughput-test Docker files
-rwxr-xr-x | docker-test/lib/liblwip.so | bin | 195864 -> 0 bytes | |||
-rw-r--r-- | docker-test/throughput-test/Dockerfile | 37 | ||||
-rwxr-xr-x | docker-test/throughput-test/build.sh | 15 | ||||
-rw-r--r-- | docker-test/throughput-test/entrypoint.sh | 14 | ||||
-rw-r--r-- | docker-test/throughput-test/generate_file.sh | 1 | ||||
-rwxr-xr-x | docker-test/throughput-test/intercept | 54 | ||||
-rwxr-xr-x | ext/bin/lwip/liblwip.so | bin | 342016 -> 342016 bytes | |||
-rwxr-xr-x | ext/bin/lwip/liblwip.so.bak | bin | 342016 -> 0 bytes | |||
-rwxr-xr-x | ext/bin/lwip/liblwip.so.debug | bin | 220320 -> 0 bytes | |||
-rwxr-xr-x | ext/bin/lwip/liblwip.so.no-opt | bin | 214600 -> 0 bytes | |||
-rw-r--r-- | ext/lwipopts.h | 30 | ||||
-rw-r--r-- | netcon/NetconEthernetTap.cpp | 12 | ||||
-rwxr-xr-x | netcon/liblwip.so | bin | 342016 -> 0 bytes |
13 files changed, 152 insertions, 11 deletions
diff --git a/docker-test/lib/liblwip.so b/docker-test/lib/liblwip.so Binary files differdeleted file mode 100755 index 9c129959..00000000 --- a/docker-test/lib/liblwip.so +++ /dev/null diff --git a/docker-test/throughput-test/Dockerfile b/docker-test/throughput-test/Dockerfile new file mode 100644 index 00000000..b98def3e --- /dev/null +++ b/docker-test/throughput-test/Dockerfile @@ -0,0 +1,37 @@ +# ZT Netcon Throughput test +FROM fedora:22 +MAINTAINER https://www.zerotier.com/ + +# Install Apache +RUN yum -y update && yum clean all +RUN yum -y install httpd && yum clean all + +EXPOSE 9993/udp 9992/udp 9991/udp 9990/udp + +# Add ZT files +RUN mkdir -p /var/lib/zerotier-one/networks.d +RUN touch /var/lib/zerotier-one/networks.d/e5cd7a9e1c5311ab.conf +ADD zerotier-one / +ADD zerotier-cli / + +# Install sys-call intercept library +ADD intercept / +ADD libintercept.so.1.0 / +RUN cp libintercept.so.1.0 lib/libintercept.so.1.0 +RUN cp libintercept.so.1.0 /lib/libintercept.so.1.0 +RUN ln -sf /lib/libintercept.so.1.0 /lib/libintercept +RUN /usr/bin/install -c intercept /usr/bin + +# Install test-setup scripts +ADD generate_file.sh /generate_file.sh +RUN chmod -v +x /generate_file.sh +ADD entrypoint.sh /entrypoint.sh +RUN chmod -v +x /entrypoint.sh + +# Install LWIP library used by service +ADD liblwip.so / +RUN mkdir -p ext/bin/lwip +RUN cp liblwip.so ext/bin/lwip/liblwip.so + +# Start ZeroTier-One +CMD ["./entrypoint.sh"] diff --git a/docker-test/throughput-test/build.sh b/docker-test/throughput-test/build.sh new file mode 100755 index 00000000..290053d9 --- /dev/null +++ b/docker-test/throughput-test/build.sh @@ -0,0 +1,15 @@ +cd ../../ +make +cd netcon +make -f make-intercept.mk lib +rm *.o +rm liblwip.so +make -f make-liblwip.mk +cd ../docker-test/throughput-test + +cp ../../zerotier-one zerotier-one +cp ../../zerotier-cli zerotier-cli + +cp ../../netcon/liblwip.so liblwip.so +cp ../../netcon/libintercept.so.1.0 libintercept.so.1.0 + diff --git a/docker-test/throughput-test/entrypoint.sh b/docker-test/throughput-test/entrypoint.sh new file mode 100644 index 00000000..00fdd2be --- /dev/null +++ b/docker-test/throughput-test/entrypoint.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/ + +echo '***' +echo '*** ZeroTier Network Containers Test Image' +echo '*** https://www.zerotier.com/' +echo '***' + +./zerotier-one & +./zerotier-cli join e5cd7a9e1c5311ab +./zerotier-cli listnetworks + + diff --git a/docker-test/throughput-test/generate_file.sh b/docker-test/throughput-test/generate_file.sh new file mode 100644 index 00000000..fd84de32 --- /dev/null +++ b/docker-test/throughput-test/generate_file.sh @@ -0,0 +1 @@ +dd if=/dev/urandom of=/var/www/html/bigfile bs=100M count=1 diff --git a/docker-test/throughput-test/intercept b/docker-test/throughput-test/intercept new file mode 100755 index 00000000..3eb27ff7 --- /dev/null +++ b/docker-test/throughput-test/intercept @@ -0,0 +1,54 @@ +#!/bin/sh +# usage: +# /usr/bin/intercept program <args> + +if [ $# = 0 ] ; then + echo "$0: insufficient arguments" + exit +fi + +case "$1" in + on) + if [ -z "$LD_PRELOAD" ] + then + export LD_PRELOAD="/lib/libintercept.so.1.0" + else + echo $LD_PRELOAD | grep -q "/lib/libintercept\.so.1.0" || \ + export LD_PRELOAD="/lib/libintercept.so $LD_PRELOAD" + fi + ;; + off) + export LD_PRELOAD=`echo -n $LD_PRELOAD | sed 's/\/lib\/libintercept.so.1.0 \?//'` + if [ -z "$LD_PRELOAD" ] + then + unset LD_PRELOAD + fi + ;; + show|sh) + echo "LD_PRELOAD=\"$LD_PRELOAD\"" + ;; + -h|-?) + echo "" + ;; + *) + if [ -z "$LD_PRELOAD" ] + then + export LD_PRELOAD="/lib/libintercept.so.1.0" + else + echo $LD_PRELOAD | grep -q "/lib/libintercept\.so.1.0" || \ + export LD_PRELOAD="/lib/libintercept.so.1.0 $LD_PRELOAD" + fi + + if [ $# = 0 ] + then + ${SHELL:-/bin/sh} + fi + + if [ $# -gt 0 ] + then + exec "$@" + fi + ;; +esac + +#EOF diff --git a/ext/bin/lwip/liblwip.so b/ext/bin/lwip/liblwip.so Binary files differindex aba90d8e..722e40f6 100755 --- a/ext/bin/lwip/liblwip.so +++ b/ext/bin/lwip/liblwip.so diff --git a/ext/bin/lwip/liblwip.so.bak b/ext/bin/lwip/liblwip.so.bak Binary files differdeleted file mode 100755 index aba90d8e..00000000 --- a/ext/bin/lwip/liblwip.so.bak +++ /dev/null diff --git a/ext/bin/lwip/liblwip.so.debug b/ext/bin/lwip/liblwip.so.debug Binary files differdeleted file mode 100755 index 86c36665..00000000 --- a/ext/bin/lwip/liblwip.so.debug +++ /dev/null diff --git a/ext/bin/lwip/liblwip.so.no-opt b/ext/bin/lwip/liblwip.so.no-opt Binary files differdeleted file mode 100755 index 71859331..00000000 --- a/ext/bin/lwip/liblwip.so.no-opt +++ /dev/null diff --git a/ext/lwipopts.h b/ext/lwipopts.h index 6b95e9b5..4eb5e1ab 100644 --- a/ext/lwipopts.h +++ b/ext/lwipopts.h @@ -44,9 +44,21 @@ */ #include "lwip/debug.h" +#define TCP_MSS 1400 -//#define TCP_MSS 2048 -//#define TCP_WND 512 +/* +The TCP window size can be adjusted by changing the define TCP_WND. However, +do keep in mind that this should be at least twice the size of TCP_MSS (thus +on ethernet, where TCP_MSS is 1460, it should be set to at least 2920). If +memory allows it, set this as high as possible (16-bit, so 0xFFFF is the highest +value), but keep in mind that for every active connection, the full window may +have to be buffered until it is acknowledged by the remote side (although this +buffer size can still be controlled by TCP_SND_BUF and TCP_SND_QUEUELEN). The +reason for "twice" are both the nagle algorithm and delayed ACK from the +remote peer. +*/ + +#define TCP_WND TCP_MSS*10 // max = 0xffff #define LWIP_NOASSERT 1 #define TCP_LISTEN_BACKLOG 0 @@ -54,7 +66,14 @@ /*------------------------------------------------------------------------------ ---------------------------------- Timers -------------------------------------- ------------------------------------------------------------------------------*/ - +/* +Be careful about setting this too small. lwIP just counts the number +of times its timer is called and uses this to control time sensitive +operations (such as TCP retransmissions), rather than actually +measuring time using something more accurate. If you call the timer +functions very frequently you may see things (such as retransmissions) +happening sooner than they should. +*/ /* these are originally defined in tcp_impl.h */ #ifndef TCP_TMR_INTERVAL /* The TCP timer interval in milliseconds. */ @@ -116,8 +135,9 @@ */ #define MEM_SIZE 1024 * 1024 * 64 #define TCP_SND_BUF 1024 * 63 +//#define TCP_OVERSIZE TCP_MSS -#define TCP_SND_QUEUELEN 1024 +#define TCP_SND_QUEUELEN (2 * TCP_SND_BUF/TCP_MSS) /*------------------------------------------------------------------------------ -------------------------- Internal Memory Pool Sizes -------------------------- ------------------------------------------------------------------------------*/ @@ -209,7 +229,7 @@ /** * PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */ -#define PBUF_POOL_SIZE 128 /* was 32 */ +#define PBUF_POOL_SIZE 2048 /* was 32 */ /*------------------------------------------------------------------------------ diff --git a/netcon/NetconEthernetTap.cpp b/netcon/NetconEthernetTap.cpp index b6d7e2ce..a4e2eacd 100644 --- a/netcon/NetconEthernetTap.cpp +++ b/netcon/NetconEthernetTap.cpp @@ -50,8 +50,8 @@ #include "NetconUtilities.hpp" #define APPLICATION_POLL_FREQ 20 -#define ZT_LWIP_TCP_TIMER_INTERVAL 10 -#define STATUS_TMR_INTERVAL 1000 // How often we check connection statuses +#define ZT_LWIP_TCP_TIMER_INTERVAL 50 +#define STATUS_TMR_INTERVAL 2000 // How often we check connection statuses #define DEBUG_LEVEL 3 namespace ZeroTier { @@ -416,7 +416,7 @@ void NetconEthernetTap::threadMain() uint64_t prev_status_time = 0; uint64_t prev_etharp_time = 0; -/* + fprintf(stderr, "- MEM_SIZE = %dM\n", MEM_SIZE / (1024*1024)); fprintf(stderr, "- TCP_SND_BUF = %dK\n", TCP_SND_BUF / 1024); fprintf(stderr, "- MEMP_NUM_PBUF = %d\n", MEMP_NUM_PBUF); @@ -432,7 +432,7 @@ void NetconEthernetTap::threadMain() fprintf(stderr, "- ARP_TMR_INTERVAL = %d\n", ARP_TMR_INTERVAL); fprintf(stderr, "- TCP_TMR_INTERVAL = %d\n", TCP_TMR_INTERVAL); fprintf(stderr, "- IP_TMR_INTERVAL = %d\n", IP_TMR_INTERVAL); -*/ + // Main timer loop while (_run) { @@ -928,7 +928,7 @@ err_t NetconEthernetTap::nc_sent(void* arg, struct tcp_pcb *tpcb, u16_t len) Larg *l = (Larg*)arg; if(len) { l->conn->acked+=len; - dwr("W = %d, A = %d\n", l->conn->written, l->conn->acked); + //dwr("W = %d, A = %d\n", l->conn->written, l->conn->acked); l->tap->_phy.setNotifyReadable(l->conn->dataSock, true); l->tap->_phy.whack(); } @@ -1397,7 +1397,7 @@ void NetconEthernetTap::handle_write(TcpConnection *conn) memmove(&conn->buf, (conn->buf+r), sz); } conn->idx -= r; - conn->written+=err; + conn->written+=r; return; } } diff --git a/netcon/liblwip.so b/netcon/liblwip.so Binary files differdeleted file mode 100755 index aba90d8e..00000000 --- a/netcon/liblwip.so +++ /dev/null |