Skip to content

FreeBSD 9.0 post-install Samba performance

21-Jan-12

Note that the Samba shares resides in a ZFS pool with dedup turned on. Since the blocks that make up the file being sent are probably already on the pool, it’s not necessarily writing the block data to disk. Using the same method as last time:

C:\Users\Poojan\Desktop>time_recv.bat
1 file(s) copied.

Took: 112.75 sec.
C:\Users\Poojan\Desktop>time_send
1 file(s) copied.

Took: 198.55 sec.

Whoa. That’s way worse than before. Let’s re-run each:

C:\Users\Poojan\Desktop>time_recv.bat
1 file(s) copied.

Took: 62.88 sec.
C:\Users\Poojan\Desktop>time_send
1 file(s) copied.

Took: 114.41 sec.

That’s better, but still not as good as before. One thing to note: I did not delete the file after the first run copied it over to the server. This shouldn’t matter much, since it’s in a snapshot of the zfs dataset somewhere, so the dedup algorithm should always return that the file doesn’t need to be saved to disk–although the algorithm itself probably takes quite a while to run on the server’s Atom D525 processor. Anyway, I deleted the file this time

C:\Users\Poojan\Desktop>time_send
1 file(s) copied.

Took: 107.59 sec.

I’ve turned off dedup on the server:

server# zfs set dedup=off tank

I deleted the file on the server.

C:\Users\Poojan\Desktop>time_send
1 file(s) copied.

Took: 58.01 sec.

Running again a little later with dedup back on. Deleted the file on the server:

C:\Users\Poojan\Desktop>time_send
1 file(s) copied.

Took: 123.14 sec.

Deleted file again.

C:\Users\Poojan\Desktop>time_send
1 file(s) copied.

Took: 107.19 sec.

Note that the second run here is 16 seconds faster than the first. Seems like caching effects have a 16 second impact. The dedup on/off has a 9 second impact.

Check-summing on dedup makes a difference. I notice during the send transfer that with dedup on, kernel takes 100%  of a CPU (of 4 hyperthreads), whereas with it off, kernel only takes 3%. Since we have a multi-threaded CPU, Samba takes one thread and dedup (kernel) takes another. It doesn’t really impact things much (much being greater than 10%)–which is an assumption the ZFS designers made with dedup. The assumption being that CPU processing is more available than I/O bandwidth.

In my case, on my Atom D525 they may be about even. Note that the first time I ran the send, the time was 199 seconds. One hypotehsis is that in this case, the checksum had to run but the file still needed to be stored to disk–however, I’m almost certain that a snapshot of the data exists in the pool (I snapshot every 15 minutes). Another possibility is that there are some dedup data structures that zfs needs to create on the first write, and so the data structures were being created in addition to the checksums being run. I’m basically speculating here.

Subsonic can’t bind to address on FreeBSD dual stack

20-Jan-12

Either build Java without IPv6, or you need the following in /etc/rc.conf:

tomcat60_enable="YES"
tomcat60_java_opts="-Djava.awt.headless=true -Djava.net.preferIPv4Stack=true"

(The java.awt.headless is if you’re running without an X console.)

Also, delete everyting in /usr/local/apache-tomcat-6.0/webapps/ except for subsonic and subsonic.war and rename these ROOT and ROOT.war respectively. Make sure www:www is the owner of everything (including your subsonic databases in /var/subsonic).

While you’re here, edit webapps/ROOT/WEB-INF/classes/ehcache.xml and change to (just an example):

<cache name="musicFolderCache"
maxElementsInMemory="128"
eternal="true"
diskPersistent="true"
overflowToDisk="true"/>

<cache name="chatCache"
maxElementsInMemory="128"
eternal="true"
diskPersistent="true"
overflowToDisk="true"/>

Corsair USB 3.0 16GB CMFVYGT3-16GB speed test

20-Jan-12

