Is OS X a bad Moodle Server? Recent benchmarks say Yes!

Is OS X a bad Moodle Server? Recent benchmarks say Yes!

by Jonathan Moore -
Number of replies: 12
I am not intending to start an OS flame war, but after having done quite a few Moodle installs on various platforms, OS X, Windows, and Linux, I have always been left with the feeling that OS X was a little slower. I always chalked this up to it being relatively difficult to setup a PHP optimizer on X, since the default Apache and PHP packages don't include this. In fact most of the OS X people I have talked to have asked me if I thought Moodle was a very intensive application, because they had to buy these really beefy new X Serves to make their servers run decently. At which point I mention our server runs on an old dual 1 Ghz PC and that we host losts of other web apps as well and don't even notice the load that Moodle puts on the server.

So, I did some researching and came up with a procedure to use the Complete Apache2 modules which include Turke_MMCache accellorator. I know there may be a performance hit for Apache2 but I figure it is probably less than the gain from the acceleration and I have been reading that Apache2 is really improving. I did a remote install for a school district on a nice dual G5 server with this process. It seemed quite fast with just me on the system. Very responsive in fact. I thought I had finally resolved the performance issues. But a few weeks later the tech director contacts me that they have slow performance when more than one class is accessing the server at one time. I gave him some generic info on determining the bottleneck and haven't heard back since.... time passes

Today I came across this article which is quite damning of using OS X as a MySQL/Web server and explains why I saw good performance as a single user, and total meltdown under a load.

http://www.anandtech.com/mac/showdoc.aspx?i=2436&p=8

This page and the few following it show a drastic drop in performance as the number of concurrent MySQL connections go up. At 5 concurrent connections queries per second drop from a peak of about 300/sec to under 100 and event go as low as about 50, where the other platforms tested have a nice gradually increasing peak up to the maximum queries/sec the machine can handle.

The article points the finger at OS X kernel setup, specifically that it is really slow at spawning new threads.

1) Wanted to share this info
2) Does this meet with other peoples experiences?
3) Does anyone have any effective procedures to mitigate this?
4) Anyone using YellowDog Linux successfully on this type of hardware instead of OS X? I figure this is what I will recommend to my past clients as a way to fix the server performance.
Average of ratings: -
In reply to Jonathan Moore

Re: Is OS X a bad Moodle Server? Recent benchmarks say Yes!

by Martín Langhoff -
This has been discussed here before... see http://moodle.org/mod/forum/discuss.php?d=20994#102270

OSX at least until Panther has had awful performance issues with concurrent disk IO. Moodle includes ~40 files per request, and MySQL is, as any RDBMS, very disk intensive.

Looking at the article you link, it discussses threads... I don't think you are being hit by thread creation issues -- even if thread creation is somewhat slower, you'll have 2 threads created per-request -- that's nothing really.

Compare that with ~40 files seeked and read (at least 80 stat calls when using TurkMMCache) for each request, plus another 40 mysql queries, each hitting the DB with several seeks.

One program we use at Catalyst (GNU Arch) is disk-bound, and it's about 20 times slower under OSX. Tiger is supposed to improve on Panther... I haven't had a chance to run Tiger yet ;)

Use bonnie++ to get good stats. It's really easy to install Debian or Ubuntu on a Mac these days, and they are more polished than Yellow Dog. My Powerbook dual-boots like a champ ;)
In reply to Martín Langhoff

Re: Is OS X a bad Moodle Server? Recent benchmarks say Yes!

by Jonathan Moore -
Whichever the specific causes of the issue, the chart in the article says it all. Anytime you see a graph where overall throughput drops as more clients come online you know you have a serious server issue. It will be interesting to see if Tiger addresses the problem.

Good to hear that Debian or Ubuntu is a good option. I have just moved all our Linux boxes to Debian so I am pretty comfortable with it. I have emailed a few of my contacts to see if anyone wants to be a tester to see the difference on between the two OSes on the same hardware.

Thanks for the response.
In reply to Jonathan Moore

Re: Is OS X a bad Moodle Server? Recent benchmarks say Yes!

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
From gut feel with my test server (on my Powerbook) I'd agree that OS X is generally a lot slower than Linux for server-based stuff like PHP.

On the other hand, OS X wins hands down over Linux as a desktop machine. If you are an academic with a nice OS X desktop machine at work and you want to run a small Moodle server for your own class or something, then using your own desktop computer is a perfectly good and stable option.
In reply to Martin Dougiamas

Re: Is OS X a bad Moodle Server? Recent benchmarks say Yes!

by Dirk Herr-Hoyman -
OSX is easier to deal with than Linux. And much easier than Sun.
I can see why there is great interest
in having Moodle deployed there. Certainly a smaller institution or dept might wan to do this. I think that putting pressure on Apple
is the way to go here, for those of you that have Apple contacts. Apple does respond to market demands, and over the years has been a great friend to the education market.
In reply to Dirk Herr-Hoyman

Re: Is OS X a bad Moodle Server? Recent benchmarks say Yes!

by Don Hinkelman -
Picture of Particularly helpful Moodlers Picture of Plugin developers
I agree with Dirk because I can completely manage an OS X server myself and help others. I need a technician to setup Linux. So in terms of doing teacher training and assisting other schools to get started in Moodle, I tell them if you want my help, it has to be OS X. So in my mind, it is great server for beginners in serving--Linux for handling loads. smile Hopefully, OS X will have an even greater role in the future (can you run a LAMS Java server on OS X?)

(P.S. Apple is switching to Intel on Monday--so the rumours say).
In reply to Don Hinkelman

Re: Is OS X a bad Moodle Server? Recent benchmarks say Yes!

by Jonathan Moore -
This is the same sentiment way I have been trying to get this to work. I work with a lot of people that are simply not Linux comfortable. It would be nice to be able to whole heartily recommend OS X. I know Apple has had Moodle listed on there website for a while. Perhaps this will spur them to fix some things. Unfortunately is the article is correct it may be very hard indeed to resolve.

In reply to Dirk Herr-Hoyman

Re: Is OS X a bad Moodle Server? Recent benchmarks say Yes!

by Tony Hursh -
OSX is easier to deal with than Linux.

