1# F-Stack Nginx APP Guide 2 3F-Stack is an open source network framework based on DPDK. F-Stack supports standard Nginx as HTTP framework which means all web application based on HTTP can easily use F-Stack. 4 5## How does Nginx use F-Stack? 6 7 Nginx APP is in `app/nginx-1.11.10` directory. 8 9``` 10 11 +--------+ 12 +------------------------+ | 13 channel: socketpair | 14 +------------------------+ | signal(reload, quit..) 15 | 16 | 17 +---------v--------+ 18 | | 19 +----------------+ master process +---------------+ 20 | | | | 21 | channel +----------+-------+ | 22 | | channel | 23 | channel | | 24 | | | 25 +---------+----------+ +----------+--------+ +---------+--------+ 26first one to start | | | | | | 27 last one to exit<-+ primary worker | | secondary worker | | secondary worker | 28 | | | | | | 29 +--------------------+ +-------------------+ +------------------+ 30 +--------------------+ +-------------------+ 31 | | | | 32 | fstack,kernel | | fstack,kernel | 33 | and channel | | and channel | 34 | loop thread | | loop thread | 35 | | | | 36 +--------------------+ +-------------------+ 37 woker process cycle woker process cycle 38 39``` 40 41- spawn primary worker firstly, and then wait for primary startup, continue to spawn secondary workers. 42 43- a major addition to the worker process is fstack-handling:ff_init();ff_run(worker_process_cycle); worker_process_cycle(handle channel/host/fstack event). 44 45Note that: 46 47- the `reload` is not graceful, service will still be unavailable during the process of reloading. 48 49- necessary modifies in nginx.conf: 50 51``` 52 user root; # root account is necessary. 53 fstack_conf f-stack.conf; # path of f-stack configuration file, default: $NGX_PREFIX/conf/f-stack.conf. 54 worker_processes 1; # should be equal to the lcore count of `dpdk.lcore_mask` in f-stack.conf. 55 56 events { 57 worker_connections 102400; # increase 58 use kqueue; # use kqueue 59 } 60 61 sendfile off; # sendfile off 62``` 63 64## Nginx compiling 65 ./configure --prefix=/usr/local/nginx_fstack --with-ff_module 66 make 67 make install 68 69