* Re: [LARTC] MARK causes high CPU usage / using tc in conjunction with MASQ
2004-05-22 21:25 [LARTC] MARK causes high CPU usage / using tc in conjunction with MASQ Paul Lambert
@ 2004-05-23 18:07 ` Andreas Klauer
2004-05-23 22:30 ` [LARTC] MARK causes high CPU usage / using tc in conjunction Ed Wildgoose
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Andreas Klauer @ 2004-05-23 18:07 UTC (permalink / raw)
To: lartc
Am Saturday 22 May 2004 23:25 schrieb Paul Lambert:
> This setup has worked well for more than 1000 devices but as the network
> has grown to 3000+ devices the CPU is not keeping up.
I guess you mean 3000+ clients, not actual network devices on one machine.
> *** eth0 is MASQUERADE'd so I mark the packet on eth1 ***
> *** I have narrowed it down to this one entry sucking all the CPU ***
> iptables -t mangle -A PREROUTING -s 10.10.6.20 -i eth1 -j MARK
> --set-mark 0x843
Well, if you have 3000+ rules like that, it will certainly slow you down.
You should use some kind of hashing. How that is done for tc filters,
is described here: http://www.lartc.org/lartc.html#LARTC.ADV-FILTER.HASHING
Apply the same (or a similar) mechanism to your iptables ruleset and
you should get improved speeds.
HTH
Andreas
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [LARTC] MARK causes high CPU usage / using tc in conjunction
2004-05-22 21:25 [LARTC] MARK causes high CPU usage / using tc in conjunction with MASQ Paul Lambert
2004-05-23 18:07 ` Andreas Klauer
@ 2004-05-23 22:30 ` Ed Wildgoose
2004-05-23 23:27 ` [LARTC] MARK causes high CPU usage / using tc in conjunction with MASQ Andreas Klauer
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Ed Wildgoose @ 2004-05-23 22:30 UTC (permalink / raw)
To: lartc
>Well, if you have 3000+ rules like that, it will certainly slow you down.
>You should use some kind of hashing. How that is done for tc filters,
>is described here: http://www.lartc.org/lartc.html#LARTC.ADV-FILTER.HASHING
>
>Apply the same (or a similar) mechanism to your iptables ruleset and
>you should get improved speeds.
>
>
If he wanted to keep the system of using iptables to classify and tc to
filter, then couldn't he look at using seperate filter chains to
decrease the search space?
Also, what about using return rules to speedup the search times in a
given filter chain?
I think his point was actually that it was not a CPU issue without
adding that one particular rule. But perhaps you will have more success
asking on the iptables list?
Good luck
Ed W
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [LARTC] MARK causes high CPU usage / using tc in conjunction with MASQ
2004-05-22 21:25 [LARTC] MARK causes high CPU usage / using tc in conjunction with MASQ Paul Lambert
2004-05-23 18:07 ` Andreas Klauer
2004-05-23 22:30 ` [LARTC] MARK causes high CPU usage / using tc in conjunction Ed Wildgoose
@ 2004-05-23 23:27 ` Andreas Klauer
2004-05-24 0:50 ` [LARTC] MARK causes high CPU usage / using tc in conjunction Paul Lambert
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Andreas Klauer @ 2004-05-23 23:27 UTC (permalink / raw)
To: lartc
Am Monday 24 May 2004 00:30 schrieb Ed Wildgoose:
> If he wanted to keep the system of using iptables to classify and tc to
> filter, then couldn't he look at using seperate filter chains to
> decrease the search space?
Is there any other way to implement iptables hashing than using new chains?
I can't think of any right now.
> Also, what about using return rules to speedup the search times in a
> given filter chain?
If you mean adding one return rule after every match test, then only
if that doesn't require testing the same thing twice. Since otherwise
you'll double the number of tests for all packets that don't match at
all or match to the last rule.
> I think his point was actually that it was not a CPU issue without
> adding that one particular rule. But perhaps you will have more success
> asking on the iptables list?
If it is one *single* rule, then I'd consider this a bug.
If it's the same rule 3000+ times, then it's probably normal,
depending on the cost of that particular test.
Andreas
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [LARTC] MARK causes high CPU usage / using tc in conjunction
2004-05-22 21:25 [LARTC] MARK causes high CPU usage / using tc in conjunction with MASQ Paul Lambert
` (2 preceding siblings ...)
2004-05-23 23:27 ` [LARTC] MARK causes high CPU usage / using tc in conjunction with MASQ Andreas Klauer
@ 2004-05-24 0:50 ` Paul Lambert
2004-05-24 21:20 ` [LARTC] MARK causes high CPU usage / using tc in conjunction with MASQ miller69
2004-05-28 15:50 ` [LARTC] MARK causes high CPU usage / using tc in conjunction Paul Lambert
5 siblings, 0 replies; 7+ messages in thread
From: Paul Lambert @ 2004-05-24 0:50 UTC (permalink / raw)
To: lartc
Andreas Klauer wrote:
> Am Saturday 22 May 2004 23:25 schrieb Paul Lambert:
>
>>This setup has worked well for more than 1000 devices but as the network
>>has grown to 3000+ devices the CPU is not keeping up.
>
>
> I guess you mean 3000+ clients, not actual network devices on one machine.
>
Yes 3000+ client devices.
>
>>*** eth0 is MASQUERADE'd so I mark the packet on eth1 ***
>>*** I have narrowed it down to this one entry sucking all the CPU ***
>>iptables -t mangle -A PREROUTING -s 10.10.6.20 -i eth1 -j MARK
>>--set-mark 0x843
>
>
> Well, if you have 3000+ rules like that, it will certainly slow you down.
> You should use some kind of hashing. How that is done for tc filters,
> is described here: http://www.lartc.org/lartc.html#LARTC.ADV-FILTER.HASHING
tc is keeping up well for now. However, I think you're right and this is
worth implementing.
>
> Apply the same (or a similar) mechanism to your iptables ruleset and
> you should get improved speeds.
I like this idea. I never thought about using a hash filter in iptables.
I could have two sections. I could match the subnet and then jump to
look up the node address. I think this would lessen the load
considerably as long as it is the lookup that is taking the most cpu
cycles and not the actual MARK routine having to execute on every packet.
--
Thanks
>
> HTH
> Andreas
> _______________________________________________
> LARTC mailing list / LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [LARTC] MARK causes high CPU usage / using tc in conjunction with MASQ
2004-05-22 21:25 [LARTC] MARK causes high CPU usage / using tc in conjunction with MASQ Paul Lambert
` (3 preceding siblings ...)
2004-05-24 0:50 ` [LARTC] MARK causes high CPU usage / using tc in conjunction Paul Lambert
@ 2004-05-24 21:20 ` miller69
2004-05-28 15:50 ` [LARTC] MARK causes high CPU usage / using tc in conjunction Paul Lambert
5 siblings, 0 replies; 7+ messages in thread
From: miller69 @ 2004-05-24 21:20 UTC (permalink / raw)
To: lartc
> > Apply the same (or a similar) mechanism to your iptables ruleset and
> > you should get improved speeds.
>
> I like this idea. I never thought about using a hash filter in iptables.
> I could have two sections. I could match the subnet and then jump to
> look up the node address. I think this would lessen the load
> considerably as long as it is the lookup that is taking the most cpu
> cycles and not the actual MARK routine having to execute on every packet.
Well, I don't know your ruleset and setup but maybe you could use the
connection tracking system to improve this. Put the mark value into the
conntack table using CONNMARK extension.
For every packet you receive you have to restore this value but there's no
need to fall through the rules anymore if it is already marked. Lookups in
the CONNTRACK table use hashing so shall be much faster. A huge ruleset
decreases iptables performance pretty bad.
Regards
--
"Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen!
Jetzt aktivieren unter http://www.gmx.net/info
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [LARTC] MARK causes high CPU usage / using tc in conjunction
2004-05-22 21:25 [LARTC] MARK causes high CPU usage / using tc in conjunction with MASQ Paul Lambert
` (4 preceding siblings ...)
2004-05-24 21:20 ` [LARTC] MARK causes high CPU usage / using tc in conjunction with MASQ miller69
@ 2004-05-28 15:50 ` Paul Lambert
5 siblings, 0 replies; 7+ messages in thread
From: Paul Lambert @ 2004-05-28 15:50 UTC (permalink / raw)
To: lartc
I'm actually using the WISP Billing System from PowerNOC. I talked with
them about your idea and they implemented it for me already. It is
working great. Thanks everyone for your help!
Andreas Klauer wrote:
> Am Saturday 22 May 2004 23:25 schrieb Paul Lambert:
>
>>This setup has worked well for more than 1000 devices but as the network
>>has grown to 3000+ devices the CPU is not keeping up.
>
>
> I guess you mean 3000+ clients, not actual network devices on one machine.
>
>
>>*** eth0 is MASQUERADE'd so I mark the packet on eth1 ***
>>*** I have narrowed it down to this one entry sucking all the CPU ***
>>iptables -t mangle -A PREROUTING -s 10.10.6.20 -i eth1 -j MARK
>>--set-mark 0x843
>
>
> Well, if you have 3000+ rules like that, it will certainly slow you down.
> You should use some kind of hashing. How that is done for tc filters,
> is described here: http://www.lartc.org/lartc.html#LARTC.ADV-FILTER.HASHING
>
> Apply the same (or a similar) mechanism to your iptables ruleset and
> you should get improved speeds.
>
> HTH
> Andreas
> _______________________________________________
> LARTC mailing list / LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread