f-stack + nginx 编译配置

1. 编译 quick start

# clone F-Stack

mkdir /data/f-stack

git clone https://github.com/F-Stack/f-stack.git /data/f-stack

# install libnuma-dev

yum install numactl-devel          # on Centos

#sudo apt-get install libnuma-dev  # on Ubuntu

cd f-stack

# compile DPDK

cd dpdk/usertools

./dpdk-setup.sh # compile with x86_64-native-linuxapp-gcc

# Set hugepage

# single-node system

echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages

# or NUMA

echo 1024 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages

echo 1024 > /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages

# Using Hugepage with the DPDK

mkdir /mnt/huge

mount -t hugetlbfs nodev /mnt/huge

# close ASLR; it is necessary in multiple process

echo 0 > /proc/sys/kernel/randomize_va_space

# offload NIC

modprobe uio

insmod /data/f-stack/dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko

insmod /data/f-stack/dpdk/x86_64-native-linuxapp-gcc/kmod/rte_kni.ko

python dpdk-devbind.py --status

ifconfig eth0 down

python dpdk-devbind.py --bind=igb_uio eth0 # assuming that use 10GE NIC and eth0

# On Ubuntu, use gawk instead of the default mawk.

#sudo apt-get install gawk  # or execute `sudo update-alternatives --config awk` to choose gawk.

# Compile F-Stack

export FF_PATH=/data/f-stack

export FF_DPDK=/data/f-stack/dpdk/x86_64-native-linuxapp-gcc

cd ../../lib/

make

Nginx

cd app/nginx-1.11.10

bash ./configure --prefix=/usr/local/nginx_fstack --with-ff_module

make

make install

cd ../..

/usr/local/nginx_fstack/sbin/nginx

for more details, see nginx guide.

Redis

cd app/redis-3.2.8/

make

make install

2. f-stack + nginx 配置

cd f-stack/dpdk/usertools/

echo 8192 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages

echo 8192 > /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages

mkdir /mnt/huge

mount -t hugetlbfs nodev /mnt/huge

echo 0 > /proc/sys/kernel/randomize_va_space

modprobe uio

insmod /root/f-stack/dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko

insmod /root/f-stack/dpdk/x86_64-native-linuxapp-gcc/kmod/rte_kni.ko

cd usertools/

./dpdk-devbind.py --status

./dpdk-devbind.py --bind=igb_uio eth3

./dpdk-devbind.py --bind=igb_uio eth6

cd /usr/local/nginx_fstack/

./sbin/nginx

3. 查看报错信息

tail -f /usr/local/nginx_fstack/logs/error.log

4. f-stack nginx的配置文件

cat /usr/local/nginx_fstack/conf/f-stack.conf

[dpdk]

## Hexadecimal bitmask of cores to run on.

lcore_mask=fff000

## Port mask, enable and disable ports.

## Default: all ports are enabled.

#port_mask=1

channel=4

## Number of ports.

nb_ports=2

promiscuous=1

numa_on=1

## TCP segment offload, default: disabled.

tso=0

## HW vlan strip, default: enabled.

vlan_strip=1

port_list=0,1

## Port config section

## According to dpdk.nb_ports: port0, port1...

[port0]

addr=11.0.17.10

netmask=255.0.0.0

broadcast=11.255.255.255

gateway=11.0.0.254

[port1]

addr=11.0.17.11

netmask=255.0.0.0

broadcast=11.255.255.255

gateway=11.0.0.254

## Packet capture path, this will hurt performance

#pcap=./a.pcap

## Kni config: if enabled and method=reject,

## all packets that do not belong to the following tcp_port and udp_port

## will transmit to kernel; if method=accept, all packets that belong to

## the following tcp_port and udp_port will transmit to kernel.

[kni]

enable=0

method=reject

tcp_port=80,443

udp_port=53

## FreeBSD network performance tuning configurations.

## Most native FreeBSD configurations are supported.

[freebsd.boot]

hz=100

## Block out a range of descriptors to avoid overlap

## with the kernel's descriptor space.

## You can increase this value according to your app.

fd_reserve=102400

kern.ipc.maxsockets=262144

net.inet.tcp.syncache.hashsize=4096

net.inet.tcp.syncache.bucketlimit=100

net.inet.tcp.tcbhashsize=65536

[freebsd.sysctl]

kern.ipc.somaxconn=32768

kern.ipc.maxsockbuf=16777216

net.inet.tcp.fast_finwait2_recycle=1

net.inet.tcp.sendspace=16384

net.inet.tcp.recvspace=8192

net.inet.tcp.nolocaltimewait=1

net.inet.tcp.cc.algorithm=htcp

net.inet.tcp.sendbuf_max=16777216

net.inet.tcp.recvbuf_max=16777216

net.inet.tcp.sendbuf_auto=1

net.inet.tcp.recvbuf_auto=1

net.inet.tcp.sendbuf_inc=16384

net.inet.tcp.recvbuf_inc=524288

net.inet.tcp.inflight.enable=0

net.inet.tcp.sack=1

net.inet.tcp.blackhole=1

net.inet.tcp.msl=2000

net.inet.tcp.delayed_ack=0

net.inet.udp.blackhole=1

net.inet.ip.redirect=0

你可能感兴趣的:(f-stack + nginx 编译配置)