ctnetlink events drop benchmark
Pablo Neira Ayuso
maintainerHi,
Finally, I've got some results in my test enviroment about the ctnetlink event drop issue. The machine used as firewall is a PIII 866 256 Mbytes RAM, two NIC realtek 8139 100Mbits running debian unstable with linux kernel 2.6.16.
I have run the same test with three different socket queue sizes:
107.520 (default)
215.040 (x2)
430.080 (x4)
I used netperf to create the connections with a shell script that loops calling netperf -H ip -l 3 &.
To get the number of events dropped I've used the following:
$ conntrackd & (run as daemon) $ conntrackd -s (request statistics)
Results are available in:
http://people.netfilter.org/pablo/ctnetlink/events.eps
Currently nlmsg_seq is not set in ctnetlink events, if we set it, we can do some kind of sequence tracking on netlink. If an event gets lost, we can request a resync with the conntrack via dump_conntrack.
Another choice could be relax conntrackd states transitions, currently the valid transition sequence is: NEW -> UPDATE -> DESTROY, if an UPDATE event is received but no NEW was seen previously, then the event is ignored. Maybe this is too tight, but since I'm validating the whole thing I prefer remaining "tight" at the moment.
Comments welcome.
Signature · 1 line
The dawn of the fourth age of Linux firewalling is coming; a time of great struggle and heroic deeds -- J.Kadlecsik got inspired by J.Morris
Hi Pablo,
Quoted 5 lines · Pablo Neira Ayuso
Finally, I've got some results in my test enviroment about the ctnetlink event drop issue. The machine used as firewall is a PIII 866 256 Mbytes RAM, two NIC realtek 8139 100Mbits running debian unstable with linux kernel 2.6.16.
Quoted 7 lines
I have run the same test with three different socket queue sizes:
107.520 (default)
215.040 (x2)
430.080 (x4)I used netperf to create the connections with a shell script that loops calling netperf -H ip -l 3 &.
How can you control the connection rate (i.e NEW events) by netperf?
Quoted 8 lines
To get the number of events dropped I've used the following:
$ conntrackd & (run as daemon) $ conntrackd -s (request statistics)Results are available in:
The results are pretty shocking! One would expect (hope) higher event rate without event dropping :-(.
Quoted 3 lines
Currently
nlmsg_seqis not set in ctnetlink events, if we set it, we can do some kind of sequence tracking on netlink. If an event gets lost, we can request a resync with the conntrack viadump_conntrack.
Isn't that overkill? I mean, it'd result even more traffic and thus more packet loss.
Quoted 5 lines
Another choice could be relax conntrackd states transitions, currently the valid transition sequence is: NEW -> UPDATE -> DESTROY, if an UPDATE event is received but no NEW was seen previously, then the event is ignored. Maybe this is too tight, but since I'm validating the whole thing I prefer remaining "tight" at the moment.
As I see it does not improve the performance over netlink: the message is already received by conntrackd.
Can we generalize your results and state that (ct)netlink can handle (on the given hardvare) max 500-1000 messages/s?
Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics
H-1525 Budapest 114, POB. 49, Hungary
Quoted 2 lines · Jozsef Kadlecsik
Can we generalize your results and state that (ct)netlink can handle (on the given hardvare) max 500-1000 messages/s?
Oops, that's false: 500-1000 NEW messages/s. But what is the total number of messages/s?
Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics
H-1525 Budapest 114, POB. 49, Hungary
Pablo Neira Ayuso
maintainerQuoted 7 lines · Jozsef Kadlecsik
Quoted 2 lines · Jozsef Kadlecsik
Can we generalize your results and state that (ct)netlink can handle (on the given hardvare) max 500-1000 messages/s?
Oops, that's false: 500-1000 NEW messages/s. But what is the total number of messages/s?
Actually, my concern wasn't really to get the messages/s rate. I started the benchmark to know if ctnetlink can back off under big stress situation, in other words, if I could experiment messages loss. This is really important to validate conntrackd. And it could also be for other subsystems like nfqueue.
Signature · 1 line
The dawn of the fourth age of Linux firewalling is coming; a time of great struggle and heroic deeds -- J.Kadlecsik got inspired by J.Morris
Pablo Neira Ayuso
maintainerHi Jozsef,
Quoted 13 lines · Jozsef Kadlecsik
Quoted 10 lines · Pablo Neira Ayuso
Finally, I've got some results in my test enviroment about the ctnetlink event drop issue. The machine used as firewall is a PIII 866 256 Mbytes RAM, two NIC realtek 8139 100Mbits running debian unstable with linux kernel 2.6.16.
I have run the same test with three different socket queue sizes:
107.520 (default)
215.040 (x2)
430.080 (x4)
Quoted 5 lines
Quoted 2 lines
I used netperf to create the connections with a shell script that loops calling netperf -H ip -l 3 &.
How can you control the connection rate (i.e NEW events) by netperf?
I can't, but I can measure the time required to create N connections
Quoted 14 lines
Quoted 8 lines
To get the number of events dropped I've used the following:
$ conntrackd & (run as daemon) $ conntrackd -s (request statistics)Results are available in:
The results are pretty shocking! One would expect (hope) higher event rate without event dropping :-(.
Quoted 6 lines
Quoted 3 lines
Currently
nlmsg_seqis not set in ctnetlink events, if we set it, we can do some kind of sequence tracking on netlink. If an event gets lost, we can request a resync with the conntrack viadump_conntrack.Isn't that overkill? I mean, it'd result even more traffic and thus more packet loss.
AFAIK, dumping in done in data chunks of one memory page long. A data chunk isn't enqueued until the process calls recv(), therefore a new chunk is enqueued iff the process has processed the previous chunk. So, dumping really doesn't consumes too much space in the queue but you are right, if the dumping happens at the time that the queue is full, then the packet will get lost.
Quoted 11 lines
Quoted 5 lines
Another choice could be relax conntrackd states transitions, currently the valid transition sequence is: NEW -> UPDATE -> DESTROY, if an UPDATE event is received but no NEW was seen previously, then the event is ignored. Maybe this is too tight, but since I'm validating the whole thing I prefer remaining "tight" at the moment.
As I see it does not improve the performance over netlink: the message is already received by conntrackd.
Can we generalize your results and state that (ct)netlink can handle (on the given hardvare) max 500-1000 messages/s?
No, the graph doesn't talk about messages/s, just messages: after reading your comments, it seems that the graph can be misleading.
Please, have a look at these results in text format:
http://people.netfilter.org/pablo/ctnetlink/107520.txt
I think that it can be better to get some conclusions.
Signature · 1 line
The dawn of the fourth age of Linux firewalling is coming; a time of great struggle and heroic deeds -- J.Kadlecsik got inspired by J.Morris
Quoted 15 lines · Pablo Neira Ayuso
Hi,
Finally, I've got some results in my test enviroment about the ctnetlink event drop issue. The machine used as firewall is a PIII 866 256 Mbytes RAM, two NIC realtek 8139 100Mbits running debian unstable with linux kernel 2.6.16.
I have run the same test with three different socket queue sizes:
107.520 (default)
215.040 (x2)
430.080 (x4)I used netperf to create the connections with a shell script that loops calling netperf -H ip -l 3 &.
Quoted 8 lines
To get the number of events dropped I've used the following:
$ conntrackd & (run as daemon) $ conntrackd -s (request statistics)Results are available in:
Does "events" mean events/s?
Quoted 3 lines
Currently
nlmsg_seqis not set in ctnetlink events, if we set it, we can do some kind of sequence tracking on netlink. If an event gets lost, we can request a resync with the conntrack viadump_conntrack.
nlmsg_seq should only (but in that case it really should) be set for responses to queries, so userspace can associate responses with queries. Drops are reported as -ENOBUFS socket errors to all multicast listeners.
Quoted 5 lines
Another choice could be relax conntrackd states transitions, currently the valid transition sequence is: NEW -> UPDATE -> DESTROY, if an UPDATE event is received but no NEW was seen previously, then the event is ignored. Maybe this is too tight, but since I'm validating the whole thing I prefer remaining "tight" at the moment.
I guess this could be made configurable, but I think for testing purposes its better to be stricter so it doesn't shadow real problems.
Pablo Neira Ayuso
maintainerQuoted 22 lines · Patrick McHardy
Quoted 20 lines · Pablo Neira Ayuso
Hi,
Finally, I've got some results in my test enviroment about the ctnetlink event drop issue. The machine used as firewall is a PIII 866 256 Mbytes RAM, two NIC realtek 8139 100Mbits running debian unstable with linux kernel 2.6.16.
I have run the same test with three different socket queue sizes:
107.520 (default)
215.040 (x2)
430.080 (x4)I used netperf to create the connections with a shell script that loops calling netperf -H ip -l 3 &.
To get the number of events dropped I've used the following:
$ conntrackd & (run as daemon) $ conntrackd -s (request statistics)
Quoted 6 lines
Quoted 3 lines
Results are available in:
Does "events" mean events/s?
No, sorry, it seems that the graph is definitely misleading :(. Have a look at http://people.netfilter.org/pablo/ctnetlink/107520.txt
Quoted 8 lines
Quoted 3 lines
Currently
nlmsg_seqis not set in ctnetlink events, if we set it, we can do some kind of sequence tracking on netlink. If an event gets lost, we can request a resync with the conntrack viadump_conntrack.
nlmsg_seqshould only (but in that case it really should) be set for responses to queries, so userspace can associate responses with queries. Drops are reported as-ENOBUFSsocket errors to all multicast listeners.
Good point. Thanks.
Quoted 9 lines
Quoted 5 lines
Another choice could be relax conntrackd states transitions, currently the valid transition sequence is: NEW -> UPDATE -> DESTROY, if an UPDATE event is received but no NEW was seen previously, then the event is ignored. Maybe this is too tight, but since I'm validating the whole thing I prefer remaining "tight" at the moment.
I guess this could be made configurable, but I think for testing purposes its better to be stricter so it doesn't shadow real problems.
Indeed, I'm going to add a configurable parameter.
Signature · 1 line
The dawn of the fourth age of Linux firewalling is coming; a time of great struggle and heroic deeds -- J.Kadlecsik got inspired by J.Morris
Quoted 10 lines · Pablo Neira Ayuso
Quoted 4 lines · Patrick McHardy
Does "events" mean events/s?
No, sorry, it seems that the graph is definitely misleading :(. Have a look at http://people.netfilter.org/pablo/ctnetlink/107520.txt
I can't seem to find the number of drops in that table, which I thought this test was all about :) I did some plotting with the numbers myself, comparing (1):(2)/(1) with (1):(3)/(1) (actually / 6.353 to scale the initial UPDATE value down to NEW) shows that UPDATE events scale much more linear than NEW events, which could either mean they get dropped more for some reason or that the connections had a higher number of packets in the runs with more connections (possibly because of more retransmissions). I think we need the number of packets per connection to make sense out of the data.