Skip to content

Test program that makes many connects to a vip address

License

Notifications You must be signed in to change notification settings

Nordix/mconnect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mconnect

Test programs that makes many connects to a vip (Virtual IP Address) address.

The purpose is fast test of connectivity and load-balancing. mconnect in server mode is started on all targets and then mconnect in client mode is used to do multiple connects towards the vip address.

Local test (without a vip address);

> mconnect -server -address [::1]:5001 &
> time mconnect -address [::1]:5001 -nconn 1000
Failed connects; 0
Failed reads; 0
your-hostname 1000
real    0m0.049s
user    0m0.070s
sys     0m0.143s

Even though mconnect is pretty fast it is not a performance measurement tool since some bottlenecks are likely in mconnect itself.

Kubernetes

An image for use in Kubernetes is uploaded to registry.nordix.org/cloud-native/mconnect. You can install it with the provided manifest. The service address (ClusterIP) can then be used to access the server;

# kubectl apply -f https://github.com/Nordix/mconnect/raw/master/mconnect.yaml
service/mconnect created
deployment.apps/mconnect-deployment created
# time mconnect -address mconnect.default.svc.cluster.local:5001 -nconn 1000
Failed connects; 0
Failed reads; 0
mconnect-deployment-5897ffb75c-dbgt5 250
mconnect-deployment-5897ffb75c-25cgp 250
mconnect-deployment-5897ffb75c-hl5cp 250
mconnect-deployment-5897ffb75c-gjt5m 250
real    0m 0.16s
user    0m 0.03s
sys     0m 0.13s
#

The example shows the perfect balancing for proxy-mode=ipvs. The name of the service may be different on your cluster.

Output can be in json. The output is not formatted so for a readable printout pipe through jq;

> mconnect -address 10.0.0.2:5001 -nconn 6000 -output json | jq .
{
  "hosts": {
    "mconnect-deployment-69b454c755-8mkhk": 1500,
    "mconnect-deployment-69b454c755-rsdm8": 1499,
    "mconnect-deployment-69b454c755-w95k5": 1501,
    "mconnect-deployment-69b454c755-w9w6h": 1500
  },
  "connects": 6000,
  "failed_connects": 0,
  "failed_reads": 0,
  "start_time": "2018-10-25T14:53:34.652534263+02:00",
  "timeout": 8000000000,
  "duration": 642530530
}

Build

./build.sh image
# Manual;
go get -u github.com/Nordix/mconnect
cd $GOPATH/src/github.com/Nordix/mconnect
CGO_ENABLED=0 GO111MODULE=on GOOS=linux go build -a \
  -ldflags "-extldflags '-static' -X main.version=$(date +%F:%T)" \
  -o ./image/mconnect ./cmd/...
strip ./image/mconnect

Many source addresses

Some tests requires that traffic comes from many source addresses. It is allowed to assign entire subnets to the loopback interface and we use it for this purpose;

ip addr add 222.222.222.0/24 dev lo
ip -6 addr add 5000::/112 dev lo
ip -6 ro add local 5000::/112 dev lo

But we must also be able to use these address for traffic on other interfaces;

sudo sysctl -w net.ipv4.ip_nonlocal_bind=1
sudo sysctl -w net.ipv6.ip_nonlocal_bind=1

Now we can let mconnect (and other programs that allows the source to be specified) to use any address from the ranges assigned to the loopback interface;

mconnect -address 10.0.0.2:5001 -nconn 1000 -srccidr 222.222.222.0/24
mconnect -address [1000::2]:5001 -nconn 1000 -srccidr 5000::/112