# 145 MB/s drops to 10 MB/s when running webserver with minor load



## einthusan (Mar 13, 2012)

So basically I have a hard drive that is being used for streaming video. With nginx running, with low I/O to the hard drive causes the hard drive speed test using [CMD="dd"]if=/dev/ad7 of=/dev/null bs=1M count=1k[/CMD] to show 10 MB/s. Once *I* stop nginx and then perform the test, it jumps to 145 MB/s. Anyone have a clue whats happening? Thanks.


----------



## phoenix (Mar 13, 2012)

Upgrade your version of FreeBSD and enable the ahci driver. That will enable Native Command Queuing support in the controller and the disks. Then you should get better throughput.

Throwing random read and write I/O, no matter how little, will mess up sequential I/O as the drive heads have to move to other areas of the disk.

NCQ will mitigate this a bit by better grouping I/Os together to minimise head movement. But random I/O will always slow down sequential I/O.


----------



## einthusan (Mar 14, 2012)

Thanks! I will surely give that a try and report back. Just also wanted to mention that I am not using a ZFS file system (*I'm* using UFS2) and the drive is a WD SATA 3 GB/s. Do I have to upgrade my FreeBSD to 9? I am currently using FreeBSD 8.2.


----------



## einthusan (Mar 14, 2012)

I checked the loader.conf and seems that achi is already enabled. 


```
hw.em.enable_msix="1"
aio_load="YES"
vfs.zfs.prefetch_disable="1"
ahci_load="YES"
```


----------



## einthusan (Mar 14, 2012)

Sorry for the post spams but after checking [CMD=]dmesg[/CMD] *I* realized that AHCI is not being loaded even though the config tells it to. I read it has to do with the BIOS but how do I see BIOS settings when the server is a dedicated server hosted in a data center?


----------



## phoenix (Mar 14, 2012)

You ask them to configure remote console access so that you can see the screen while it boots and can get into the BIOS using KVM-over-IP or IPMI or Lights-Out Management (LOM) or whatever remote access setup they have.

Or, you phone up support, ask someone to go down to the server, reboot, go into BIOS, make changes, etc.


----------



## einthusan (Mar 14, 2012)

Thanks for all the help. Before *I* got your reply, I did just that, I told them to enable it and now achi is enabled and can confirm that in dmesg. Now I'm upgrading my version to 9.0 and started a new thread here Upgrade to 9.0 from 8.2 custom kernel because I don't know how FreeBSD works when upgrading an OS with custom kernel.

Thanks by the way for your help!


----------

