Bug 8085

Summary: performance drop in 2.6.20 (CONFIG_NF_CONNTRACK_SUPPORT)
Product: Networking Reporter: a1bert (a1bert)
Component: Netfilter/IptablesAssignee: networking_netfilter-iptables (networking_netfilter-iptables)
Status: CLOSED OBSOLETE    
Severity: normal CC: alan, okir, protasnb, va
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.20 Subsystem:
Regression: No Bisected commit-id:
Attachments: cpu load
profile 2.6.19.5 (NAT enabled)
profile 2.6.20.1 (NAT enabled)
config.2.6.19.5
config.2.6.20.1
profile.2.6.20.1-nf-conntrack
cat /proc/net/stat/nf_conntrack
Avoid double helper/expectation lookup
2.6.20.1 +nf_conntrack+patch
config for 2.6.19.7 kernel
config of 2.6.20 kernel, very similar to 2.6.19.7 config
profiler output of 2.6.19.7 kernel
profiler output of 2.6.20 kernel

Description a1bert 2007-02-26 07:10:27 UTC
Most recent kernel where this bug did *NOT* occur: 2.6.19.5
Distribution: slackware based
Hardware Environment: Xeon + e1000
Software Environment: gcc 3.3.x
Problem Description: noticeable (10-15%) routing and bridging (possibly 
overall) performance drop between 2.6.19.5 - 2.6.20 (2.6.20.1 2.6.21-rc1 too) 
same configs

we are experiencing performance drop on our rather busy(>150kpps >700Mbps in 
one direction) bridge with ebtables and routers (210k routes, >30kpps duplex). 
It's not e1000 issue.

Steps to reproduce:
Comment 1 Anonymous Emailer 2007-02-26 07:21:05 UTC
Reply-To: akpm@linux-foundation.org


ooh.

Begin forwarded message:

Date: Mon, 26 Feb 2007 07:10:48 -0800
From: bugme-daemon@bugzilla.kernel.org
To: bugme-new@lists.osdl.org
Subject: [Bugme-new] [Bug 8085] New: performance drop in 2.6.20


http://bugzilla.kernel.org/show_bug.cgi?id=8085

           Summary: performance drop in 2.6.20
    Kernel Version: 2.6.20
            Status: NEW
          Severity: normal
             Owner: shemminger@osdl.org
         Submitter: a1bert@atlas.cz


Most recent kernel where this bug did *NOT* occur: 2.6.19.5
Distribution: slackware based
Hardware Environment: Xeon + e1000
Software Environment: gcc 3.3.x
Problem Description: noticeable (10-15%) routing and bridging (possibly 
overall) performance drop between 2.6.19.5 - 2.6.20 (2.6.20.1 2.6.21-rc1 too) 
same configs

we are experiencing performance drop on our rather busy(>150kpps >700Mbps in 
one direction) bridge with ebtables and routers (210k routes, >30kpps duplex). 
It's not e1000 issue.

Steps to reproduce:

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

Comment 2 a1bert 2007-02-26 07:37:17 UTC
Created attachment 10539 [details]
cpu load
Comment 3 Stephen Hemminger 2007-03-14 15:00:17 UTC
It would be helpful to get some profiling on the system
   see Documentation/basic_profiling.txt

And possibly bisect to a specific change.
Comment 4 Stephen Hemminger 2007-04-18 13:22:51 UTC
What makes you say it s not a e1000 driver or configuration change?
Comment 5 a1bert 2007-04-25 14:01:05 UTC
the same - latest  e1000 driver was used (with the same results as  e1000 
drivers from vanilla); the config for 2.6.20 was done by cp .config ; make 
oldconfig ...
Comment 6 a1bert 2007-04-30 08:33:42 UTC
well, looks like it's conntrack related, when I do not use conntrack, the  
performace is same for both kernels
Comment 7 a1bert 2007-04-30 08:41:29 UTC
Created attachment 11345 [details]
profile 2.6.19.5 (NAT enabled)

captured with: readprofile -r ;sleep 300 ; readprofile -m .......

since it's tested on live traffic, the traffic processed during the test it's
not the same but simillar ;)
Comment 8 a1bert 2007-04-30 08:42:51 UTC
Created attachment 11346 [details]
profile 2.6.20.1 (NAT enabled)

captured with: readprofile -r ;sleep 300 ; readprofile -m .......

since it's tested on a live traffic, the traffic processed during the test it's
not the same but similar ;)
Comment 9 Patrick McHardy 2007-05-01 10:09:35 UTC
The second profile only shows a single connection tracking function:

   625 nf_ct_attach                              25.0000