Looks basically like that other Corsair I bought a month ago. I basically bought another one so I can set up my FreeBSD root as a mirror of two 16 GB USB drives that are relatively fast for USB (even in a USB 2.0 port). This is in a USB 3.0 port:

-----------------------------------------------------------------------
CrystalDiskMark 3.0.1 x64 (C) 2007-2010 hiyohiyo
                           Crystal Dew World : http://crystalmark.info/
-----------------------------------------------------------------------
* MB/s = 1,000,000 byte/s [SATA/300 = 300,000,000 byte/s]

           Sequential Read :    80.246 MB/s
          Sequential Write :    21.428 MB/s
         Random Read 512KB :    76.034 MB/s
        Random Write 512KB :     1.573 MB/s
    Random Read 4KB (QD=1) :    10.279 MB/s [  2509.5 IOPS]
   Random Write 4KB (QD=1) :     0.030 MB/s [     7.4 IOPS]
   Random Read 4KB (QD=32) :    10.862 MB/s [  2651.8 IOPS]
  Random Write 4KB (QD=32) :     0.032 MB/s [     7.8 IOPS]

  Test : 1000 MB [I: 0.0% (0.0/14.9 GB)] (x9)
  Date : 2012/01/19 22:51:41
    OS : Windows 7 Home Premium Edition SP1 [6.1 Build 7601] (x64)

Allow LAN-only password login to sshd

17-Jan-12

See here and then add this to /etc/sshsshd_config:

Match Address 192.168.1.0/24
PasswordAuthentication yes

This allows clients on the local network to login using password authentication while limiting the Internet in general to key-based authentication.

Samba FreeBSD 8.2 benchmarks (pre-upgrade to FreeBSD 9.0)

13-Jan-12

I’m about to upgrade to FreeBSD. While I csup the latest RELENG-9.0 branch, I’m looking at my Samba performance on 8.2.

I’m measuring a copy of FreeBSD-8.2-RELEASE-i386-dvd1.iso to the Samba server using the following batch file (taken from here):

@echo off

set starttime=%TIME%
set startcsec=%STARTTIME:~9,2%
set startsecs=%STARTTIME:~6,2%
set startmins=%STARTTIME:~3,2%
set starthour=%STARTTIME:~0,2%
set /a starttime=(%starthour%*60*60*100)+(%startmins%*60*100)+(%startsecs%*100)+
(%startcsec%)

:TimeThis
copy C:\Users\Poojan\Desktop\FreeBSD-8.2-RELEASE-i386-dvd1.iso.xz \\SERVER\Poojan\Downloads

set endtime=%time%
set endcsec=%endTIME:~9,2%
set endsecs=%endTIME:~6,2%
set endmins=%endTIME:~3,2%
set endhour=%endTIME:~0,2%
if %endhour% LSS %starthour% set /a endhour+=24
set /a endtime=(%endhour%*60*60*100)+(%endmins%*60*100)+(%endsecs%*100)+(%endcsec%)

set /a timetaken= ( %endtime% - %starttime% )
set /a timetakens= %timetaken% / 100
set timetaken=%timetakens%.%timetaken:~-2%

echo.
echo Took: %timetaken% sec.
C:\Users\Poojan\Desktop>time_copy.bat
1 file(s) copied.

Took: 77.34 sec.

That’s a 1751164811 byte file, so that’s 21.59 MiB/s. To receive:

@echo off

set starttime=%TIME%
set startcsec=%STARTTIME:~9,2%
set startsecs=%STARTTIME:~6,2%
set startmins=%STARTTIME:~3,2%
set starthour=%STARTTIME:~0,2%
set /a starttime=(%starthour%*60*60*100)+(%startmins%*60*100)+(%startsecs%*100)+
(%startcsec%)

