Archive for November, 2007

New kernels coming to Amazon EC2

Up to now you could run any Linux distribution on Amazon EC2 but you could only run Amazon’s 2.6.16 kernel. Well strictly speaking there are two kernels: a 2.6.16.0 kernel for the 32-bit instances and a 2.6.16.33 kernel for the 64-bit instances. But recently RedHat announced support for RHEL5 on EC2 and today they made it available publicly. Now guess what: the kernel you get if you launch their paid AMI (machine image) is “Linux version 2.6.18-53.el5xen (brewbuilder@hs20-bc2-3.build.redhat.com)”! Long story short, Amazon now has the capability of running multiple kernels on the instances, but alas this is not yet available to mere mortals (i.e. non-Redhat). But hopefully wider availability of new kernels isn’t too far off. It’s nice to see EC2 evolving steadily!

If you’re interested in all the gory technical details, see my post on the Amazon forum.

Leave a Comment

MySQL performance on Amazon EC2

Spurred by Morgan Tocker I ran some sysbench MySQL performance benchmarks on EC2 instances. This is just the first round, more to follow…

The set-up

On a small instance, I reformatted /mnt with LVM2 and creates a 140GB xfs filesystem. In the my.cnf the important InnoDB settings I chose are:

innodb_buffer_pool_size = 1G
innodb_additional_mem_pool_size = 24M
innodb_log_file_size = 64M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 2 # Write to log but don't flush on commit (it will be flushed every "second")

On a large instance, I created /mnt using LVM2 and striped across both drives to get a 200GB xfs filesystem. The my.cnf settings were:

<code>innodb_buffer_pool_size = 4500M</code>
<code>innodb_additional_mem_pool_size = 200M</code>
<code>innodb_log_file_size = 64Minnodb_log_buffer_size = 8M</code>
innodb_flush_log_at_trx_commit = 2 # Write to log but don't flush on commit (it will be flushed every "second")

The benchmark

I then ran the sysbench OLTP test as follows:

mysqladmin -u root create sbtest
sysbench --test=oltp --oltp-table-size=1000000 --mysql-socket=/var/lib/mysql/mysql.sock --mysql-user=root prepare
sysbench --num-threads=16 --max-requests=100000 --test=oltp --oltp-table-size=1000000 \
   --mysql-socket=/var/lib/mysql/mysql.sock --mysql-user=root --oltp-read-only run
sysbench --num-threads=16 --max-requests=100000 --test=oltp --oltp-table-size=1000000 \
   --mysql-socket=/var/lib/mysql/mysql.sock --mysql-user=root run

The results

Ok, now to the results, all numbers are transactions per second printed by sysbench.

_Update:_ Morgan asked about the MySQL version and I realized I was using stone-aged-5.0.22. So I re-ran with 5.0.44 from the CentOS5-Testing repository. I also ran the benchmarks on an xlarge instance, with /mnt striped across 4 drives, once with my.cnf unchanged from large instance (4.5GB buffer pool) and once with 12GB buffer pool.

Machine MySQL read-only read-write
EC2 small 5.0.22 227, 228, 230, 241 115, 116, 119
EC2 large 5.0.22 466 333
EC2 small 5.0.44 227, 229, 229 115, 115, 115
EC2 large 5.0.44 420, 428, 462 277, 310, 319
EC2 xlarge 4.5GB 5.0.44 620, 630, 637 463, 483, 495
EC2 xlarge 12GB 5.0.44 593, 598, 620 453, 481
AMD Sempron 64 5.0.22 383, 394 220, 225
iMac 5.0.?? 253 144
All numbers are transactions per second as printed by sysbench. A range or multiple values indicate values from multiple benchmark runs.

The iMac is a dual-core, 2.16Ghz, 2GB box with MySQL installed somehow and the machine was not 100% idle. The Sempron 64 is single core, “3400+” (2Ghz), raid-1 7200rpm drives, 2GB ram, not 100% idle (I really have gotten spoiled by EC2 and the ability to launch instances at a whim!). These tests are just meant as a ball-park point of comparison.

The benchmarks certainly confirm that the write performance on the small instances is, shall we say, lacking… I had expected a bigger improvement overall for the large instances, I guess for the read-only benchmark we’re seeing 2 disks vs. 1 disk, and on the read-write side we’re seeing 2 disks vs. “a problem”. With a real application load the large instance will often show a greater improvement over the small instance than shown here because the buffer pool increase can really make a huge difference.

Time to grab an x-large instance and try that…

NB: Note that Morgan’s blog entry referenced at the top uses myisam tables while I used InnoDB tables.


Archived Comments

