# dummynet high CPU usage



## krzysiekb81 (Mar 2, 2012)

Hello!

I'm using F*ree*BSD 8.1-RELEASE-p8 with ipfw and dummynet in kernel (i386).

Periodically (like every 15-30 minutes) dummynet uses CPU heavily for another 10-15 minutes, and then drops down:



```
last pid: 37662;  load averages:  0.71,  1.38,  1.65                   up 3+18:28:24  12:30:50
169 processes: 6 running, 132 sleeping, 5 zombie, 26 waiting
CPU 0:  0.0% user,  0.0% nice, 32.3% system, 35.5% interrupt, 32.3% idle
CPU 1: 30.0% user,  0.0% nice, 20.0% system,  0.0% interrupt, 50.0% idle
CPU 2: 10.0% user,  0.0% nice,  6.7% system,  0.0% interrupt, 83.3% idle
CPU 3:  0.0% user,  0.0% nice, 41.9% system,  0.0% interrupt, 58.1% idle
Mem: 81M Active, 804M Inact, 307M Wired, 61M Cache, 112M Buf, 703M Free
Swap: 3983M Total, 1140K Used, 3982M Free

  PID USERNAME PRI NICE   SIZE    RES STATE   C   TIME   WCPU COMMAND
   11 root     171 ki31     0K    32K RUN     2  71.8H 85.55% {idle: cpu2}
   11 root     171 ki31     0K    32K CPU1    1  63.8H 71.97% {idle: cpu1}
[color="Red"]    0 root     -68    0     0K   104K -       3  18.4H 68.75% {dummynet}[/color]
   11 root     171 ki31     0K    32K CPU0    0  36.2H 41.99% {idle: cpu0}
    0 root     -68    0     0K   104K -       0  30.8H 41.31% {em0 taskq}
   12 root     -68    -     0K   208K WAIT    0  38.0H 33.11% {irq257: em1}
   11 root     171 ki31     0K    32K RUN     3  70.1H 29.20% {idle: cpu3}
80850 andrzej   44    0  9428K  3580K select  0   0:37  0.49% sshd
94196 root      44    0 19532K 12904K select  1   0:05  0.39% pmacctd
94195 root      45    0 11420K  6260K bpf     2   0:08  0.24% pmacctd
   12 root     -68    -     0K   208K WAIT    0  30:18  0.10% {irq258: em1}
```


```
last pid: 71798;  load averages:  1.02,  0.82,  0.89                   up 3+18:55:56  12:58:22
168 processes: 6 running, 131 sleeping, 5 zombie, 26 waiting
CPU 0:  0.9% user,  0.0% nice, 26.5% system, 34.5% interrupt, 38.1% idle
CPU 1: 19.5% user,  0.0% nice, 19.5% system,  0.0% interrupt, 61.1% idle
CPU 2: 10.6% user,  0.0% nice,  8.0% system,  0.0% interrupt, 81.4% idle
CPU 3:  5.4% user,  0.0% nice,  3.6% system,  0.0% interrupt, 91.1% idle
Mem: 82M Active, 806M Inact, 285M Wired, 32M Cache, 112M Buf, 749M Free
Swap: 3983M Total, 104K Used, 3983M Free

  PID USERNAME PRI NICE   SIZE    RES STATE   C   TIME   WCPU COMMAND
   11 root     171 ki31     0K    32K CPU3    3  70.5H 94.87% {idle: cpu3}
   11 root     171 ki31     0K    32K CPU2    2  72.2H 83.59% {idle: cpu2}
   11 root     171 ki31     0K    32K RUN     1  64.1H 67.24% {idle: cpu1}
    0 root     -68    0     0K   104K CPU0    0  31.0H 46.53% {em0 taskq}
   11 root     171 ki31     0K    32K RUN     0  36.4H 43.90% {idle: cpu0}
   12 root     -68    -     0K   208K WAIT    0  38.1H 34.28% {irq257: em1}
[color="red"]    0 root     -68    0     0K   104K -       2  18.5H  1.42% {dummynet}[/color]
94196 root      45    0 19532K 13776K select  3   0:47  0.98% pmacctd
80850 andrzej   44    0  9428K  3580K select  3   0:55  0.63% sshd
73174 andrzej   44    0  9428K  3596K select  1   2:31  0.34% sshd
94195 root      46    0 11420K  6260K bpf     1   1:15  0.24% pmacctd
   12 root     -68    -     0K   208K WAIT    0  30:27  0.10% {irq258: em1}
```

The CPU usage can vary from 0,10% to 80%...
How to check what is the cause of this dummynet behaviour? 

Ruleset doesn't change, it consists of about 2000 pipes.

Sometimes I get this when I try to list pipes:


```
opole# ipfw pipe show
ipfw: invalid oid len 0
```

My sysctl settings:


```
opole# sysctl net.inet.ip.dummynet
net.inet.ip.dummynet.io_pkt_drop: 53597229
net.inet.ip.dummynet.io_pkt_fast: 3086456673
net.inet.ip.dummynet.io_pkt: 2114587167
net.inet.ip.dummynet.queue_count: 0
net.inet.ip.dummynet.fsk_count: 1850
net.inet.ip.dummynet.si_count: 710
net.inet.ip.dummynet.schk_count: 3700
net.inet.ip.dummynet.tick_lost: 0
net.inet.ip.dummynet.tick_diff: 4726128
net.inet.ip.dummynet.tick_adjustment: 4906976
net.inet.ip.dummynet.tick_delta_sum: 169
net.inet.ip.dummynet.tick_delta: 500
net.inet.ip.dummynet.red_max_pkt_size: 1500
net.inet.ip.dummynet.red_avg_pkt_size: 512
net.inet.ip.dummynet.red_lookup_depth: 256
net.inet.ip.dummynet.expire_cycle: 0
net.inet.ip.dummynet.expire: 1
net.inet.ip.dummynet.debug: 0
net.inet.ip.dummynet.io_fast: 1
net.inet.ip.dummynet.pipe_byte_limit: 1048576
net.inet.ip.dummynet.pipe_slot_limit: 100
net.inet.ip.dummynet.hash_size: 2048
```

Any help would be appreciated, thanks!


----------



## krzysiekb81 (Mar 7, 2012)

The problem was resolved by upgrading to FreeBSD 9.0, configuration and enviroment is the same, but the problem is gone.


----------