:TimeThis
copy \\SERVER\Downloads\FreeBSD-9.0-RELEASE-amd64-dvd1\FreeBSD-9.0-RELEASE-amd64-dvd1.iso  C:\Users\Poojan\Desktop
set endtime=%time%
set endcsec=%endTIME:~9,2%
set endsecs=%endTIME:~6,2%
set endmins=%endTIME:~3,2%
set endhour=%endTIME:~0,2%
if %endhour% LSS %starthour% set /a endhour+=24
set /a endtime=(%endhour%*60*60*100)+(%endmins%*60*100)+(%endsecs%*100)+(%endcsec%)

set /a timetaken= ( %endtime% - %starttime% )
set /a timetakens= %timetaken% / 100
set timetaken=%timetakens%.%timetaken:~-2%

echo.
echo Took: %timetaken% sec.
C:\Users\Poojan\Desktop>time_recv.bat
1 file(s) copied.

Took: 109.23 sec.

This is a 2,388,531,200 byte file, so that’s 20.85 MiB/s.

I’ll repeat these later, when the csup is done–just in case the download on the server is hurting things.

OK: it’s done. Re-running:

C:\Users\Poojan\Desktop>time_recv.bat
1 file(s) copied.

Took: 52.72 sec.

C:\Users\Poojan\Desktop>time_recv.bat
1 file(s) copied.

Took: 43.23 sec.

So, that’s 43.2 MiB/s and 52.69 MiB/s. Trying it again, I get 42.09 MiB/s.

C:\Users\Poojan\Desktop>time_send.bat
1 file(s) copied.

Took: 73.38 sec.

C:\Users\Poojan\Desktop>time_send.bat
1 file(s) copied.

Took: 71.85 sec.

So, these are a bit more consistent: 22.76 MiB/s and 23.24 MiB/s.  Running it a third time gives 16.4 MiB, but I was running gstat, top, etc. while that was going.

Set up vimage/vnet jail on FreeBSD 8.2

08-Jan-12

With epair, there are two interfaces created epair0a and eapir0b that are direct connections between each other (like an Ethernet cable). When used with jails using an ifconfig vnet command, one side (epair0b for example) sgoes inside the jail. Since the other side of this virtual direct-connection stays on the outside of the jail, the epair pairs act as an Ethernet tunnel inside/outside the jail. You can use firewall rules either outside the jail or inside the jail to control traffic.

More…

ZFS performance metrics with iozone

26-Dec-11

I ran iozone on many different ZFS pool configurations, to get an idea of which drives are best for L2ARC (cache) and the ZIL. I also wanted to get an idea of whether using gpart affects performance.

The configurations shown in the tables below have the formation [cache]_[gpart/gnop]_[zil]. Where [cache] is the L2ARC type. [gpart/gnop] says whether it’s set up under gpart, or direct. I call the direct method gnop since I have to initially use gnop to force a 4K sector size (I’m using the Western Digital Advanced Format drives for my pool). When I use gpart, I layer gnop on top of the initial creation to force 4K sector size. [zil] specifies the ZFS intent log device.

The disk types are:

Sandisk-2x8GB: these are two 8GB SATA SSD’s connected to the same controller (a PCI SATAII controller).
STT-2x8GB-usb: these are two USB 3.0 8GB drives connected to USB 2.0 ports.

I ran iozone using the command iozone -a -g 8G, and then looking only at the file sizes 1G or above. I have the whole results to make sure nothing funny happens for smaller file sizes. The results below are the average over all file sizes 1G or above and all record sizes performed at those file sizes.