Please add the .configs used for both kernels, information which modules are
loaded (not sure what you mean by "enabled") and whether any iptables rules are
used.
Comment 10 a1bert 2007-05-01 13:45:14 UTC
NAT enabled means NAT rules inserted => conntrack modules loaded:

# Generated by iptables-save v1.3.1 on Tue May  1 22:43:06 2007
*nat
:PREROUTING ACCEPT [50781211298:29582995904030]
:POSTROUTING ACCEPT [1450:93488]
:OUTPUT ACCEPT [1450:93488]
-A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 80 
-A PREROUTING -i eth0 -p tcp -m tcp --dport 3128 -j REDIRECT --to-ports 80 
COMMIT
# Completed on Tue May  1 22:43:06 2007

Module                  Size  Used by
ebt_ip                  2432  346 
ebtable_broute          2048  1 
ebtables               18688  2 ebt_ip,ebtable_broute
ipt_REDIRECT            2048  2 
xt_tcpudp               3328  2 
iptable_nat             6148  1 
ip_nat                 15020  2 ipt_REDIRECT,iptable_nat
ip_conntrack           43148  2 iptable_nat,ip_nat
nfnetlink               5272  2 ip_nat,ip_conntrack
ip_tables              10712  1 iptable_nat
x_tables               11396  4 ipt_REDIRECT,xt_tcpudp,iptable_nat,ip_tables
ipv6                  227244  10 
bridge                 48028  1 ebtable_broute
llc                     5908  1 bridge
e1000                 116032  0 
8139too                21248  0 
crc32                   4224  1 8139too
Comment 11 Patrick McHardy 2007-05-02 05:20:55 UTC
.config files please. This module list is from the old or the new kernel?
Comment 12 a1bert 2007-05-02 07:32:34 UTC
module list is from 2.6.19.5, I will provide 2.6.20.1 modules list tomorrow 
(CET), I will also try 2.6.20.1 with CONFIG_IP_NF_CONNTRACK tomorrow (tested 
kernel with performance problems uses CONFIG_NF_CONNTRACK_SUPPORT)
Comment 13 a1bert 2007-05-02 07:33:09 UTC
Created attachment 11371 [details]
config.2.6.19.5
Comment 14 a1bert 2007-05-02 07:35:39 UTC
Created attachment 11372 [details]
config.2.6.20.1

please ignore CONFIG_LOCALVERSION
Comment 15 a1bert 2007-05-03 00:20:20 UTC
2.6.20.1 module list:

ipt_REDIRECT            1920  1 
xt_tcpudp               3072  1 
iptable_nat             5892  1 
nf_nat                 13612  2 ipt_REDIRECT,iptable_nat
nf_conntrack_ipv4      13068  2 iptable_nat
nf_conntrack           47832  3 iptable_nat,nf_nat,nf_conntrack_ipv4
nfnetlink               4888  2 nf_conntrack_ipv4,nf_conntrack
ip_tables               9544  1 iptable_nat
x_tables               11012  4 ipt_REDIRECT,xt_tcpudp,iptable_nat,ip_tables
ebt_ip                  2176  346 
ebtable_broute          1920  1 
ebtables               17152  2 ebt_ip,ebtable_broute
ipv6                  226988  10 
bridge                 44312  1 ebtable_broute
llc                     5524  1 bridge
e1000                 114368  0 
8139too                19968  0 
bitrev                  1792  1 8139too
crc32                   3968  1 8139too
Comment 16 a1bert 2007-05-03 00:44:40 UTC
so the problem is definitely in CONFIG_NF_CONNTRACK_SUPPORT, with 
CONFIG_IP_NF_CONNTRACK_SUPPORT there is no difference in performance of 
2.6.19.5 and 2.6.20.1.



Comment 17 Patrick McHardy 2007-05-03 04:09:36 UTC
Thanks for narrowing it down. A small performance decrease is expected, but not
this large. Your last profile didn't show (almost) anything conntrack related,
could you please post another nf_conntrack profile (maybe let it run a bit
longer) and the output of /proc/net/stat/nf_conntrack? Thanks.
Comment 18 a1bert 2007-05-04 12:47:39 UTC
Created attachment 11388 [details]
profile.2.6.20.1-nf-conntrack

2.6.20.1 nf-conntrack 10min profile
Comment 19 a1bert 2007-05-04 12:49:19 UTC
Created attachment 11389 [details]
cat /proc/net/stat/nf_conntrack

