Intel Macs as Servers

I’ve been thinking about getting an Intel Mac to replace the old Linux box that serves this site. However, a lot of software hasn’t been ported yet, and Rosetta emulation is slow. How much server relevant software is yet native?

For this site there are five packages that matter enough to keep me from migrating:

  • Apache
  • Java (for Tomcat and other programs)
  • Ruby (for Rails)
  • MySQL
  • PHP

There are other programs that might matter to other people, but those five should cover everything I’m doing in the next few months. It helps that a lot of my software is interpreted and sits on top of Java, PHP, or Ruby. Of the stuff that isn’t, it’s all open source and written in C. Since Apple ships a native C compiler based on gcc, it should be possible to compile all this from source. However, sometimes that doesn’t quite work out. C is not Java, and is not always portable across operating systems and CPU architectures. For instance, a while ago I spent a few hours debugging a problem that turned out to be an incompatibility between the Rails MySQL connector and the 64-bit Mac OS X version of MySQL. In fact, it’s amazing most of this stuff is as portable as it is.

Let’s count down the list.

Apache

This should be an easy one. Apple ships the Apache 1.3 web server as a standard part of Mac OS X Tiger. But I prefer Apache 2 or even 2.2. What’s up with that?

The Apache Project only sporadically offers binaries for various platforms. Their Mac OS X binaries are about two years out of date. Presumably one can compile it from source, but I’m not sure. Anyone doing this yet?

Java

This is an easy one. Apple ships an X86 native Java virtual machine with every X86 Mac. This should only improve with time.

Ruby

This is another easy one. Like Java, Ruby is now bundled with Mac OS X. Presumably this is a universal binary that Apple has ported to X86. However, Ruby has caused me more problems in the past on Mac OS X than the other components put together, so I want to see this actually running before I believe it.

MySQL

This may well be the most performance critical of the components so a good native port is a necessity. Apple bundles this on their servers but not their client systems. However, on MySQL AB’s download page I am immediately pointed to a binary version for “Mac OS X 10.4 (x86)”. Excellent!

PHP

phpmac is the canonical site for Mac OS native PHP. However as I write this, it’s just showing “Error: Sorry, An error occured when talking with the MySQL server.” That’s not promising. What about the central PHP site? It points me to Marc Lyanage’s site but he only has older versions of PHP (the most recent is 5.1.2). Looks like this is another one you need to compile from source and hope.

Presumably Apple will make sure this all works together once they start shipping X86 based servers. However for the time being this feels dangerously close to the bleeding edge, but maybe not quite over the edge.

11 Responses to “Intel Macs as Servers”

  1. Scott Ellsworth Says:

    One of my clients in running x86 Java, and is very happy with it. The -server flag gives us the for-real server vm, and it just screams. (Well, in the same way that it screams on any other Intel platform. I am not sure about all of Sun’s code, but I rather like the server vm.)

    Apache 2.0 is a part of OS X server, so _something_ builds correctly on the platform. I do not know what version – my OS X server machine is currently down.

    Scott

  2. markee Says:

    How does x86 Java on the Mac compare with the current version in terms of performance (I use a 1.33mhz laptop and it seems slow). Are things like transparency (which are broken on the Mac OS) fixed in x86 port?

  3. Scott Ellsworth Says:

    IIRC, the bugs in transparency are addressed by recent Java 1.5 previews, available at connect.apple.com for free to all registered developers. These _are_ developer previews, of course, so do not deploy on a production system.

    I have not had a chance to do a comprehensive speed test, but he is claiming speeds similar to that of similar clocked PC machines, at least on the server side stuff he does. This does make some sense – the JIT is generating the same code, going to very similar chips.

    From the perspective of a current powerbook owner, it should be quite a jump, especially if you are running multithreaded server-style code, as that is in the sweet spot for Sun and Intel optimization.

    Scott

  4. markee Says:

    Brilliant to see transparency working. Will SWT run on the new MACs?

  5. Scott Ellsworth Says:

    The version on the download server does not work out of the box, but if you scarf an Intel SWT binary from one of Andre Wienand’s bug reports, it works just fine. (Since he wrote big parts of the SWT Mac port, this is a pretty safe thing to do.)

    Apparently, the next major release will work on Intel without needed the extra binary. Don’t know yet, as Apple is not shipping a 17″ MacBookProDeluxe.

    Scott

  6. Bob Thedino Says:

    It’s worth checking out these articles about the performance of Mac OS X as a server. It doesn’t run MySQL very well, compared to Linux, for example:

    http://www.anandtech.com/mac/showdoc.aspx?i=2436
    http://www.anandtech.com/mac/showdoc.aspx?i=2520

  7. Scott Ellsworth Says:

    I found those articles misleading for our work. We use mysql heavily, and did not see a substantial difference in performance for the schema and data load we had in our terabyte-sized sequence database.

    As always, therefore, test on the data set and schema you mean to use. Frankly, I doubt that most users are going to see a measurable speed problems, as long as the performance is reasonably close.

    Scott

  8. cremes Says:

    Use darwinports for installing Apache 2.x, the latest Ruby, MySQL, etc. Most of these popular packages are being updated to build and install correctly for OSX-x86.

  9. Alex Blewitt Says:

    The results from the anandtech testing weren’t really indicative of real world systems. They showed that it was faster to spawn low-level threads in linux than high-level threads on Mac OS X, and concluded that this can be extrapolated to every other benchmark known to mankind.

    What makes more of a difference with the Intel Mac is the fact that the FSB speed is much faster than the PPC Mac, which means shuttling data in memory backwards and forwards is much better. Given that programs do that all the time, and that they don’t spawn threads (let’s face it, any decent server-side system uses thread pooling anyway), it’s better to run a real system and see whether it works for you or not.

    Eclipse 3.2M5 supports SWT with a fat binary out of the box, by the way, so you don’t need to refer to the SWT bugreport. It will be available with 3.2. If they get enough time, they might even backport it to 3.1, but I’ve not seen any intention of that at present.

    Alex.

  10. scott schmitz Says:

    we use a mac mini running iTools LAMP stack. It’s quite fast. We have identical setup on a shared server which we use for testing and the mini is smokin fast.

  11. Luc Beaudoin Says:

    I haven’t done a proper comparison, but my experience is that OS X on intel does not multi-task Java applications very well at all (I’m using a MacBookPro2,2 Intel Core 2 Duo 2.16 GHz, which otherwise compares well with my previous machine, a desktop dual 2GHz G5). Two java applications just bogs it down. And three …
    Mind you, I tend to run more than 10 apps at a time. But I used to do that on the old machine too.