Samba Performance


151 posts   Page 3 of 7   1, 2, 3, 4, 5, 6, 7
by wpns » Tue Oct 09, 2012 11:24 pm
On big files I can get around 3 MB/sec using scp, so it's 50 percent faster than my ReadyNAS, but "performance" and "Raspberry Pi" really shouldn't be used in the same sentence.

My Linux boxes with AMD x4 3GHz CPUs and 4 or more gig of RAM with WD Green hard drives get 35MB/s, and my Promise Pegasus array on my Mac Mini is about twice that, so I love my RPi (and hate my ReadyNASes), but it's not a useful SMB server...
Posts: 63
Joined: Sat Sep 01, 2012 2:50 pm
by scales11 » Wed Oct 10, 2012 1:38 am
Well I would never compare it to a full out desktop...thats just not a fair comparison.

I am more interested in the functionality/reliability/usability of it as a NAS.
Posts: 17
Joined: Tue Oct 09, 2012 2:54 pm
by wpns » Wed Oct 10, 2012 1:30 pm
I've generally found that the reliability of a NAS share is as reliable as it's drives, so RAID is the way to go unless you have other local backups. Looks like mdadm loads on Raspian, FWIW, but then there's that performance thing again...

OK, so grab a couple of 1TB USB drives and connect them to a hub and thence to the RPi

apt-get install mdadm
mdadm --create --level=mirror --raid-devices=2 /dev/md0 /dev/sda /dev/sdb
mkfs -t ext4 -v /dev/md0
mkdir /mnt/raid
mount /dev/md0 /mnt/raid
df -h
[...]
/dev/md0 917G 200M 870G 1% /mnt/raid