cat /proc/net/stat/ip_conntrack (2.6.20.1 nf-conntrack )
Comment 20 Patrick McHardy 2007-05-08 03:10:38 UTC
Created attachment 11434 [details]
Avoid double helper/expectation lookup

Unfortunately the profile still doesn't show anything conntrack related, so
I'll have to shoot in the dark. Can you try if this patch improves things
please? It avoids some nf_conntrack related overhead that might be responsible.
Comment 21 a1bert 2007-05-08 06:24:20 UTC
>Unfortunately the profile still doesn't show anything conntrack related

there is no traffic that will match NAT iptables, so no NATting is actually 
done.... Is this why there is no trace of conntrack in profile?
Comment 22 Patrick McHardy 2007-05-08 06:28:15 UTC
No, connection tracking is always performed and even most of the NAT functions
are always called, even without any rules.
Comment 23 Patrick McHardy 2007-05-14 04:27:08 UTC
Any news on the patch?
Comment 24 a1bert 2007-05-15 05:23:08 UTC
Created attachment 11508 [details]
2.6.20.1 +nf_conntrack+patch

sorry for delay but still about 10% difference.. :(
Comment 25 Natalie Protasevich 2007-07-07 17:57:09 UTC
Any updates on this problem?
Thanks.
Comment 26 Vitaly Ivanov 2007-10-18 04:33:02 UTC
We have similar problem
server with 2.6.20 kernel has about 30Mbit/s http output traffic (30Mbit/s maximum)
but same server with 2.6.19 kernel has about 95Mbit/s http output traffic (125Mbit/s maximum)
Comment 27 Patrick McHardy 2007-10-18 04:42:09 UTC
Please try 2.6.23.
Comment 28 Vitaly Ivanov 2008-01-24 03:45:15 UTC
2.6.23. too
Comment 29 Patrick McHardy 2008-01-24 04:35:53 UTC
Please try to capture a profile as described in Documentation/basic-profiling.txt. The previous profiles attached to this report didn't show anything related to conntrack.

What hardware are you running on?
Comment 30 Vitaly Ivanov 2008-02-08 06:14:30 UTC
Now we have dedicated server to solve this problem.

We tried on different x86_64 hardware (Intel and AMD) with different NIC (e1000 and tg3).
kernels 2.6.15, 2.6.16, 2.6.18, 2.6.19, 2.6.19.7 had network performance ok
kernels 2.6.20, 2.6.23, 2.6.24 had network performance degradation

Kernel 2.6.19.7 handle about 2000 requests per second. Kernel 2.6.20 handle about 400 requests per second. Kernel 2.6.20 begin handle requests like 2.6.19.7 about 2000 requests per second, but in 10 seconds period after starting it step down to 400 requests per second. After stop requests sending and wait 3 minute kernel 2.6.20 begin handle about 2000 requests per second again and step down to 400 requests per second.
Comment 31 Vitaly Ivanov 2008-02-08 06:20:18 UTC
Created attachment 14750 [details]
config for 2.6.19.7 kernel
Comment 32 Vitaly Ivanov 2008-02-08 06:21:52 UTC
Created attachment 14751 [details]
config of 2.6.20 kernel, very similar to 2.6.19.7 config
Comment 33 Vitaly Ivanov 2008-02-08 06:23:40 UTC
Created attachment 14752 [details]
profiler output of 2.6.19.7 kernel

generated by
readprofile -r && sleep 60 && readprofile -m /boot/System.map > captured_profile-2.6.19.7
Comment 34 Vitaly Ivanov 2008-02-08 06:28:53 UTC
Created attachment 14753 [details]
profiler output of 2.6.20 kernel

generated by
readprofile -r && sleep 60 && readprofile -m /boot/System.map >
captured_profile-2.6.20
Comment 35 Vitaly Ivanov 2008-02-11 09:13:47 UTC
I found my problem by git bisect.
commit 72a3effaf633bcae9034b7e176bdbd78d64a71db
since this commit I should increase somaxconn sysctl variable

I set net.core.somaxconn=8192
and all work ok now

and net.ipv4.tcp_max_syn_backlog=24376
Comment 36 Patrick McHardy 2008-02-13 04:41:58 UTC
Thanks for tracking this down. Could you send the description of your problem and the related commit to netdev@vger.kernel.org? Please also CC the patch author.
Thanks.
Comment 37 Vitaly Ivanov 2008-02-14 02:12:19 UTC
No, I should not. This is not a bug. As I understand before this patch net.core.somaxconn was hardcoded in kernel to 512, now it sysctl variable with 128 default value. For high load http server this is not enough only.