The blog & portfolio of Matthew J. Rogers

Posts tagged ‘Windows’

NERD ALERT: This one’s going to be pretty bad. If you aren’t interested in servers, file protocols, and the geeky ability to access your files anywhere, turn away now.

Those who know me know I run a decently big file server at home. It’s an AMD system running Ubuntu Server with about 1.6 TB of hard drive space (that’s 1,600 GB). I store most of my stuff on that server — personal documents, client projects, web site development code, TV shows, movies, pictures, music, software backups, you name it. None of my Macs actually have any documents stored on them — it’s all on the server, which I depend on having access to wherever I go.

On the road, I typically would use the somewhat klutzy method of downloading files I need via FTP, working on them on my MacBook Pro, and then re-uploading them when I was done or when I got home again, to keep the server up to date (this excludes code, for which I use the Subversion version-tracking system). At home, I have until now used the Samba protocol (the file-sharing system native to Windows) to mount the shared directories and work on them directly over my gigabit network.

I recently had an epiphany about the way I was doing things. My Samba setup was a holdover from when I had all Windows boxes. I continued to use it when I moved to Macs because it pretty much works with everything — Linux, OS X, Windows. However, while compatible with many things, it excels at nothing. It is slow, it is limited to Windows filenaming conventions (UNIX/Linux is much more flexible about file names), it has an extremely limited permissions system, and it can’t really be used over the Internet — hence why I was using FTP while away from home to access my files, because using Samba through the Internet is about as fun as pulling your fingernails out with pliers. It’s just so slow, if you can get it to work at all.

Then I discovered AFP. Despite having had it operational for less than 24 hours, I think it’s safe to say that AFP has changed my life.

As I said, an epiphany: I suddenly realized I was using a Linux server, Mac OS X clients, and a file-sharing protocol that was native to neither of them. Hence, the slow performance. Of course, even on Windows (from whence Samba, in its modern form, hath sprung) most experienced networking engineers will tell you that file-sharing performance sucks. So I started to look at other options: NFS and AFP.

AFP (AppleTalk Filing Protocol) was introduced by Apple in the mid-1990s as a way for people to access shared files and printers over a local network or the Internet. I installed it (with SSL authentication) on my Ubuntu server using this guide and had everything up and running in less than 10 minutes.

File transfer benchmarksPerformance? Freaking awesome. I connected to my home server from work and was able to browse directories and open files incredibly quickly — and all using the native OS X Finder rather than a special program for FTP. The usage is no different from being plugged into my network at home, other than the speed of course, which while not as fast as being at home is still much faster than FTP or SSH over MacFUSE or something. I don’t have any benchmarks, but I’d compare it to using a USB pen drive. Keep in mind I’m accessing the server through 15Mb down/1.5Mb up cable Internet.

It also “just works” when it comes to permissions. With Samba, since it was born of Windows, and Windows doesn’t have a very robust (ok, pretty much nonexistent) file permissions system, there were all sorts of configuration settings you had to define to tell Samba which users could read/write which files. Also, those permission settings got applied to the whole mounted share…there was no way to fine-tune permissions within the share for specific users (as you can natively in Linux). Oh, and speaking of users, with Samba you had to specifically add Samba users on top of the Linux user accounts they already had on the server. It was a real pain. With AFP, after defining where my shares were (which was stupidly simple…two parameters per line: the folder path and the share name) I was able to connect to it with my regular account on that server, and the permissions on all the files were appropriately handled. No special user creation, no special settings. It was fantastically easy.

I’m not a network engineer, and I only took one network programming course in college, but it seems to me that AFP performs so well because:

  • It was designed from the start to work over large network “distances” — i.e., complex networks like the Internet
  • It integrates into TCP/IP at a low level, reducing overhead
  • It integrates into the operating system at a low level — access to files over AFP is handled the same way as local files, without going through a lot of special protocol translations (Samba)

AFP will change the way I work when I’m away from home. If I’m in a location with a decent Internet connection, I can just work on most files directly on the server at home through AFP. Even if I have to copy files to the laptop, because they’re huge or because I might not have Internet where I’m going, it’s still much more convenient (and faster) than using FTP. I left Samba running on the server because I do occasionally need access to those shares with Windows, but that has no impact on AFP performance. If you have a file server and you’re using OS X client computers, I strongly recommend setting up AFP. It’s made things go a lot smoother for me when I’m away from home, and even the performance when I’m directly plugged into my network is noticeably improved.