Skip to content

Instantly share code, notes, and snippets.

@nickwallen
Last active May 11, 2017 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickwallen/47d1495b2dd262b1c248530d78709d57 to your computer and use it in GitHub Desktop.
Save nickwallen/47d1495b2dd262b1c248530d78709d57 to your computer and use it in GitHub Desktop.

Create the topic.

TOPIC=pcap256-1hour
kafka-topics.sh --create --topic $TOPIC --partitions 256 --replication-factor 1 --zookeeper $ZOOKEEPER

Grant access.

kafka-acls.sh \
  --authorizer kafka.security.auth.SimpleAclAuthorizer \
  -authorizer-properties zookeeper.connect=$ZOOKEEPER \
  --add \
  --allow-principal User:fastcapa \
  --group fastcapa \
  --topic $TOPIC

kafka-acls.sh \
  --authorizer kafka.security.auth.SimpleAclAuthorizer \
  -authorizer-properties zookeeper.connect=$ZOOKEEPER \
  --add \
  --allow-principal User:metron \
  --group metron \
  --topic $TOPIC

Start Fastcapa

umount /mnt/huge_1GB
mount -fav

dpdk-devbind --unbind "81:00.1"
rmmod igb_uio

insmod /usr/local/dpdk/lib/modules/3.10.0-514.10.2.el7.x86_64/extra/dpdk/igb_uio.ko
dpdk-devbind --bind=igb_uio "81:00.1"

TOPIC=pcap256-1hour
fastcapa -l 8-15,24 \
  --huge-dir /mnt/huge_1GB \
  -- \
  -t $TOPIC \
  -c /etc/fastcapa.ycluster \
  -b 128 \
  -x 262144 \
  -q 4 \
  -s fastcapa-kafka.log
[root@y138 ~]# fastcapa -l 8-15,24 \
>   --huge-dir /mnt/huge_1GB \
>   -- \
>   -t $TOPIC \
>   -c /etc/fastcapa.ycluster \
>   -b 128 \
>   -x 262144 \
>   -q 4 \
>   -s fastcapa-kafka.log
EAL: Detected 32 lcore(s)
EAL: Probing VFIO support...
EAL: PCI device 0000:01:00.0 on NUMA socket 0
EAL:   probe driver: 8086:1521 net_e1000_igb
EAL: PCI device 0000:01:00.1 on NUMA socket 0
EAL:   probe driver: 8086:1521 net_e1000_igb
EAL: PCI device 0000:09:00.0 on NUMA socket 0
EAL:   probe driver: 1137:43 net_enic
EAL: PCI device 0000:0a:00.0 on NUMA socket 0
EAL:   probe driver: 1137:43 net_enic
EAL: PCI device 0000:81:00.0 on NUMA socket 1
EAL:   probe driver: 8086:10fb net_ixgbe
EAL: PCI device 0000:81:00.1 on NUMA socket 1
EAL:   probe driver: 8086:10fb net_ixgbe
[ -t KAFKA_TOPIC ] defined as pcap256-1hour
[ -c KAFKA_CONFIG ] defined as /etc/fastcapa.ycluster
[ -b BURST_SIZE ] defined as 128
[ -x TX_RING_SIZE ] defined as 262144
[ -q NB_RX_QUEUE ] defined as 4
[ -s KAFKA_STATS ] defined as fastcapa-kafka.log
[ -p PORT_MASK ] undefined; defaulting to 0x01
[ -r NB_RX_DESC ] undefined; defaulting to 1024
USER1: Initializing port 0
USER1: Device setup successfully; port=0, mac=90 e2 ba d9 3c f9
USER1: Appending Kafka client stats to 'fastcapa-kafka.log'
USER1: Launching receive worker; worker=0, core=9, queue=0
USER1: Receive worker started; core=9, socket=1, queue=0 attempts=0
USER1: Launching receive worker; worker=1, core=10, queue=1
USER1: Receive worker started; core=10, socket=1, queue=1 attempts=0
USER1: Launching receive worker; worker=2, core=11, queue=2
USER1: Launching receive worker; worker=3, core=12, queue=3
USER1: Receive worker started; core=11, socket=1, queue=2 attempts=0
USER1: Launching transmit worker; worker=0, core=13 ring=0
USER1: Receive worker started; core=12, socket=1, queue=3 attempts=0
USER1: Transmit worker started; core=13, socket=1
USER1: Launching transmit worker; worker=1, core=14 ring=1
USER1: Transmit worker started; core=14, socket=1
USER1: Launching transmit worker; worker=2, core=15 ring=2
USER1: Transmit worker started; core=15, socket=1
USER1: Launching transmit worker; worker=3, core=24 ring=3
USER1: Transmit worker started; core=24, socket=1
USER1: Starting to monitor workers; core=8, socket=1


      ----- in -----  --- queued --- ----- out ----- ---- drops ----
[nic]               0               -               -               -
[rx]                0               -               0               0
[tx]                0               -               0               0
[kaf]               0               0               0               0

Check the Kafka offsets.

TOPIC=pcap256-1hour
kafka-run-class.sh kafka.tools.GetOffsetShell \
  --broker-list $BROKERLIST \
  --topic $TOPIC \
  --security-protocol PLAINTEXTSASL \
  --time -1 | grep pcap | awk -F: '{p+=$3} END {print p}'

Start tcpreplay

[root@y137 ~]# time tcpreplay -i enp129s0f1 --loop=0 --stats=15 --preload-pcap --mbps 1100 example.pcap
File Cache is enabled
Actual: 3166583 packets (2062501418 bytes) sent in 15.00 seconds.
Rated: 137500000.0 Bps, 1100.00 Mbps, 211105.39 pps

Wait for 1 hour.

Stop tcpreplay.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment