* netlink multi-thread / libmnl / nfq
@ 2015-06-02 21:17 Ryan Johnston
2015-06-02 21:22 ` Florian Westphal
0 siblings, 1 reply; 5+ messages in thread
From: Ryan Johnston @ 2015-06-02 21:17 UTC (permalink / raw)
To: netfilter-devel
Hi,
When creating a multi-threaded NFQ/Netlink application, should I have
multiple threads with fd sockets connected to the kernel, or do I have
one socket with multiple thread loops to read the socket?
If I am to have many threaded fd sockets connected to kernel's
netlink, is there any performance loss by having too many?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: netlink multi-thread / libmnl / nfq
2015-06-02 21:17 netlink multi-thread / libmnl / nfq Ryan Johnston
@ 2015-06-02 21:22 ` Florian Westphal
2015-06-02 21:55 ` Ryan Johnston
0 siblings, 1 reply; 5+ messages in thread
From: Florian Westphal @ 2015-06-02 21:22 UTC (permalink / raw)
To: Ryan Johnston; +Cc: netfilter-devel
Ryan Johnston <ryan@mediapixel.co.nz> wrote:
> When creating a multi-threaded NFQ/Netlink application, should I have
> multiple threads with fd sockets connected to the kernel, or do I have
> one socket with multiple thread loops to read the socket?
Its up to you.
> If I am to have many threaded fd sockets connected to kernel's
> netlink, is there any performance loss by having too many?
For best performance use multiple queues, e.g. manually via iptables
-m cpu ... -j NFQUEUE, or via iptables .. NFQUEUE --queue-balance 0:x,
then run one process or thread for each queue.
One thread per queue model is implemented in suricata ids for example.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: netlink multi-thread / libmnl / nfq
2015-06-02 21:22 ` Florian Westphal
@ 2015-06-02 21:55 ` Ryan Johnston
2015-06-02 22:23 ` Florian Westphal
0 siblings, 1 reply; 5+ messages in thread
From: Ryan Johnston @ 2015-06-02 21:55 UTC (permalink / raw)
To: Florian Westphal; +Cc: netfilter-devel
Yes with --queue-balance do I open a socket via nfq_open() per thread
or do I just have the one nfq_open() and have each thread call
nfq_create_queue only?
On Wed, Jun 3, 2015 at 9:22 AM, Florian Westphal <fw@strlen.de> wrote:
> Ryan Johnston <ryan@mediapixel.co.nz> wrote:
>> When creating a multi-threaded NFQ/Netlink application, should I have
>> multiple threads with fd sockets connected to the kernel, or do I have
>> one socket with multiple thread loops to read the socket?
>
> Its up to you.
>
>> If I am to have many threaded fd sockets connected to kernel's
>> netlink, is there any performance loss by having too many?
>
> For best performance use multiple queues, e.g. manually via iptables
> -m cpu ... -j NFQUEUE, or via iptables .. NFQUEUE --queue-balance 0:x,
> then run one process or thread for each queue.
>
> One thread per queue model is implemented in suricata ids for example.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: netlink multi-thread / libmnl / nfq
2015-06-02 21:55 ` Ryan Johnston
@ 2015-06-02 22:23 ` Florian Westphal
2015-06-02 22:25 ` Ryan Johnston
0 siblings, 1 reply; 5+ messages in thread
From: Florian Westphal @ 2015-06-02 22:23 UTC (permalink / raw)
To: Ryan Johnston; +Cc: Florian Westphal, netfilter-devel
Ryan Johnston <ryan@mediapixel.co.nz> wrote:
> Yes with --queue-balance do I open a socket via nfq_open() per thread
> or do I just have the one nfq_open() and have each thread call
> nfq_create_queue only?
Apparently both is possible (I had to look it up :-/)
but i'd suggest to have one fd per queue, i.e. nfq_open() per thread.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: netlink multi-thread / libmnl / nfq
2015-06-02 22:23 ` Florian Westphal
@ 2015-06-02 22:25 ` Ryan Johnston
0 siblings, 0 replies; 5+ messages in thread
From: Ryan Johnston @ 2015-06-02 22:25 UTC (permalink / raw)
To: Florian Westphal; +Cc: netfilter-devel
Okay, is there any performance loss by havin more sockets connected to
the kernel? Or does --queue-balance just rotate each packet to each
socket/thread?
On Wed, Jun 3, 2015 at 10:23 AM, Florian Westphal <fw@strlen.de> wrote:
> Ryan Johnston <ryan@mediapixel.co.nz> wrote:
>> Yes with --queue-balance do I open a socket via nfq_open() per thread
>> or do I just have the one nfq_open() and have each thread call
>> nfq_create_queue only?
>
> Apparently both is possible (I had to look it up :-/)
> but i'd suggest to have one fd per queue, i.e. nfq_open() per thread.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-06-02 22:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-02 21:17 netlink multi-thread / libmnl / nfq Ryan Johnston
2015-06-02 21:22 ` Florian Westphal
2015-06-02 21:55 ` Ryan Johnston
2015-06-02 22:23 ` Florian Westphal
2015-06-02 22:25 ` Ryan Johnston
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.