SMB vs AFP - which to use and why are they so slow?

Discussion in 'macOS' started by Anuba, Sep 3, 2009.

  1. Anuba macrumors 68040


    Feb 9, 2005
    Here's the deal...

    I have a QNAP TS-209 Pro, a NAS drive that's a bit of a swiss army knife that can handle WINS, AppleTalk, NFS, Bonjour etc. It's a relatively fast unit with gigabit ethernet, I get about 11-12 MB/s without using Jumbo frames and I'm OK with that.

    When I access it via Windows (in Boot Camp on my MBP) it's always lightning fast via both WiFi and, obviously, ethernet. Browsing it is instantaneous like it was a local drive. If I double-click on a folder, the Explorer window is filled with content in a matter of milliseconds. You won't know it from a local drive until you start some big file transfer.

    But when I'm in OS X it's kind of slow. It's not an issue of network speed (I get rougly 160 Mbps with Airport in both Mac and Windows). The lagging manifests itself in different ways depending on protocol:

    If I use SMB, navigating the folders is relatively snappy. Not as quick as in Windows, but still. Except when I go into a folder with a large number of files, then I have to wait forever staring at an empty Finder window before the file list appears. And copying to and from the drive is horrible, if I drag some large folder to my desktop I can basically go out to lunch while OS X is "Preparing to copy NN,NNN files". Once this infernal file counting is over, however, the actual copying is as fast as on Windows.

    If I use AFP, navigating the folders is universally laggy. If I double-click on a folder with 10 subfolders, it takes about 3 seconds before I see them. It's kind of like browsing a remote FTP rather than a local NAS drive. On the other hand, the delay doesn't increase if there's a large number of files, like with SMB. It's the same 3-second delay no matter if there's one or a thousand files in the folder. Also, the "Preparing to copy..." part is much faster, it takes a coffee break but not an entire lunch like it does with SMB.

    Is there any way to, um, make it suck less by optimizing something somewhere? Basically I'd like the navigation snappiness of SMB but without the insane delays when there are many files in a folder, and without "Preparing to copy..." moving at snail pace.
  2. rpp3po macrumors regular

    Aug 16, 2003
    Get Snow Leopard. This has improved a lot since earlier OS releases (the biggest improvement was Leopard). Over Gb ethernet I get near local behavior for remote SMB shares. AFP performance has usually never been a problem at least since Panther. Your NAS might do the required bookkeeping for AFP in realtime instead of precomputed as intended, so AFP performance might be bad because of that. Either get a better NAS (for AFP) or a newer OS (for SMB).
  3. Anuba thread starter macrumors 68040


    Feb 9, 2005
    I am on Snow Leopard... I'm seeing no difference from Leopard in terms of network performance, regardless of whether the NAS drive is involved.

    You might be on to something with the NAS drive doing the bookkeeping on the fly, though. On the other hand, looking at the totality of it all this NAS drive is fantastic and beats the crap out of all the Lacie, Netgear, Maxtor and other garbage I've tried over the years, so I'm not going to replace it just to please OS X. It might be that QNAP haven't focused very much on Macs before, they probably just threw in something that worked... it might improve with future firmware updates.
  4. masc88 macrumors newbie

    Sep 5, 2009
    Same here, opening a smb shared folder containing ~2500 subfolders takes ~7 seconds, while it opens in ~1 second on linux and even windows.

    The performance is equally sluggish using nfs and afp as well. (all services hosted on linux)

    I was also hoping snow leopard would improve in this respect, but in fact it got worse. Smb performance didn't improve at all, plus now I have additional occasional delays when opening folders of ~5 seconds, even with small ones.

    Maybe it's finder loading all file attributes synchronously, when comparing performance with shell commands 'ls' and 'ls -al' long listing takes as long as finder, while plain filename list with ls much faster.

    Still, even 'ls -al' on a much slower linux client is more than twice as fast than accessing the same smb share on my xeon mac.
  5. gorjan macrumors 6502

    May 16, 2009
    My NAS supports both AFP and NFS. Which is best for an MBP running SL? Right now I use AFP and it works great, but would I see any advantage if I were using NFS?
  6. Daveoc64 macrumors 601

    Jan 16, 2008
    Bristol, UK
    The only improvement I've seen in Snow Leopard with SMB is that servers now seem to appear in the Finder more reliably. In Leopard, they used to only appear some of the time.

    It is very slow still.
  7. rpp3po macrumors regular

    Aug 16, 2003
    If this only occurs with large amounts of sub-directories my guess would be that OS X doesn't do client side caching of remote state and reads complete directories again with each access. From a viewpoint of consistency this is very good. Client side caching can lead to issues where the local cached representation is out of sync with the remote state, when things are changed on the remote server by someone else. When you get < 1 sec access times for thousands of files with Windows and Linux, there's obviously caching involved. Things can be improved in two ways, enable client side caching on OS X (I don't know if Apple's autofsd interface allows this) or make the server cache directory state in RAM, which should be almost as fast but without concurrency issues.
  8. jmpage2 macrumors 68040


    Sep 14, 2007
    I have noticed somewhat similar things. I run an EX485 and use SMB to connect my Snow Leopard box to it. The EX485 basically runs a tweaked Windows Server 2003 OS (Windows Home Server).

    It's a bit pokey to open up directories, especially ones that have large numbers of subdirectories in them. It will say 'connecting' for several seconds when clicking on a folder, even if that connection is already present and active.

    File transfer speeds are good, it just seems as though the finder really struggles with the SMB connection.

    Another thing that started happening in 10.5.8 and still happens in 10.6 is that all of my 'mapped' (startup items) SMB drives pop up finder windows when I initially log into the machine. This happens even though I have checked the 'hide' box on the start up items. It's pretty annoying, considering I have about eight shares mapped this way. Nothing like getting to run around closing eight windows at start up time.

    I was actually surprised to see these SMB issues continue in 10.6, I had always assumed that Apple simply used a really old, slow and somewhat crappy SMB stack in Leopard and it would be updated in conjunction with their Exchange integration efforts under 10.6.

    Apparently it's still slow and crappy, at least based on my experiences.
  9. Daveoc64 macrumors 601

    Jan 16, 2008
    Bristol, UK
    I'm pretty sure that Mac OS X does do client side caching.

    My very basic server uses an external hard drive (which is set to sleep after 10 minutes of inactivity), yet Mac OS X is able to view the contents of the drive before it spins up again (and it is sometimes out of date).
  10. calderone macrumors 68040


    Aug 28, 2009
    Just curious, are you connecting via the IP address?
  11. dpw2atox macrumors newbie

    Jun 30, 2009
    One option is to try and manually install a new version of Samba.

    I'm not sure of the exact steps but you would have to compile this version, disable your current version, then install it and set it to startup. That should greatly improve your performance probably more than anything else you do.

    I'm really not sure why Apple decided to do a minor samba update with SL.
  12. Anuba thread starter macrumors 68040


    Feb 9, 2005
    Yes, opening such directories can be a pain but the worst part as far as I'm concerned is the insane amount of time it takes to count all the files before the copying can start.

    For example I purchased a download version of Adobe CS4, and Adobe can't be arsed to make archives, instead they insist on keeping all the files separate in the installer. Gazillions of HTML documents for the inline help... The CS4 Web Design Premium installation folder consists of 51,000 files(!?!). When I copied it from the NAS, the "Preparing to copy..." phase took much longer than the actual copying. It was like watching paint dry.

    Preparing to copy 104 files... long pause.
    Preparing to copy 493 files... long pause.
    Preparing to copy 741 files... long pause.
    You get the idea.

    10.5.8, really...? The thing with checking "Hide" is, it never worked up until some late version of Leopard, probably 10.5.5 or later. Those Finder windows popped up in Tiger and several versions of Leopard. I couldn't believe my eyes when "Hide" finally worked on auto-mounted NAS shares. But then when I installed SL the damned windows were back again. I do not, however, recall seeing it in 10.5.8.
  13. Orava macrumors newbie

    Jan 13, 2010
    Did you find a solution?

    Hi, I'm experiencing exact the same with exact the same NAS. It's an old thread though, curious you found a solution?
  14. AndyfromTucson macrumors member

    Jan 10, 2010
    I had similar issues with SMB shares I connect to over a VPN and I believe the problem is actually with Finder, and not Mac OS X itself. The reason I think this is because when I use an alternative file manager (muCommander) remote folders load snappily (1 second to open a folder with dozens of subfolders as compared to who-knows-how-long-because-I-gave-up with Finder).

    The real irony is the muCommander is a Java app, so you would think it would be more sluggish than Finder; but in fact it's the opposite.
  15. ovrdrvn macrumors member

    Dec 10, 2003
    NAS with SMB

    I bought a NAS unit that is supposedly fine with Macs. It has iTunes server support but not AFP. The speed of browsing shares is not great and copies are OK but nowhere near the gigabit speeds (even tried jumbo frames). I get slight stutters in audio/video from it rendering the unit annoying if not totally frustrating at times.

    What I wouldn't give for a fix for this!
  16. mikeyp69 macrumors newbie

    May 18, 2010
    This is a problem that I am experiencing too. I have an Icybox NAS4220. It is lightning fast on Windoze, but pig slow on Max OSX. Admittedly it is better on Snow Leopard, but compared to Windoze it is still pants. Navigating directories is awfully slow and tedious; lots of waits !

    I have been a user of Windoze since 1992, and made the leap over to Mac World 2 yrs ago with a MacBook Air. Having used the Mac intensively for this period, I am so dissappointed with its networking performance. It is like networking is an afterthought; I work in IT as an Enterprise Architect so know a thing or two about this topic...

    I find the reference earlier in this thread to downloading and compiling a new version of SMB quite amusing. Who'd have thought you'd have to be a nerd to get networking to work in a Mac? It should just work right? After all, that's they selling point of a Mac over Windoze isn't it !
  17. belvdr macrumors 603

    Aug 15, 2005
    Could this having anything to do with OS X generating thumbnails for each object?
  18. ZachMatthews macrumors newbie

    Mar 15, 2006
    Has anyone ever found a solution for this problem?

    I am getting brutally slow response times and especially file copying speeds on my HP MediaCenter NAS since upgrading to Snow Leopard.

    It takes me about a minute to upload a couple gig CF card from my camera to my computer via USB.

    It can take over twenty minutes to move the same data out to the NAS via SMB over allegedly gigabit ethernet.

    My switch is showing a gigabit connection between both the NAS and the iMac. (It has different colored lights).

    I am literally getting less than 10k/sec. transfer speeds. That is just brutal.

    Can anyone recommend anything? I tried switching from Finder to a third party browser and it did speed things up at first, but after the first gig or so of a big transfer my speeds drop way back down.

    Could this be something physical like a bad wire? I tried a direct connection to the NAS but the iMac never saw it.

    My system has a switch behind an Airport Extreme base station, which is hooked to a cable modem. My iMac is hooked to the switch via CAT-5 and so is my NAS. Three other computers hook in via wireless to the Airport Extreme.

    Am I possibly getting some kind of packet collisions? How do I vet that?


  19. ovrdrvn macrumors member

    Dec 10, 2003
    Vendor offered to take back unit...

    But this is not the answer. There is absolutely an issue with Macs and NAS units over ethernet. I wish some forum somewhere would be answered by an Apple rep. You plug any of these units into a Windows box and they perform far better. I'm a Mac fan, stock holder and an IT professional so no dissing Apple on this. Just would like an honest response.
  20. KyleSal macrumors newbie

    Aug 17, 2010
    Same issue as everyone else...

    My company purchased 11 new 27" inch i7 iMacs with 4GB of RAM running Snow Leopard 10.6.4. All machines are bound to Active Directory and connected to a gigabit blade in our network closet.

    Our problem is slow browsing between folders on mounted Windows servers. We sometimes see a 3-15 second delay when only trying to show the contents of a folder with 100 items in it. It works instantly on a Windows machine but it seems Finder just slows down.

    We moved from a bunch of G5's running 10.4.11 and they had no network issues, they were just old and needed to be replaced. We thought the new iMacs would do the trick but it seems they are slower browsing the network then the old G5s! I blame it on something in Snow Leopard and wish Apple would acknowledge the problem as well.

    We have tried a few suggestions from since they have quite a large community following this issue as well but we haven't found a solution yet.

    We will soon be opening an enterprise ticket with Apple if we cannot find a solution on our own, but still hoping we won't have to.

    Anyone find a solution to this yet??
  21. ae3265 macrumors member

    Feb 3, 2009
    Some observations from my usage...

    The biggest use of networking for me is I mount my media files from my server (SL) to my mini running plex. I also routinely copy backups of my virtual machines (up to 50gb) over the network to my server. Finally, I have Samba shares for Windows clients so I can make my media available to guests.

    First off, I use NFS (automounted) for the media sharing. The biggest advantage is that I can pause a video and reboot the NFS server and once it's back up, I can resume play. With AFP, Plex stops the video and I have to restart it.

    On the Samba side, I do D/L and compile from Mainly to stay up with the bug and security fixes. I'm still on v3, haven't poked around much at v4.

    AFP handles most of the Mac to Mac sharing.

    One thing that made a huge difference in my performance was getting a better class router and switches. I opted for the Netgear 3205 wireless router and I have some of the ProSafe manged low-end Gigabit switches. Compared to the previous D-Link consumer grade Gigabit gear, it's a very noticeable difference. I've also got good CAt5e/Cat6 cables. For the most part, the consumer grade gear just can't switch the packets fast enough to keep up with heavier usage. Going to the SOHO level really does help.

    Other than that, I do notice that Finder in particular, takes longer to browse directories. I think the issue is more with Finder than it is with any of the Protocols. I do notice that command line, I see no differences between OS X, Linux, Solaris, AIX or Windows Explorer. Not that there aren't any, just at the CLI level, I don't think it's enough to notice too much.

    That being said, the Server is SL, and the major media drives are FW800. So for the most part, wired performance, even in Finder is quite adequate and not too shabby over Wireless 11G.

    As for choices of protocols, I think the major factor are your needs. NFS for Media sharing to Plex. SMB if you need to talk to Windows and it appears for me that AFP handles the Mac environment decently enough.
  22. mBox macrumors 68020

    Jun 26, 2002
    Running Leopard Server at work on a G5 XServe.
    The AFP side has been stable but not as robust as SMB.
    We use Intel Mac Pros on AFP and pretty high-end (3D Workhorse) PC's for SMB.

    On another note (sorry to hijack) concerning QNap NAS.
    I have the option to use a Windows Media Centre like Server for file sharing.
    Would I gain speed with that over any NAS?
    The only bonus I find with QNap is the iTunes and other Mac related (app) connections :)
  23. Dewdman42 macrumors member

    Jul 25, 2008
    I stumbled on a solution on another forum. No kidding, this miraculously will solve the flow SMB folder browsing problem. It did on my macbookpro, but I don't know why

    basically you just turn on Internet Sharing. You can even turn the Airport back off, leaving Internet Sharing on, and it still works. Browsing the SMB folders is lightening fast after that.

    You should also consider using muCommander, Pathfinder or some alternative to Finder, because it appears that Finder is the thing having the problem, those others don't seem to suffer.

    If that doesn't solve the problem, then there are many posts on the net about playing with ACK delays and stuff like that...dunno... Apple should have fixed this a long time ago.
  24. stdout macrumors newbie

    Sep 24, 2010
    I was pretty skeptical about that suggestion, but I tried enabling Internet Sharing and it made a dramatic difference in the speed of listing directories on SMB shares from Finder for me. E.g. browsing to a directory with a dozen files would take ~15 seconds, and now it is virtually instantaneous.

    Anyone have any thoughts as to why this works? I'd rather fix the root cause rather than have Internet Sharing needlessly enabled.
  25. ovrdrvn macrumors member

    Dec 10, 2003
    No Luck

    This last suggestion made no logical sense to me but I figured no harm in trying. Internet sharing did not speed up access to my NAS at all. Also, the suggestion that Path Finder or an alternate Finder would make it instantaneous also didn't work here (and via the way those programs have to use the Mac's resources/daemons it also make no sense that they would alleviate the problem). I wonder if anyone with access to the Mac enterprise/business group (pay service) might pose this....anyone on this board have access?

Share This Page