Config Writer Re-Writer Reader Re-Reader Random Read Random Write Backward Read Record Rewrite Stride Read Fwrite Re-fwrite Fread Re-fread
STT-2x8GB-USB-cache_gnop_no-zil 75582 68640 57186 48690 35297 67435 43228 1018166 38217 68893 67935 53560 44769
SanDisk-2x8GB-cache_gnop_no-zil 76220 71511 73913 76134 72732 70053 60786 1001725 75326 69631 70712 67502 70613
corsair-16GB-usb-cache_gnop_no-zil 76683 72090 57963 49971 36033 68870 44593 1028012 37445 69079 71713 55417 46366
no-cache_gnop_no-zil 78223 72358 77134 78507 45160 67282 54004 1002780 44819 69790 70766 73954 72714
Kingston-64GB-sata-cache_gnop_SanDisk-2x8GB-zil 60654 53490 84669 93001 94166 60960 68226 1048091 88588 54835 54295 83393 90911
Kingston-64GB-sata-cache_gnop_no-zil 77465 72126 85473 93171 94973 69970 62113 995109 95945 71804 72567 75761 82436
Kingston-64GB-sata-cache_gpart_SanDisk-2x8GB-zil 60144 55071 87213 94107 95649 59756 65990 1012787 86949 55410 55610 83307 91718
Kingston-64GB-sata-cache_gpart_no-zil 76406 72145 82577 90769 92336 70305 64775 1019952 97475 72893 72343 75447 85428

I also computed the delta in bandwidth for a re-action versus action. For example, Delta Re-Write is throughput of re-write – throughput of write.

Config Delta Re-read Delta Re-Write Delta Re-fwrite Delta Re-fread
iozone_STT-2x8GB-USB-cache_gnop_no-zil -8495 -6941 -958 -8791
iozone_SanDisk-2x8GB-cache_gnop_no-zil 2220 -4709 1081 3111
iozone_corsair-16GB-usb-cache_gnop_no-zil -7991 -4593 2634 -9051
iozone_no-cache_gnop_no-zil 1372 -5865 975 -1239
iozone_Kingston-64GB-sata-cache_gnop_SanDisk-2x8GB-zil 8331 -7164 -539 7517
iozone_Kingston-64GB-sata-cache_gnop_no-zil 7697 -5338 762 6674
iozone_Kingston-64GB-sata-cache_gpart_SanDisk-2x8GB-zil 6893 -5072 200 8410
iozone_Kingston-64GB-sata-cache_gpart_no-zil 8192 -4260 -550 9980

Despite some things I’ve read, USB 2.0 devices can adversely affect the performance. One can see that many cases with the USB devices used as caches, the re-read delta is 8MBps slower.

Another curiousity is that the ZIL devices actually slow things down for writes (and re-writes). I’m not sure if iozone uses synchronous writes, but I did see that the ZIL devices had activity during the tests, so I must conclude that something is going on there. Since I’m using this mostly as a Samba server, I’m probably going to skip the ZIL in my setup.

Creating static adaX mappings for FreeBSD drives

17-Dec-11

I recently had a problem with ZFS. I went back to not using glabel, mainly because I wanted to force 4KB sector alignment on my drives and therefore used a gnop trick. About a month after doing so, I shuffled my drives around. I had ada4 and ada5 set up in a mirror configuration. At some point, I moved a drive around and ada4 became ada3 and ada3 became ada2. I could have (and should have) used the methods below to re-assign ada3/ada4 to their right positions. Anyway, I’m doing it now.

More…

USB 3.0 (SuperSpeed) flash/SSD drive tests

15-Dec-11

I ran these on my (8GB RAM) Sandy Bridge Core i7-2600K (not overclocked) H67 machine. I compared a newly bought USB 3.0 16 GB drive to an internal Kingston SATA and a previously purchased 8GB USB 3.0. I also compare the USB 3.0 drives to their performance with USB 2.0 port speeds.

More…

Putting current directory in xterm/rxvt title

09-Dec-11

From http://www.ibiblio.org/pub/Linux/docs/HOWTO/Xterm-Title

Here’s mine (tcsh):

switch ($TERM)
  case "xterm*":
  case "rxvt*":
  case "screen*":
    set prompt="%{\033]0;%n@%m:%~\007%}tcsh%# "
    breaksw
  default:
    set prompt="tcsh%# "
    breaksw
endsw

Instead of casing screen, I should probably check for $DISPLAY. Someday.