|
Linux 2.6 and Hyper-Threading - Static HTML and MySQL As you
may or may not know, I'm the geek working behind the scenes making 2CPU.com
load every day. As a result I'm keenly interested in Apache and MySQL
performance. While we still use static HTML (for a variety of reasons
that are beyond the scope of this article), we also have busy
forums which keep MySQL on its toes. I decided to first take a look
at Apache's static HTML performance with Apache Bench (ab), which is bundled
with the source distribution. It's a simple benchmark to run. You fire
up apache and run a command something like this: /path/to/apache/bin/ab
-n 1000 -c 1000 http://localhost/index.html. Where 'n' is the number of
requests and 'c' is the number of concurrent users. For this test, I decided
to use the first
page of my last HT article as the test file. It amounts to about 7KB
of data, and there's one picture in the content section of the page (the
menus and header/footer are all includes). To ensure the most accurate
results, I ran ab five times in a row on each machine and averaged the
results. Here's the graph. Our 3.2E
'Prescott' notches its first victory over the Northwood-based P4 and really
puts in a fine performance in this test coming awfully close to the performance
level of our dual Xeon box. I'm thinking the added L2 cache is helping
Prescott here. Enabling HT on this machine results in a 29% increase in
requests per second. The dual 3.2GHz Xeons
with 1MB of L3 cache win out in this benchmark by a small margin (as they
should). Interestingly enough we see a decrease in performance of about
3.4% when HT is enabled on the Xeons. Are the four logical processors
stumbling over each other trying to gain access to cache or the bus? I'm
thinking once Nocona is available we'll see far fewer instances of this
as the increase to an 800MHz FSB will really help. I don't think the
performance decline is large enough to really motivate you to disable
HT on your Xeons powering web servers. You may want to hold on long enough
to take a look at database performance before making your decision. The 3.2GHz 'Northwood'
P4 finishes in last place. Enabling HT here gives us another ~28-29% increase
in performance. That keeps it directly inline with the increases we saw
on our Prescott box. Finding an interesting
MySQL benchmark really turned out to be quite a chore for me. I spent
time messing around with several only to be disenchanted with the results.
I originally got pretty excited about the Database
Opensource Test Suite (DOTS) which required a client and server machine
and used JDBC to connect to a performance monitor and the database respectively.
I was able to get it working without any problems but for whatever reason
I couldn't get the client to put enough stress on the database server
to actually end up with reasonable and accurate results. I dropped that
and moved onto the Open
Source Database Benchmark (OSDB), which still didn't give me what
I was looking for. Eventually I talked
to my homie Jason, who's the closest thing I know to a database genius.
He suggested I give sql-bench or "MySQL
Super Smack" a try as the former is bundled with the MySQL source
distribution and is written in perl and the latter is multi-threaded.
sql-bench didn't really blow my skirt up either, so I eventually settled
on MySQL Super Smack. At the very least, it has a cool name. Super Smack comes
with a couple of "smack" files that can be used to test the
database performance of your machine. It will work with Oracle, PostgreSQL
and MySQL. In this case of course, we were using MySQL 4.0.17. The first
test consists of two straight selects
which should give you a reasonable snapshot of the read performance of
your database server. If you'd like to take a look at the SELECT test
file, here it is. Let's take a look at
the numbers from the first test. It should be noted
that I ran the test five times in each instance and averaged the results. Don't
let anyone ever tell you that dual machines don't make kick-ass database
servers. Look at how our Xeons knock the dust off the uniprocessor test
systems. The Xeons see a ~25.5% increase in performance once we enable
HT. 44,502 queries per second is awesome. The 3.2E
'Prescott' disappoints me here. We know that database servers generally
love additional cache and I thought the extra 512KB of L2 cache might
swing the results in Prescott's favor. Unfortunately that's not the case.
This might have something to do with that deep pipeline. All the same,
we see a ~43% increase in performance once we enable HT. You really can't
complain about that, can you? Northwood
fared pretty well in this test. It slightly edges the Prescott in both
scenarios (HT enabled and disabled) and enjoys a ~39% increase in performance
once HT is enabled. On to
the next MySQL test!
|