Coder Social home page Coder Social logo

Comments (15)

whl739 avatar whl739 commented on May 28, 2024

lcore_mask in config.ini means hexadecimal bitmask of cores to run on, it can be configured to multi cores, the default 3 means we will start two processes on cpu0 and cpu1. But if you have only one core, it will start one process.

If you start f-stack without start.sh, you should do it like this:
1 process:
sudo ./demo ./config.ini -c 0x1 --proc-type=primary --num-procs=1 --proc-id=0
2 processes:

sudo ./demo ./config.ini -c 0x1 --proc-type=primary --num-procs=2 --proc-id=0
sudo ./demo ./config.ini -c 0x2 --proc-type=secondary--num-procs=2 --proc-id=1

from f-stack.

whl739 avatar whl739 commented on May 28, 2024

We don't support 1 process on multiple cores with multiple threads for now.
In order to run FreeBSD TCP/IP stack in parallel without lock, we just run one process with one thread on each core.

from f-stack.

taoswords avatar taoswords commented on May 28, 2024

Yelp. 2 processes will be OK if I start the 1st process as primary and the 2nd process as secondary.

My case is to run multiple workers to deal with the tcp sessions on 1 NIC port with 1 IP. The original idea is to run multiple threads to deal with different sessions based on different tcp ports. The beneifit is that the different tcp session will involve different time-consumption phases, and it is not suitable to put all in the single f-stack network stack.

If f-stack do not support 1 process on multiple cores with multiple threads so far, is it possible for me to use f-stack to satisfy my case?How could the primary process to share incoming network packets with the secondary process?

-- Where should I initialize the IP? On the primary process? Or both on the primary and secondary?
-- How could I make the different tcp streams to different process even if the IP initialization is resolved?

from f-stack.

whl739 avatar whl739 commented on May 28, 2024

If f-stack do not support 1 process on multiple cores with multiple threads so far, is it possible for me to use f-stack to satisfy my case?How could the primary process to share incoming network packets with the secondary process?

F-Stack can not fully adapt your case, you must make some changes.In lib/ff_dpdk_if.c:process_packets:

enum FilterReturn filter = protocol_filter(data, len);

this code will check the incoming packets, if they are ARP packets or KNI packets, will be transmitted to other processes using rte_ring.You can refer to this, peek the packet, determine that whether this packet is needed for this process, if not, transmit to other process.

-- Where should I initialize the IP? On the primary process? Or both on the primary and secondary?

Both on the primary and secondary.

-- How could I make the different tcp streams to different process even if the IP initialization is resolved?

Refer to the ARP processing.

By the way, we'll add some hook functions for custom packet handling, for example, bypass, forward, copy,etc..

from f-stack.

taoswords avatar taoswords commented on May 28, 2024

Thanks. I will look inside and try to filter the packets.

from f-stack.

taoswords avatar taoswords commented on May 28, 2024

one more question:

Given the config.ini is configured with 1 port with 1 IP. I run 2 processes with 1st as primary and 2nd as secondary based on current f-stack.
I wonder which process will receive the packets. Will the primary process receives all the packets? Or the traffic is randomly received among these 2 processes? Since these 2 processes all share the same config.ini and will see the same configuration on the same port, the primary process and secondary process will randomly pick up the packets?

from f-stack.

whl739 avatar whl739 commented on May 28, 2024

According to the result of RSS hash, packets will be received to different processes.
Currently the primary and secondary processess will receive packets from all nics.

from f-stack.

gpstrive avatar gpstrive commented on May 28, 2024

@oceanspark
actually, you can achieved the purpose by run 2 process (or many), and each process has its own rx ring.

from f-stack.

jlijian3 avatar jlijian3 commented on May 28, 2024

Is it support nginx proxy on multiple processes? How to make the packets from backend server received by the process correctly?
For example,nginx process0 send syn to the backend server,the syn-ack will received by process0 but not process1.

from f-stack.

taoswords avatar taoswords commented on May 28, 2024

@gpstrive Yeah, different rx ring can do if the transactions are stateless. I want to control all the streams/datagrams for every transaction. Just as @whl739 said, we need to do some custom packet handling. I am trying to add some hook points for purpose. Certainly, if f-stack supports hooks, maybe it is easier ^-^

from f-stack.

taoswords avatar taoswords commented on May 28, 2024

@jlijian3 I do not quite understand your mentioned proxy-pass. Maybe it is like the flow director. I just know f-stack uses RSS hash to distribute the flows to different process, and it is up to the users to take actions on the received packets, like dropping, dealing with some extra procedures, or just forwarding, and so on.

from f-stack.

jlijian3 avatar jlijian3 commented on May 28, 2024

Sorry,I mean nginx proxy.

from f-stack.

whl739 avatar whl739 commented on May 28, 2024

Proxy is supported by nginx-fstack.
When F-Stack connects to a server, we will choose a port(use toeplitz_hash to calculate the rss result) that packets will be received on the same process.

from f-stack.

gpstrive avatar gpstrive commented on May 28, 2024

@oceanspark
My case is to run multiple workers to deal with the tcp sessions on 1 NIC port with 1 IP. The original idea is to run multiple threads to deal with different sessions based on different tcp ports.

If you start 2 processes, different tcp sessions distribute to different process and the same session always go to the same process, does it satisfy your case ?

from f-stack.

taoswords avatar taoswords commented on May 28, 2024

@gpstrive I think your approach to start 2 processes to handle tcp sessions is ok in your case. However, my case is different and is required to handle mixed udp and tcp packets, and some time-consuming work to do. So I consider to hook and re-distribute the packets to different processes even if I benefit the high capability of F-stack to receive packets.

from f-stack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.