Morgan Tocker
InnoDB should scale better than MyISAM with more cores/cpus. Do you mind commenting on what version of MySQL you are using – is it 5.0.30+ ?

Thorsten
crush… using 5.0.22 … rerunning using 5.0.44 … results soon

Thorsten
Well, dunno whether 5.0.44 is slower than 5.0.22 or whether the CentOS5-Testing version is badly compiled, but the performance is no better.

Ian
Any ideas why the xlarge instance is slower with a 12GB buffer than with 4.5GB?

Thorsten
Dunno why the large buffer makes it slower. If that much cache is not actually productively used, there may be less locality resulting in poorer L1/L2 cache performance. But that’s just a general guess. Given that the performance is not really that different, I wouldn’t get hung up on it. If your queries can benefit from the larger buffer pool, then this will a much more significant improvement than any differences seen here.

Frédéric Sidler
Do you really compare apples with apples with Morgan Tocker. Everything between the two posts is completely different (OS, version, memory, database engine). As everything is different, I’m asking if these results can be compared. The only thing that frightens me is that mysql should run on an extra-large instance (15 GB memory, 8 EC2, 4 virtual cores with 2 EC2 Compute Units each, 64-bit) to accomplish the same numbers Morgan Tocker is giving on his post with his single computer (AMD64 3000 (I think), Ubuntu 7.10, 7200RPM drive, 1G RAM)

Thorsten
Frédéric, yes, i am comparing apples and oranges, but I’m not really comparing nor do I claim I’m comparing. His post got me interested in running some benchmarks on my own, and I selected the components that interest me, hence the differences, specially my use of InnoDB vs. his use of MyISAM. We only do InnoDB, so his numbers weren’t useful to me.

Incidentally, I need to rerun some of the benchmarks. It turns out a lot of what I ran is entirely cpu bound, which is interesting, but I also really would like to run stuff that is I/O bound.

Comments (10)

Ubuntu 7.04 Amazon EC2 image release

We’ve been working on an Ubuntu RightImage for a while now and it just took longer than expected to iron out all the little wrinkles. But now it’s available as `RightImage Ubuntu7.04V1_14_2` with AMI ID ami-f3cc299a and location `rightscale_images/Ubuntu7.04_V1_14_2`.

This is our first Ubuntu public image so we hope we covered all bases, but we’re eager to hear whether everything works as expected. As always the script to create the image is also available.
To run the script, launch an Ubuntu image with working bundling code and run through the steps…

A little background on RightImages for those of you not familiar with what we’re doing: to configure servers we use a base image and install software at boot time using our server templates and RightScripts. This is way more modular and maintainable than baking entire servers into AMIs. Please see our blog post on the rationale behind this. As a result, we produce base images that are small yet have all the software utilities one just needs in EC2 already installed, from the Amazon EC2 tools to traceroute, curl, wget, etc. The second innovation we made with our images is that they are fully scripted and we publish the script. You can launch Amazon’s FC4 or FC6 image (well, for the Ubuntu RightImage you need to start with some Ubuntu instance), run our script, and out pops a clone of our RightImage. So if you want to see what we install or make some changes you can go right ahead.


Archived Comments

James
Hi, I just used your image, made some changes, installed some more packages and bundled it. Somehow after initializing the image I cant connect through SSH. Its weird because yours comes with SSH bundled and started. Why cant I connect to my image then? thanks in advance.

Thorsten
James, I’m pretty sure we tested rebundling the image, but I’ll double-check. Are you sure you have port 22 open and that you’re using the right SSH key? There is a boot script that installs the SSH key, so be sure you didn’t somehow disable that.

James
Hi. I keep stuck in the same issue. Well, I’ll describe my process: I ran your instance, made some package and gem installs, copied my pk and cert to /mnt, issued the following command:
ec2-bundle-vol -d /mnt -k /mnt/pk-2JSD7JYO2MTK3C3H5ATIM356KE4VYKOU.pem -c /mnt/cert-2JSD7JYO2MTK3C3H5ATIM356KE4VYKOU.pem -u 782731552053 -s 1536 -r i386

uploaded it to s3:
ec2-upload-bundle -b ubuntu_final -m /mnt/image.manifest.xml -a -s

registered it:
ec2-register ubuntu_final/image.manifest.xml

run it: ec2-run-instances ami-ccd633a5 -k test-keypair

… and after that the instance is online with their public and internal hostname. I cant ssh to it nor get a ping reply, so I checked with:
ec2-get-console-output i-809662e9

and I got some strange output: http://pastie.caboo.se/121164

Thank you

Thorsten
James, I now get he same error you do. Seems to have something to do with the new AMI tools released by Amazon. Sigh. We hope to have a fix released asap.

Comments (4)