Are you thinking about moving to Amazon’s EC2 service? But you get to the part where you’re calculating how much your persistent (EBS) storage will cost and you have no idea? The Amazon pricing page looks like this:
Amazon EBS Volumes
- $0.10 per GB-month of provisioned storage
- $0.10 per 1 million I/O requests
Well, I’d like to know how much it’s going to cost to run my database before I move it over and I can’t find squat on the Intarweb on how to estimate this cost. But assuming you’re running Linux, there is an easy way by looking at /proc/diskstats:
[brian@db2 ~]$ cat /proc/diskstats
104 0 cciss/c0d0 5946064 12358605 1783920022 267694420 26411136 296537705 2583591570 34712288540 53639757 3738914277
104 1 cciss/c0d0p1 553 2156 2 10
104 2 cciss/c0d0p2 194565 1556520 192647 1541176
104 3 cciss/c0d0p3 18109735 1782360706 322755967 2582047424
104 16 cciss/c0d1 6579320 1005537 566670186 27193242 13685423 33336126 376172656 26751430 023642414 53937189
104 17 cciss/c0d1p1 7584779 566669554 47021570 376172552
This is a device with hardware RAID so we want to ignore the individual partitions (c0d1p* for example) and look at the disks c0d0 and c0d1:
cciss/c0d0 5946064 12358605 1783920022 267694420 26411136 296537705 2583591570 34712288540 53639757 3738914277
cciss/c0d1 6579320 1005537 566670186 27193242 13685423 33336126 376172656 26751430 0 23642414 53937189
According to these directions on reading the numbers, you can add the first and fifth numbers of that row to get total reads and writes respectively since the system was started. To calculate your total I/O requests per month (what Amazon will charge you), just plug your numbers into this formula:
Cost = $0.10 * 30 days * ((first number) + (fifth number)) / (days of uptime)
You can get this number another way by using iostat as well which will give you the average number of transactions per second since boot:
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
cciss/c0d0 1.56 86.17 124.80 1783920022 2583601386
cciss/c0d1 0.98 27.37 18.17 566670378 376184592
If you take the average TPS for your disks and multiply them out, you get roughly the same number (good enough to make a cost estimate for EC2):
Cost = (TPS of all disks) * 60s * 60m * 24h * 30d
You can see this particular box is under very light load with only 6,583,680 I/O requests per month. With EBS that would cost about $0.65. I think we can afford that.
Comments are closed.