apt-get install samba
[Really ugly and insecure smb.conf, don't use this unless you are on a LAN, with no port forwarding to this machine, and you trust everyone on your LAN. Do as I say, not as I do. 8*]
----------------
[global]
workgroup = RaspberryPi
server string = RPi
local master = no
domain master = no
preferred master = no
password server = None
guest ok = yes
guest account = root
security = SHARE
dns proxy = no

[RPi-system]
path = /
guest ok = yes
writeable = yes
create mask = 0777
---------------------------

service samba restart

Now you can copy files in and out. [Wait for /proc/mdstat to show completion before testing for speed, a couple of days(!) at my current rate.]

Hmm, actually, I wrote a 1.75G file in 4:00 minutes, so 7.5MB/sec, not awful.
Read it back in 3:45, so almost 8MB/sec, lots faster than my (2MB/sec, no wait, it's dropped to 1.44) ReadyNAS....

More benchmarks after the sync completes, but it's usable....

[This is a pretty basic Raspian with Turbo enabled, the chip gets pretty warm....]
Posts: 63
Joined: Sat Sep 01, 2012 2:50 pm
by wpns » Sat Oct 13, 2012 3:08 pm
OK, did some more benchmarking once the sync was done, and it made no real difference:

7.8MB/sec read
7.25MB/sec write

Just realized that's not awful for a $300(or less), 1TB RAID array.
Posts: 63
Joined: Sat Sep 01, 2012 2:50 pm
by tbar » Sun Oct 14, 2012 8:47 am
@wpns: have you read some of the earlier posts in this thread? There are described some ways to get a bit more performance. OC is one way but there are some configs you can use in the samba config file which can improve performance.
Posts: 98
Joined: Thu Nov 24, 2011 6:10 am
by wpns » Sun Oct 14, 2012 11:05 am
Well, there are always optimizations, but they will never close the gap between a $300 NAS drive that'll do 8-ish MB/sec and my usual $650-ish NAS boxes that'll do 45MB/sec. (In fact, on a 100 megabit network, you'll never do better than 12 MB/sec.)

But the implied metric of $/MB/Sec is a silly one, it depends on what you need it for, and how much you have to spend. If you don't care about RAID, and you don't need a terabyte, and you have some bits lying around, you can build a NAS box for under $100. Just the barebones chassis for the Shuttle boxes I build my NAS boxes on is $200.

The amazing part of this is how quickly and easily you can build a NAS box using a RPi with usable performance! [OK, so I take back my statement that you can't use RPi and performance in the same sentence.]
Posts: 63
Joined: Sat Sep 01, 2012 2:50 pm
by scales11 » Fri Oct 26, 2012 11:07 pm
So now that the drivers for the PI are open source, does this mean we could get better usb performance?

I tried using a "distro" called squeezeplug on the pi. It is pretty impressive and easy to use. Unfortunately, I was not getting speeds better than 3-5Mpbs..

here is the distro:
http://www.squeezeplug.eu/
Posts: 17
Joined: Tue Oct 09, 2012 2:54 pm
by abishur » Sat Oct 27, 2012 3:24 am
scales11 wrote:So now that the drivers for the PI are open source, does this mean we could get better usb performance?

I tried using a "distro" called squeezeplug on the pi. It is pretty impressive and easy to use. Unfortunately, I was not getting speeds better than 3-5Mpbs..

here is the distro:
http://www.squeezeplug.eu/


Actually, the USB drivers have always been open source. The only thing that have opened up are the GPU "drivers" that reside in the CPU userland (and since that was the only thing that was closed means the CPU stuff is 100% open source now ;-) )
Dear forum: Play nice ;-)
User avatar
Forum Moderator
Forum Moderator
Posts: 4279
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
by scales11 » Mon Oct 29, 2012 12:57 pm
I just put Arch on my raspberry pi. I figured that if I started with the minimal install and then added samba myself, I would get better performance since there was less overhead. So after setting samba up via ssh, it would appear that I was wrong. My speeds are less than 3Mbps when transferring several 10x400mb files from my windows 7 64bit machine. I have my external NTFS hdd connected via usb. It seems that others got slightly better performance with ext3 or ext4, but I was not sure if it was really that big of a difference.


Any one have any suggestions on how I could get better performance? Is there a minimal debian setup I could try?
Posts: 17
Joined: Tue Oct 09, 2012 2:54 pm
by scorpion_tr » Mon Oct 29, 2012 1:02 pm
You must convert file system to ext 3 or 4. NTFS is a very big bottleneck.
Posts: 18
Joined: Wed Jul 04, 2012 1:37 pm
by scales11 » Mon Oct 29, 2012 1:05 pm
scorpion_tr wrote:You must convert file system to ext 3 or 4. NTFS is a very big bottleneck.


OK, will do. I am just re-reading this thread, seems like everyone else was doing that...sorry.

EDIT:

WOW big change indeed. With ext4 I am at almost 7Mbps. I would like to eek out a little more, but this certainly is a good start.
Posts: 17
Joined: Tue Oct 09, 2012 2:54 pm
by bascule » Thu Nov 01, 2012 10:59 am
I was getting 2.5 to 3MBs on my ntfs setup using squeezeplug. jusf set squeezeplug 5 up on my other pi with an external drive as ext4 and now i get 7.8 to 10. Chuffed would be an under statement.
- learning the hard way. Who needs to walk when running is more fun
Posts: 11
Joined: Tue May 29, 2012 1:25 pm
by tbar » Sat Nov 03, 2012 9:02 am
Just tried installing NFS on RPi and NFS Client for Windows. I'm getting write speeds at approx 5.4 MB/s and read speeds at approx 7.5 MB/s. Tried the same with a virtual Linux-server on the same Windows computer which gives write/read speeds at approx 6 MB/s / 6.7 MB/s.

SMB on the same computers gives write/read speeds at approx 9.5 MB/s / 9 MB/s.
Posts: 98
Joined: Thu Nov 24, 2011 6:10 am
by nginx » Fri Dec 21, 2012 5:58 am
Got my pi over a week ago. Took a while to set it all up but now its working brilliantly as a standalone NAS and bit-torrent client.

With NTFS I was getting read speeds around 5MB/s and abysmal write speeds around 2MB/s. I then formatted all three of my 1TB externals to ext4 and all of a sudden I am getting write speeds of 10.4MB/s and read speed around 6-7 MB/s. A bit surprised that the read speed is slower than write but I think a few other users here experienced the same. Anybody knows the reason? I am running on stock speed, no overclocking.

Just a heads up for those of you who are experiencing speeds less than 1MB/s. It could be because of your USB hub. Initially I was getting around 200-300KB/s read & write when the drives were connected to my Belkin 7 port powered hub. The problem was two fold. One, the mini USB cable from the hub to the pi was too long and kept dropping data packets. Second, I learned that only the last 4 ports on my hub can deliver full speed. Took a lot of trial and error to get to the bottom of all the speed issues. So I hope this information helps someone.
Posts: 41
Joined: Sun Dec 09, 2012 2:35 pm
by emajko159 » Fri Dec 21, 2012 8:41 am
How you can get so fast speed? I have 1.2 mb/s in ntfs and 3.5mb/s in ext4...:-(
Posts: 8
Joined: Mon Aug 13, 2012 5:24 pm
by tbar » Fri Dec 21, 2012 8:47 am
emajko159 wrote:How you can get so fast speed? I have 1.2 mb/s in ntfs and 3.5mb/s in ext4...:-(

Are you using external USB HDD or internal SD Card?
Posts: 98
Joined: Thu Nov 24, 2011 6:10 am
by emajko159 » Fri Dec 21, 2012 8:50 am
Internal sata hdd over sata to usb converter.
Posts: 8
Joined: Mon Aug 13, 2012 5:24 pm
by tbar » Fri Dec 21, 2012 8:59 am
emajko159 wrote:Internal sata hdd over sata to usb converter.

What kind/brand of sata to usb converter? Have you tried using it in another setup (Windows)?
Posts: 98
Joined: Thu Nov 24, 2011 6:10 am
by emajko159 » Fri Dec 21, 2012 9:03 am
The converter is not causality. In my desktop pc have speed about 34MB/ what is aproximately maximum of usb 2.0.
Posts: 8
Joined: Mon Aug 13, 2012 5:24 pm
by nginx » Tue Dec 25, 2012 7:55 am
emajko159 wrote:How you can get so fast speed? I have 1.2 mb/s in ntfs and 3.5mb/s in ext4...:-(


Your drive has an external power adapter right? And you are not using a USB hub right? If that's the case then its baffling to hear you only getting 3.5MB/s with ext4. :? With NTFS its forgivable since the driver is not very efficient. Just to troubleshoot you can try a different ethernet cable between the Pi and router. Don't use wireless at any cost. Update Raspbian. Also make sure the USB cord of your hard drive is not too long. I changed my hub's usb cable to one that is just a feet long. These little things matter because the Pi's usb ports only provide 100mA instead of the regular 500mA.

I am getting 10.5 MB/s for all three 1TB drives connected to the Pi with CPU usage only around 50-60%. I wish the Pi had gigabit ethernet because I'm sure it can write 15-18 MB/s with 100% cpu.
Posts: 41
Joined: Sun Dec 09, 2012 2:35 pm
by emajko159 » Tue Dec 25, 2012 11:17 am
My usb cable is short - 30 centimeters. I am using powered USB hub. I use ethernal cable. wifi not. In my home network I can have speed about 10,8MB/s. As operating system I am using squeezeplug in newest version.
Posts: 8
Joined: Mon Aug 13, 2012 5:24 pm
by Bliepo » Wed Dec 26, 2012 2:09 pm
Hello everyone!

First off, I found this thread because I ran into some performance issues with samba myself (turned out to be the wireless). I now have speeds of about 10MB/s and because I read a lot of people are having performance issues, I decided to share as much details about my configuration as I can, in hope that this will be of help for people with bad performance.

First off, I am using the 2012-12-16 raspbian wheezy hard float image (http://www.raspberrypi.org/downloads). It's overclocked using the raspi-config tool (turbo option, so 1000MHz ARM, 500MHz core, 600MHz SDRAM, 6 overvolt).

Info about the hard drive using hdparm -I:
Code: Select all
 sudo hdparm -I /dev/sda

/dev/sda:

ATA device, with non-removable media
        Model Number:       Hitachi HDS721010CLA332
        Serial Number:      JP2940HD26YMKC
        Firmware Revision:  JP4OA3EA
        Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6; Revision: ATA8-AST T13 Project D1697 Revision 0b
Standards:
        Used: unknown (minor revision code 0x0029)
        Supported: 8 7 6 5
        Likely used: 8
Configuration:
        Logical         max     current
        cylinders       16383   16383
        heads           16      16
        sectors/track   63      63
        --
        CHS current addressable sectors:   16514064
        LBA    user addressable sectors:  268435455
        LBA48  user addressable sectors: 1953525168
        Logical/Physical Sector size:           512 bytes
        device size with M = 1024*1024:      953869 MBytes
        device size with M = 1000*1000:     1000204 MBytes (1000 GB)
        cache/buffer size  = 29999 KBytes (type=DualPortCache)
        Form Factor: 3.5 inch
        Nominal Media Rotation Rate: 7200
Capabilities:
        LBA, IORDY(can be disabled)
        Queue depth: 32
        Standby timer values: spec'd by Standard, no device specific minimum
        R/W multiple sector transfer: Max = 16  Current = 0
        Advanced power management level: disabled
        DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6
             Cycle time: min=120ns recommended=120ns
        PIO: pio0 pio1 pio2 pio3 pio4
             Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
        Enabled Supported:
           *    SMART feature set
                Security Mode feature set
           *    Power Management feature set
           *    Write cache
           *    Look-ahead
           *    Host Protected Area feature set
           *    WRITE_BUFFER command
           *    READ_BUFFER command
           *    DOWNLOAD_MICROCODE
                Advanced Power Management feature set
                Power-Up In Standby feature set
           *    SET_FEATURES required to spinup after power up
                SET_MAX security extension
           *    48-bit Address feature set
           *    Device Configuration Overlay feature set
           *    Mandatory FLUSH_CACHE
           *    FLUSH_CACHE_EXT
           *    SMART error logging
           *    SMART self-test
                Media Card Pass-Through
           *    General Purpose Logging feature set
           *    WRITE_{DMA|MULTIPLE}_FUA_EXT
           *    64-bit World wide name
           *    URG for READ_STREAM[_DMA]_EXT
           *    URG for WRITE_STREAM[_DMA]_EXT
           *    WRITE_UNCORRECTABLE_EXT command
           *    Segmented DOWNLOAD_MICROCODE
           *    Gen1 signaling speed (1.5Gb/s)
           *    Gen2 signaling speed (3.0Gb/s)
           *    Native Command Queueing (NCQ)
           *    Host-initiated interface power management
           *    Phy event counters
           *    NCQ priority information
                Non-Zero buffer offsets in DMA Setup FIS
                DMA Setup Auto-Activate optimization
                Device-initiated interface power management
                In-order data delivery
           *    Software settings preservation
           *    SMART Command Transport (SCT) feature set
           *    SCT LBA Segment Access (AC2)
           *    SCT Error Recovery Control (AC3)
           *    SCT Features Control (AC4)
           *    SCT Data Tables (AC5)
Security:
        Master password revision code = 65534
                supported
        not     enabled
        not     locked
        not     frozen
        not     expired: security count
        not     supported: enhanced erase
        224min for SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 5000cca373df5877
        NAA             : 5
        IEEE OUI        : 000cca
        Unique ID       : 373df5877
Checksum: correct


/etc/samba/smb.conf:
Code: Select all
[global]
        server string = %h server
        map to guest = Bad User
        obey pam restrictions = Yes
        pam password change = Yes
        passwd program = /usr/bin/passwd %u
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        unix password sync = Yes
        syslog = 0
        log file = /var/log/samba/log.%m
        max log size = 1000
        dns proxy = No
        usershare allow guests = Yes
        panic action = /usr/share/samba/panic-action %d
        idmap config * : backend = tdb

[allusers]
        comment = All Users
        path = /home/allusers
        valid users = @users
        read only = No
        create mask = 0660
        directory mask = 0771

[homes]
        comment = Home Directories
        valid users = @users
        read only = No
        create mask = 0700
        directory mask = 0700
        browseable = No


The file system used is ext4. For every samba user, I make a seperate image file (using the truncate command followed by mkfs.ext4 and then editing the /etc/fstab file to make it mount in /home/username).

I am using a phone charger that can provide 1500mA of current, with the original cable.

The PC was connected to a router (fonera 2.0n) several meters long. The raspberry pi was also connected to the same router, using a cable that is about 20cm long (guestimate). The USB cable connecting the HDD is about 1.5 to 1.8 meters.

==================================
Here are some things I 'learned' and wanted to share, which might help:
- Wireless is very slow, even if you are using 802.11n. When I used wireless, I had speeds of 100kb/s if I was lucky. Using a LAN cable on the same device got me speeds of about 10MB/s.
- It is a good idea to use testparm to create your smb.conf file, as it checks syntax and also makes the file considerably shorter. This can be done using the following commands:
Code: Select all
sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.master
testparm -s /etc/samba/smb.conf.master | sudo tee /etc/samba/smb.conf

If you want to edit your configuration, simply edit smb.conf.master, instead of smb.conf and the rerun the command
Code: Select all
testparm -s /etc/samba/smb.conf.master | sudo tee /etc/samba/smb.conf

- Cable length does not seem to affect performance by much.

I will post back later to see how much overclocking and using wireless instead of LAN affects perfomance.
Attachments
sambaspeed.jpg
sambaspeed.jpg (44.37 KiB) Viewed 11887 times
Posts: 13
Joined: Sun Dec 23, 2012 11:29 pm
by Bliepo » Wed Dec 26, 2012 4:36 pm
Alright, just finished testing.
I tried to measure wireless speed the best I could, but it fluctuated quite a bit. At some points, I had speeds of around 50 - 100 kb/s. So to test the speed, I copied two files when the speed seemed stable. Note that both test were with the raspberry pi overclocked in turbo mode.

=============
Transfer 1 - wireless (overclocked in turbo mode)
File size: 337MiB
Time required for transfer: 197s
Average speed: 1,7MiB/s

=============
Transfer 2 - wireless (overclocked in turbo mode)
File size: 777MiB
Time required for transfer: 290s
Average speed: 2,7MiB/s

For the wired transfer, I copied a 10GiB file.
=============
Transfer 3 - wired (overclocked in turbo mode)
File size: 10340MiB
Time required for transfer: 1040s
Average speed: 9,9MiB/s

=============
Transfer 4 - wired (no overclock)
File size: 10340MiB
Time required for transfer: 1212s
Average speed: 8,5MiB/s
Posts: 13
Joined: Sun Dec 23, 2012 11:29 pm
by dschmelzer » Wed Dec 26, 2012 9:00 pm
Would be interested in knowing if a gigabit ethernet dongle hooked up to one of the USB ports would give better performance.
Posts: 3
Joined: Wed Jul 11, 2012 8:31 pm
by nginx » Tue Jan 01, 2013 4:13 am
A USB to Gigabit Ethernet dongle should be able to provide around 14MB/s unless some other bottleneck crops up which I'm not currently aware of. I have tested the real world transfer speed of the USB on the Pi to be around 28.7MB/s. Since USB is half duplex, the Samba transfer speed will be halved because it involves both read and write processes using the same bus, hence the 14MB/s figure.

Now I have to decide whether a whole 4MB/s gain is worth plonking down $20 for a USB Gigabit Ethernet dongle :D Then I have my doubts whether the driver will work or not but I guess the kernel can always be recompiled as long as the drivers are actually available for linux.
Posts: 41
Joined: Sun Dec 09, 2012 2:35 pm