Yes! I can deal with Linux fine, personally, but OS X was a lot easier to sell to the Mac lovers in my department (not dissing Mac here; I've gone to the Mac as my own primary desktop machine after well over a decade of exclusive Linux use smile)

We have ~500-600 users on our system, and the old G4 we use for a server keeps up pretty well. Course pages that have many autolinked glossary entries can load slowly sometimes, but other than that performance is quite acceptable (I'm hoping the text filter improvements in 1.5 will help this issue a bit). We don't even have Turck installed at the moment.

Now, I'm sure this system wouldn't work for 30,000 users (like MartinL's setup), or even 2,000. I suspect, though, that the vast majority of Moodle deployments are closer in size to ours than to MartinL's.

If you need to support tens of thousands of users, Linux (and a paid, expert support staff) is probably the way to go. If you don't, OS X works just fine, especially if you already have a spare OS X machine and a staff who's used to working with Macs.

BTW, the same machine that runs the Moodle server also runs a MediaWiki installation and a Plone portal. None of these get Slashdot-like levels of traffic, but they all do get significant use during the academic year.

I guess I don't see raw server performance as the controlling factor for this size of installation.







In reply to Jonathan Moore

Re: Is OS X a bad Moodle Server? Recent benchmarks say Yes!

by Don Hinkelman -
Picture of Particularly helpful Moodlers Picture of Plugin developers
It makes sense that any easy-to-use all-purpose OS would at least add overhead--and maybe another penalty you mention.  Even not so easy-to-use OSs (Windows) will add that overhead.  So for a high demand, server-only machine, why try anything but a lean Linux setup?   I use MD's strategy.  We use a Linux Moodle server for school classes.  Then I run an OS X Moodle server for demonstrations, testing, and training teachers--because it is so easy to setup.
In reply to Don Hinkelman

Re: Is OS X a bad Moodle Server? Recent benchmarks say Yes!

by Jonathan Moore -
I go the same route actually, although we are really a PC shop these days. So I do development, testing, and demonstrations on my desktop (Windows/Linux dual boot) and big deployments on Linux.

OS X definitely has a nicer interface. But I would say that at this point that it seems like it is a little easier to get Moodle going on Debian if you are also wanting to have an Accelerator such as Turk MMCache running. But I also use debian a lot more often than OS X.
In reply to Jonathan Moore

Re: Is OS X a bad Moodle Server? Recent benchmarks say Yes!

by Don Hinkelman -
Picture of Particularly helpful Moodlers Picture of Plugin developers
I am a member of the Tenon mailing list and today noticed a similar story as Jonathan's...  No mention of 10.4 Tiger client or server edition.  I am curious what has changed in these new editions.

I always had performance problem with MySQL on MacOS X under
heavy load. I tweaked MySQL setting to death but never got it to handle
the load of my TV Show viewers reaching on the website to win video
games all at one. It was a few years ago...

Tenon tried helping me but did not succeed. Nobody on the list gave
me any solution. I used a cache system as a temporary fix that lasted
for years. I felt like an idiot, suspected an hardware problem and
moved my site to another server with 1.5 gig of RAM... no changes.

After searching the web for year for an explanation that nobody could
give me, I finally know why :
http://www.anandtech.com/mac/showdoc.aspx?i=2436&p=6

That may be interesting for those of you planning to use Mac OS X
for serving Apache + MySQL + PHP website, like I did.

At least, now I know that I'm not stupid and it is was not an
hardware problem.

In reply to Don Hinkelman

Re: Is OS X a bad MySQL Server? Recent benchmarks say Yes!

by Don Hinkelman -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Correction: note that the link I posted above is more recent (dated 3 June 2005) than Jonathan's and includes testing OS X 10.4.1 on an dual G5 Xserve server.

The article is very informative to me, explaining that the key problem is that in OS X, fast kernal processing in the BSD core is *only* available to kernal processes, not application processes such as MySQL. While in Linux, fast kernal processing is also available to MySQL.
In reply to Don Hinkelman

Re: Is OS X a bad MySQL Server? Recent benchmarks say Yes!

by Don Hinkelman -
Picture of Particularly helpful Moodlers Picture of Plugin developers
I just found a Tenon listserve posting that questions the anandtech findings about OS X.
Hi Guys,

This worried me so I did some internet research and the results are a little more reassuring:

1. Anandtech screwed up by using a crippled compiler for the G5 test and have misunderstandings of process / thread handling in OS X.
(see comments for anandtech article and http://ridiculousfish.com/blog/?p=17)

2. Using Apache2 with it's better multiprocessor capabilities will help.

3. Some say that the performance problem may be related to the built-in F_FULLFSYNC fcntl which will ask the drive to flush all of its buffered data to disk.
This has been questioned and at the OS level it is always on. it is possible to turn this off if the app allows it. However this is a tradeoff between speed and data integrity.
(http://lists.apple.com/archives/darwin-dev/2005/Feb/msg00072.html)
Written by the dev who wrote BeOS and now works for Apple - excellent thread.

4. On the Mac OS X Server list many people ran tests and got much better results than the anandtech report - some on G4s! Dr Rolf Jansen pointed out that setting:
/usr/sbin/sysctl -w net.inet.tcp.delayed_ack=0
overcomes problems with cheap NICs with too small transfer buffers. He suggests that Anandtech "simply had very low network performance from their PC-Box (possibly with a noname NIC with a small transfer buffer) to the Dual G5 Server."

5. The inimitable Dan Shoop (also on OS X server list) acidly points out that MySql isn't enterprise level and that PostGreSQL is muuuuuch better. He reminds us that MySql "strongly favours Linux as a platform" and "performance on OS X is tempered with a far greater level of data integrity than you get on Linux. For most ppl interested in databases raw performance isn't as important as safe operations. Data is more valuable than speed."

6. The results - OS X may be a slower, but not 10x as reported by anandtech and your data integrity is better. Some test run a year ago by PC magazine give an entirely different picture:
http://www.pcmag.com/article2/0,1759,1637655,00.asp

7. I'd say the jury is out but I'm interested in Dr Rolf's sysctl suggestion. Anyone who has experienced poor mysql performance tried this??