# Network issues



## Kvaturka (Jan 24, 2010)

Tried to test my freebsd 8 system and noticed that speed on gigabit lan max comes to 600Mbit/s, at the same time on Ubuntu server I have 900Mbit/s. In these tests I used the same machine and iperf. I was testing using GENERIC kernel and all options by default. Man's about optimization didn't give the result.
Where could  be the problem?

```
Freebsd8(PC1)<====Ubuntu(PC2) iperf = 600Mbit/s
Freebsd8(PC1)<====Freebsd(PC3) iperf= 500Mbit/s
Ubuntu_server(PC1)<=====Ubuntu(PC2) = 900Mbit/s
Mandriva(PC4)<====Ubuntu(PC2) iperf = 960Mbit/s
Machine:
```
  Intel server board G7ESZ
  lan NIC - Itel Pro/1000Mt Dual Port Serer Adapter (em)


----------



## dennylin93 (Jan 25, 2010)

I saw a few discussions a while ago, but I've forgotten where they are. Try asking on the freebsd-net@ and the freebsd-performance@ mailing lists. You'll probably get more help there.


----------



## Savagedlight (Jan 25, 2010)

I've managed to cap my gigabit network using samba (115-126MB/s file transfers, according to the file copy dialog), and managed to get 990mbit/s through iperf.

This is a copypaste of my relevant settings in /etc/sysctl.conf

```
#If you use polling
kern.polling.burst_max=1000
kern.polling.idle_poll=0
kern.polling.each_burst=128

net.inet.tcp.slowstart_flightsize=50

#Tweak the tcp settings
net.inet.tcp.sendspace=524288
net.inet.tcp.recvspace=262144
net.inet.tcp.mssdflt=1452

#Tweak the UDP settings
net.inet.udp.recvspace=65535
net.inet.udp.maxdgram=65535

net.local.stream.recvspace=65535
net.local.stream.sendspace=65535

kern.ipc.maxsockbuf=2097152
```

And relevant settings from /usr/local/etc/smb.conf:

```
socket options = SO_KEEPALIVE TCP_NODELAY IPTOS_LOWDELAY IPTOS_THROUGHPUT
```

It should also be said that I enabled polling, use a kern.hz of 2000, and enabled 9k jumbo frames everywhere in my network.

As for iperf, make sure you run multiple threads (there's a commandline option for it, has to be done on both client and server)

I hope any of this helps.


----------



## Kvaturka (Jan 26, 2010)

Ths for help but it don't help. Some people advise to replace em driver of freebsd by driver from intel website. I am not good in it so i will be very grateful for help with it.


----------



## Kvaturka (Jan 27, 2010)

I installed Freebsd 8  on powerful machine (intel quad processor, ddr3 memory and modern motherboard) and iperf showed me 934Mbit/s.
I noticed that while the test is running top shows that partition "system" take all processor time on my server board while only 20% on powerful pc. May be the reason that the server board have to weak processor(P3) for such speed ?


----------



## Alt (Jan 27, 2010)

Possible it have weak network card (small buffer / generating many interrupts)
If you draw your testing layout (PC1,2,3,4) you can see tests its not good aligned, so i dont want to call these tests 'clean'.. :stud


----------



## Ruler2112 (Jan 27, 2010)

You may also want to look at the load on the box's CPU.  FreeBSD will start a file system check one minute after boot, which could be affecting your results.  Anything else that sucks up considerable CPU time and/or disk access could affect it as well.

I remember long ago, my buddy had a brand new, cutting edge, external 33.6 modem.  His 386 limited the speed of the modem - we tested this with my 486 by dialing in several times with the same modem and phone line.  Connecting at the same baud rate, I'd consistently achieve speeds that were about 20% greater than his box could.  We even created RAM disks to eliminate the drive access time from the equation, booted from the same DOS disk, and swapped the serial interface card and verified the settings were the same to rule that out - made no difference.  We concluded that the CPU speed was actually limiting how fast the data could come in.  (Exactly how this is possible when 386s definitely get faster speeds over ethernet I'm not quite sure, which is why we went to such lengths to eliminate everything else we could.)  I remembered this when reading your thread and thought I'd throw it out there - if a machine is bogged down with something else when you're running the tests, it'd distort the results.


----------



## SirDice (Jan 27, 2010)

One thing to note, if you turn on polling it may improve network speeds but it will cost more CPU cycles compared to the 'regular' interrupt driven setup. The more you poll the more CPU cycles it will use.


----------

