Monthly Archives: September 2008

Back up your database to the network – not local disk

Database administrators: are you backing up your SQL Servers to local drives?  If so, you need to stop for a minute to think about a few possible side effects, and maybe think about backing up to a network share instead.  Why?  I’m glad you asked!

Get your data off the server faster

My fellow Quest SQL Server expert Bryan Oliver has a great question: he asks, “Why do you back up?”  There’s only one reason: to be able to restore.

If your server crashes, you need to be able to restore as fast as possible.  In the event of a hardware or operating system error, if your data is on a local drive on that dead SQL Server, you’re going to take much longer to do a restore.  You might be running into the datacenter to go pull out the hard drives, or maybe you might spend valuable time trying to resuscitate a dead operating system.

Instead, if the backups are on a network share, you can immediately start restoring those backups onto an other server.  The faster you can get back online after disaster strikes, the better you look.  Then you can take your time troubleshooting the dead gear.

Restore your data to dev/QA faster

Do you frequently refresh your development and testing SQL Servers from production backups?  You can do this faster and with less impact to your production servers if those backup files live on a network share instead of on your production server.

Easier log shipping with multiple subscribers

When you have multiple log shipping subscribers pointing to the same publisher, they all need to read those same backups from your central publisher server.  The more subscribers you have, the more impact it is on the production publisher because all of those subscribers will be copying the data off the publisher.

Save yourself performance by simply writing the backup to a network share in the first place.  Then the write is done once, it’s off the production publisher, and it can go on doing what it needs to do: serve database users.

Faster writes to tape

If you’re writing backups to disk first, and then offloading those backups to tape, you suffer a performance hit whenever the tape backup agent connects to grab the backup files off local disk.  You’ll get a performance improvement if you write those files off to the network to begin with, because then the tape backup software can grab the files off the network share – hammering your file server instead of your valuable database server.

Your bottleneck probably isn’t the network card

Sometimes I hear DBAs say that they’d rather dump the data onto local disk first to get the backup over and done with faster.  Sometimes – but rarely – is that actually true.  Many times, especially if you’re using backup compression software like LiteSpeed, the network isn’t the bottleneck.

Want to prove it?  Try it yourself – do a backup to a known fast network share, not some slow junky Pentium 2 in the antique section of the datacenter.  Time to see how long it takes to finish the backup as compared to writing to local disk.  If it takes less time, you should switch to the share right away.  Even if it takes 10-20-30% longer, I would still argue that you should switch because the faster you can get those backups off your server, the safer you are.  And I like you – I don’t want you getting fired for not being able to recover your data!  I can’t afford to lose any of my blog readers.

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

More Posts - Website

Follow Me:
TwitterFacebookLinkedInGoogle PlusYouTube

The bailout, the IT worker, when to STFU

I’m really good at searching the web.

Seriously.  Sooner or later, IT people who work around me start bringing me questions they’ve been unable to answer on the internet, and I can usually get the solution within one or two searches.  I’ll write an article about my techniques one of these days, because everybody in IT searches the web for their living now.  If we get an error message we haven’t seen, we search the web for it before we call support.  If we get handed a product we’ve never seen before, we search the web to find out how it works.

But searching the web doesn’t give the right answer for everything.  Many problems are too large, too complex to sum up in a Wikipedia article or a forum posting.  Take world peace – there is actually a Wikipedia article on world peace.  The article’s only a few pages long, and it lists many different schools of opinion on how to actually achieve world peace.  Once you subscribe to one of those approaches, then you have to execute it, and that’s also beyond the scope of the article.

IT people have a hard time accepting that there are problems we can’t understand simply by searching the web, and we mistakenly extend that technique to major world issues like the financial bailout.  We think we can get up to speed by scanning a magazine article, listening to a report on NPR or watching a YouTube video.

The best IT workers know when to shut up and get out of the way to let the real experts solve the problem.  It doesn’t waste their own time, and doesn’t waste the time of the people who really understand the problem.  When somebody asks me a question that is outside of my expertise and that I can’t lend value to, my answer is short and sweet:

I say, “I don’t know,” and I STFU.

Just yesterday, I gave that answer to questions about the financial bailout, how to price enterprise software, why Benjamin Linus can’t kill Charles Widmore and what ingredients go into hoisin sauce.  Some of those answers could be easily retrieved with a web search, but the art of being a good IT worker is knowing which ones are a bigger challenge than a Wikipedia article can address.

People who live in glass houses shouldn’t throw stones, so before you go spouting bailout advice, make sure you:

  • Don’t use credit cards
  • Live well below your means
  • Have a fully funded retirement plan
  • Donate regularly to charity
  • Didn’t get a mortgage on a house you couldn’t afford

If you’ve mastered those techniques, then, and only then, are you qualified to even begin researching the financial problems today, let alone give answers.  You giving financial advice about the bailout is like Hank Paulson telling you when to choose SQL Server Enterprise Edition over Standard Edition: you know it’s going to be crappy advice, and you’d be a complete idiot to take his advice.

Until then, say “I don’t know,” and STFU.

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

More Posts - Website

Follow Me:
TwitterFacebookLinkedInGoogle PlusYouTube

Travel Tips for Non-Frequent-Flyers

To my readers who are traveling to one of the upcoming fall conferences, here’s a few of my favorite travel tips.

Use SeatGuru.com to get the best seat.

I’m not talking about first class versus coach – even in coach, not all seats are created equal.  Every plane has some surprise seats that have more room or different setups.

SeatGuru has maps of every airplane flown by every airline.  Call your airline or check online to find out the exact make & model of plane you’re flying and then pull up that map on SeatGuru.  The seats are color-coded by comfort level.  Hover your mouse over your seat, and you’ll see detailed notes about the comfort level of that particular seat.

Then, with that map up on your screen, call your travel agent or go to your airline’s web site to change your seat.  You can sometimes do this online even when it’s too early to check in for your flight, and the earlier you do this, the better your chances are for getting a good seat.

I’m typing this from the comfort of a Continental Embraer RJ-135, seat 12A.  It’s an exit row seat with no seat on either side of me, so I have plenty of space in front of me for my legs, and plenty of space on either side for my arms.  It didn’t cost me any extra – I just went to Continental.com and tweaked the seat on my reservation.

If you don’t find a better seat, don’t give up: check again exactly 3 days and 2 days before departure.  Airlines automatically upgrade their elite frequent fliers to first class for free at those times, and guess what – that means their seats in coach are suddenly empty.  These people are exactly the kinds of people who usually know to grab exit row seats and those “special” seats with more room, so you’ll find these seats opening up again.

No assigned seat?  Check in online ASAP.

If your airline reservation doesn’t show an exact seat number, your flight may be overbooked.  Airlines routinely overbook flights because not everybody shows up for a flight.

Go to your airline’s web site and try to check in right now.  You won’t be able to, but it will tell you when the flight checkin will open up.  Set yourself a reminder to check in at that date/time.  The earlier you check in, the more likely that you’ll get an assigned seat.  The later you check in – well, let’s just say you don’t want to get a miserable $100 air travel voucher in exchange for being late to PASS.

Thinking about taking a late flight for a voucher?

Think again.  Those travel vouchers usually have blackout dates, and the blackout dates are like “Valid only for trips with a Saturday stay on the third week of the month.”  If you really want to risk it, then talk to the airline staff before you volunteer the seat.  Ask whether the voucher has any restrictions at all, and ask them to show you one of the vouchers.  If it says anything about “Only valid for fare code X”, there’s a catch.

Not a frequent flyer?  Find someone who is.

If you only take one or two flights a year, and you’re not a member of any frequent flyer clubs, talk to people in your company who are frequent fliers.  Ask them if they want your miles for this trip.  If you’re doing a cross-country flight like Florida to Seattle, they might be willing to take you out to lunch and dinner in exchange for those free miles.  You just have to call the airline and tell them that you want to add your frequent flier number to your reservation, and give them your buddy’s account number.  There IS such a thing as a free lunch.

Leave a tip for the hotel maid on your pillow.

Hotel maids make minimum wage, and it’s common to leave them tips.  Some folks only leave the tip on the day of checkout, but I prefer to leave a tip daily because the same maid may not clean your room the entire time – they do get days off, ya know.

Also, make it as easy as possible for the maid.  Use just one trash can if you can, and dump your used towels in a single pile on the toilet seat (with the seat closed, speedy).  It’s less bending over for them.

Things to ask vendors and peers

Ahead of time, make a list of projects you’re working on, new products you want to implement, or large challenges that you’re facing.  Write this stuff down now, because you won’t remember it when somebody asks, “Do you have any questions?”  Us humans are terrible at that.

This is just my personal opinion, but I say do NOT ask tech support questions at a conference.  Tech support people aren’t usually the ones sent to conferences.  If you want support, call the support line.  If you have large architecture questions, implementation ideas, or tips and tricks, then you’ll find good answers at a conference.  If you’re getting error 0×8004005,search the web.

Things to bring to the conference

Here’s a list of things you may not think to bring along:

  • A small, light extension cord or surge strip.  There’s never enough outlets, especially at tech conferences.  If your laptop has a two-prong electric adapter, try to use a two-prong extension cord too, because not all outlets have three prongs.
  • An extra laptop battery.  It ain’t cheap, but if you want to take notes during the sessions, it’s easier if you don’t have to fight over power outlets.
  • Business cards.  If you have a personal web site you want to promote, or if you use Twitter, order business cards now.  They’re surprisingly inexpensive if you’re doing simple text with no logos – like $10 for 250-500.  I order a set just for conferences that have conference-relevant information like my work email, personal email, Twitter link, web site links, etc, but not mailing address.  (Nobody at a conference wants your snail mail address, although you can put city & state if you want an icebreaker.)

Set up your phone or PDA with my Twitter link

If you’re going to the PASS Summit 2008, bookmark these two links now on your phone or your PDA:

During the conference, I’ll Twitter whenever I find out about after-hours events, dinners, meetups, or spontaneous meetings during the day.

I remember what it was like going to PASS 2007 as an attendee who didn’t know anybody – man, it was tough to find out what was going on!  I ate lunch and dinner by myself most of the time.  Let’s face it, us DBAs aren’t always the best party people.  (Except for the PASSCamp Germany guys, they know how to put on a party!)  Now that I’m an insider (woohoo!) I’ll share the knowledge to get you folks into the action.

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

More Posts - Website

Follow Me:
TwitterFacebookLinkedInGoogle PlusYouTube

Microsoft License Plate Frame

Microsoft License Plate Frame

Picked this up at the Microsoft company store this week in Redmond. Looks great with my SQL license plate!  The only downside is that it blocks out the “Lone Star State” line.

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

More Posts - Website

Follow Me:
TwitterFacebookLinkedInGoogle PlusYouTube

SQL Server 2008 upgrade poll results & thoughts

Last week I posted a poll asking DBAs when they would use SQL Server 2008 in production.  Here’s the results after one week:

  • In the next 3-6 months. (40%, 8 Votes)
  • Not planning it yet. (30%, 6 Votes)
  • In the next month or two. (20%, 4 Votes)
  • Already done. (10%, 2 Votes)

This week, I had the pleasure of going to a few meetings at Microsoft.  Roger Doherty gave us a presentation talking about why database administrators need to upgrade to SQL Server 2008.  He’s a member of the Developer & Platform Evangelists team, and he’s rightfully excited about all the cool stuff inside SQL 2008.

I played devil’s advocate – and when I say devil, I mean database administrator.

One of the slides was this spiffy graph that showed different approaches to upgrades: when you should do an upgrade-in-place, when you should use the Upgrade Advisor, and so on:

Upgrade Testing Options

Upgrade Testing Options

Apps that are simple and have a low strategic importance can just be upgraded in place, whereas on the opposite end of the spectrum, apps that are very complex and have a high strategic importance should have careful planning with code changes to take advantage of the new features.

Okay, I get it, that makes sense.

So how do we as DBAs gather the information to populate this chart?  How do we analyze all of the applications (not just servers, but the individual databases) to determine whether they’re simple or complex, and whether they have a high or low strategic importance?  Roger discussed some of the options in determining app complexity, and basically, we don’t have a good option right now.  The closest thing we have to an automated solution is simply gathering a trace of all queries that hit the database over the course of say, a week, and looking at the queries to see whether they’re using SQL Server’s advanced or deprecated features.  We can pass the profiler data to the Upgrade Advisor, but it won’t give us a measure of how complex the app is – it will only tell us whether the SQL Server upgrade will pass or fail.

During the presentation, I sent out a Twitter message asking my readers how many instances they support per DBA.  The answers I got back ranged around 20-70.  Whaddya know – that’s kinda like the number of instances shown on that slide.

So here’s my problem: that’s a beautiful line graph.  Makes perfect sense.  But now let’s look at how much time it will take to actually upgrade all 20-70 instances that a DBA has to manage:

  • Gather a good inventory of servers & databases
  • Find out from the app owner whether SQL 2008 is supported (either internally or by the vendor)
  • Gather the information to populate the line chart
  • Take the actions suggested by the line chart (Upgrade Advisor, plan code changes, etc)
  • Arrange for an outage window with the application owners
  • Perform the SQL 2008 upgrade
  • Test the application post-upgrade

Holy moly.  If each of those took an average of four hours (and I know I’m seriously underestimating that) we’re still talking about 3 days per app.  Say your instances host just one app apiece (a truly laughable concept in the days of consolidation) and we’re talking about 60-210 business days to upgrade 20-70 instances!

Starts to make sense why Microsoft needs guys like Roger – you really do have to bang the drum to get users excited about doing that much work to upgrade.  It’s a tough battle.  I know when I was a DBA a few months ago, I was excited about 2008, but I knew there were few apps I could upgrade right away.  For the rest, the vast majority, I planned to wait until the application owners wanted to drive the upgrade process – so that way they could hassle with the meetings!

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

More Posts - Website

Follow Me:
TwitterFacebookLinkedInGoogle PlusYouTube

Cutting to the Chase

People come running into the DBA’s corner office (okay, windowless cube) with all kinds of issues and they’re not sure what’s a database problem, what’s an application problem, or what is just a general complaint.

Here’s some examples of vague requests:

  • “Man, this application is so slow.”
  • “The profit numbers on this report don’t seem right.”
  • “I think it’d be really cool if we had a new tool for our warehouses.”
  • “Have you read this article on database report tools?”

DBAs, being the selfless workers that we are, want to immediately drop everything and focus on their problem – but that’s not always the right answer.

As a DBA, you can help eliminate the confusion with a simple question: “Okay, let’s make sure we’re on the same page: what actions do you want me to take right now?”

The three bold words are the important ones to stress, because sometimes you’ll get answers like:

  • “Oh, I didn’t really want you to do anything – I just wanted to see if you’d heard that from anybody else too, or if it was just me.”
  • “I want you to double-check the numbers in the report.” (Well, that may not be the DBA’s job – it may be better to route them to the reporting team.)
  • “It depends – are you doing anything right now?” (Answer yes, and take a minute to show them what you’re doing.  It’ll scare them off just knowing you don’t sit around dreaming of ways to spend that big fat paycheck.)

Do yourself a favor: before you jump into the telephone booth to change into your Superhero costume, take a minute to ask the person exactly whose life they want you to save.  No need to be seen in those tights if you can avoid it.

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

More Posts - Website

Follow Me:
TwitterFacebookLinkedInGoogle PlusYouTube

I’m a PC



I’m a PC

The SQL sticker is courtesy of Paul Nielsen’s SQLServerBible.com, and the I’m a PC sticker is from JC Cannon at Microsoft. I just demoed VMware Fusion for him to show how this thing really is a PC too – I run a bunch of Windows VM’s on here for my SQL Server work.

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

More Posts - Website

Follow Me:
TwitterFacebookLinkedInGoogle PlusYouTube

HIPAA vs SOX for database administrators

A database administrator asked me, “If I’ve been working at a company subject to Sarbanes-Oxley regulations, and I needed to learn what was different about HIPAA regulations, what would be the difference between the two?”

First, in my answer, don’t think about credit card data or customer social security numbers.  That has its own security implications separate from HIPAA or SOX. In our cases, we’re going to assume there’s none of that involved, and later, you’ll see why I kept that out of the conversation.

HIPAA is designed to protect the patient’s confidentiality.

SOX is designed to protect the shareholder’s transparent view into the company.

I’ll keep coming back to those two points because it helps illustrate what we need to protect.

If you’ve been working at a SOX-affected company as a DBA, you implement safeguards to make sure that financial data doesn’t get inserted/updated/deleted without somebody knowing.  Your worst nightmare as a DBA is someone modifying profit & loss data without you being able to catch it, like sliding money around into different accounts.

With HIPAA, on the other hand, your worst nightmare is your database’s contents getting out into the public.  If somebody mucks with health data, sure, that’s a problem, but there’s not much motivation to do it.  The bigger concern is confidential patient data getting into the wrong hands.  In theory, you want tight security on ANY database server, of course, and you don’t want anybody doing unauthorized inserts/updates/deletes.  You still want that at HIPAA-affected companies, but the select auditing is a real pain in the butt, because off-the-shelf 2000/2005 databases aren’t set up for that.

There are some vendors who provide this by doing monitoring on the SQL Server with traces or with behind-the-scenes code analyzing what SQL Server is doing. Other vendors take the approach of a network appliance that sits between your SQL boxes and the rest of the network, and they sniff network traffic going into the SQL box.  Both approaches have their pros and cons, but you get the idea – we’re talking about infrastructure mods, not something DBAs take lightly.  (My employer, Quest Software, has solutions for HIPAA and SOX compliance for databases and Windows, but I’m not up to speed on that software yet.)

But it gets tougher: auditing is just the start.  In a SOX-affected company, you don’t lose that much sleep wondering what would happen if somebody stole your tape backups en route to an offsite location.  Sure, they’d get a copy of your balance sheets, but that stuff is pretty much public sooner or later anyway, because only public companies are really subject to SOX.  If you’re a private company and you’re choosing to abide by SOX regulations, then the tape theft scenario is a problem, but as the DBA, it’s not really technically YOUR problem.  If somebody gets the tape backup, they can restore it and read it, but it’s not like they’re going to set up a fake balance sheet and do something with it.

On the other hand, with HIPAA-affected data, we’re talking about patient health histories.  If somebody gets a tape backup with health insurance data for a million customers, finds out what people are sick with what diseases, there is a HUGE financial risk there.  The patients can sue, or the thief can sell that data to a private company who would do targeted advertisement at those customers.  Imagine getting a phone call from a spammer saying, “We hear you’ve got herpes, and we’ve got a great drug to treat it.”  Ugh.  Lawsuit city.

So not only do you have to protect the data, you have to make schema design decisions in an effort to abstract the customer from the treatment records.

I’ll give you an example: take a survey company that sends surveys to hospital patients.  The hospital would send over a list of patients, but not any information about their treatments whatsoever.  The survey company would email out the surveys, compile the data, and then return the raw survey data back to the hospital for their own processing.  See, the hospital wants to do reporting to find out if people who got a particular treatment were more or less satisfied than patients who got another treatment, but they can’t give that data out to the survey company because that might violate HIPAA. If the hospital wanted to give out that data, they would need to make sure that all of the survey company’s data was as secure as the hospital data, and that’s an auditing mess.

Something else you see in HIPAA-affected databases are app-level encryption – like encrypting a patient’s name/address/SSN/etc in the application, and then storing that encrypted data in SQL Server – but not the key.  That way, even if the DBA gets curious and selects patient data, he won’t be able to grab a list of people with broken arms or whatever.

Now you see why I left out the credit card data.  Sure, that’s private, and it can affect both HIPAA and SOX companies if they store that kind of thing, but it’s unrelated to either.

I’ve made a lot of grand sweeping generalizations in this post, but it’s just to illustrate the basic differences.  I know SOX people are having fits that I’d say they’re not worried about auditing select statements, for example, but it’s just not the top thing on their to-do list when they wake up in the morning.

Finally, this article is accompanied by a picture of a new ThinkGeek item.  I didn’t want to do a separate blog entry about it, but it’s hilarious, and I like pictures in my blog entries.  So there ya go.

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

More Posts - Website

Follow Me:
TwitterFacebookLinkedInGoogle PlusYouTube

SQLIO Tutorial: How to Test Disk Performance

Storage is a black box, right?  The SAN admins ask how much storage space you need, you tell them, and then they give it to you.  They don’t tell you how fast (or slow) it is, they don’t know whether it meets your needs, and they probably don’t know where the bottlenecks are.

It’s time to find out how fast your storage really is using SQLIO – perhaps the worst-named tool in history.  SQLIO has absolutely nothing to do with SQL Server – it’s just a tool to test IO.  Whether you’re an Exchange guy, a SQL DBA, or a file & print fella, SQLIO will help you push your storage to the limit to see when it breaks.

Step 1: Download SQLIO from Microsoft for Free

Download SQLIO from Microsoft and install it on the Windows server you’d like to test.  It’s extremely lightweight – it takes less than 1MB on disk – and works on any version of Windows.  The support page doesn’t say Windows 2008, but it works fine.

Install it in c:\Program Files no matter what drive you want to test.  I prefer installing it in C because I delete and recreate my non-system partitions repeatedly while I’m testing them.  That way, I can find out if various parameters are faster or slower without reinstalling the OS.

After installing SQLIO, you won’t see anything in the Start menu because it doesn’t have a graphical user interface.  Deep calming breaths – this is easier than it looks.  Fire open Windows Explorer and go into the directory where you installed SQLIO, like c:\Program Files(x86)\SQLIO.

Step 2: Set Up SQLIO’s Configuration Files

If you just start running SQLIO, it uses a laughably small 8MB test file by default.  The problem with such a small test file is that it’s probably smaller than the cache involved in your various storage components (drives, storage processor, etc.)  I prefer using a 20GB testing file for starters.  Your SAN might have a larger cache, but keep in mind that it divides that cache across all of the servers connected to the SAN.

To create a larger file, we need to edit the param.txt text file in the directory where you installed SQLIO.  If you’re using Windows 2008 R2 or newer, this file is protected by the OS, so we need to start Notepad as Administrator first.  Go into Start, Program Files, Accessories, and then right-click Notepad and click Run As Administrator.  Then open the param.txt file where you installed SQLIO.

Param.txt

Param.txt

The c:\testfile.dat is the name of the test file that will be created.  Change that to be whatever drive you want to test, like e:\testfile.dat.

The last parameter (100 by default) is the test file size in megabytes.  To get a 20GB test file, replace 100 with 20480.  Your end result will look like this if you want to test the E drive:

e:\testfile.dat 2 0x0 20480
#d:\testfile.dat 2 0x0 100

You can ignore the second line since we’ll only be working with one test file at a time.  The # at the beginning means it’s commented out.

Save the file, but don’t close Notepad yet.  While you’re in there, click File, New, and let’s create a couple of batch files to run SQLIO lots of times with different parameters.  Copy/paste these lines into Notepad:

sqlio -kW -t8 -s120 -o8 -frandom -b8 -BH -LS E:\TestFile.dat
sqlio -kR -t8 -s120 -o8 -frandom -b8 -BH -LS E:\TestFile.dat
sqlio -kW -t8 -s120 -o8 -fsequential -b64 -BH -LS E:\TestFile.dat
sqlio -kR -t8 -s120 -o8 -fsequential -b64 -BH -LS E:\TestFile.dat

Save this in the SQLIO directory as test.bat.

What Do the SQLIO Parameters Mean?

While we’re looking at that set of commands, here’s a quick breakdown:

  • -kW and -kR: means we’re testing writes or reads
  • -t8 and -o8: means 8 threads with up to 8 outstanding requests at once.  SQLIO isn’t CPU-bound at all, and you can use more threads than you have processors.  The more load we throw at storage, the faster it goes – to a point.
  • -s120: means the test will last 120 seconds
  • -b8 and -b64: the size of our IO requests in kilobytes.  SQL Server does a lot of random stuff in 8KB chunks, and we’re also testing sequential stuff in 64KB chunks.
  • -frandom and -fsequential: random versus sequential access.  Many queries jump around randomly in the database, whereas things like backups, bulk loads, and table scans generally work sequentially.

You’ll notice I’m using a lot of general terms here about how some application patterns work.  Every SQL Server database has its own access patterns – random, sequential, big chunks, small pieces, and so on.  The four test lines you see above are shorthand examples of how some SQL Server IO patterns work.  We’re going to run a quick 4-part test first, and then come back to run much more in-depth tests shortly.

Step 3: Test the Disk Performance

Go to a Command Prompt (as administrator – yay, Windows) in the SQLIO directory and type:

sqlio -kW -s10 -fsequential -t8 -o8 -b8 -LS -Fparam.txt timeout /T 10

This will do a fast 10-second test, but more importantly it’ll create the test file using the file location and size parameters you specified in param.txt.  The first time you run it for a given drive, it’s going to be dead slow – it’s going to warn you that it has to create the test file.  Depending on your storage speed, this could take 15-20 minutes.  Once the test file creation is done, the subsequent tests will go much, much faster.  You can ignore the output of the above statement (as long as it’s not errors) and then type:

test.bat

This fires off the four-line test file.

Step 4: How to Interpret the SQLIO Results

SQLIO results look like this:

C:\Program Files (x86)\SQLIO>sqlio -kW -t8 -s120 -o8 -frandom -b8 -BH -LS -Fparam.txt
sqlio v1.5.SG
using system counter for latency timings, 3579545 counts per second
parameter file used: param.txt
 file e:\testfile.dat with 2 threads (0-1) using mask 0x0 (0)
2 threads writing for 120 secs to file e:\testfile.dat
 using 8KB random IOs
 enabling multiple I/Os per thread with 8 outstanding
 buffering set to use hardware disk cache (but not file cache)
using specified size: 20480 MB for file: e:\testfile.dat
initialization done
CUMULATIVE DATA:
throughput metrics:
IOs/sec:  1580.91
MBs/sec:    12.35
latency metrics:
Min_Latency(ms): 0
Avg_Latency(ms): 9
Max_Latency(ms): 2927
histogram:
ms: 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24+
%:  0 19 62 14  2  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  2

I’ve bolded the most important numbers above.  IOs/sec are the number of operations performed per second.  Storage guys call this IOPs.  MBs/sec are how much data moved around per second.  Storage guys call this throughput.

The histogram at the bottom shows how fast the storage responded in milliseconds.  Generally the numbers will either be all the way over to the left (0-3ms) or all the way over to the right (24+ ms).  We’re not too worried about this yet – first, we just want to see how fast the storage can go regardless of how long it takes to respond, because odds are, it’s not even going to respond fast.

So what do the numbers mean? Well, it depends – this is where everything’s relative.  You can compare your drive throughput to storage reviews at Tom’s Hardware.  In the example above, my storage only gave me 12 MBs/sec, which sounds atrocious at first – it’s in USB thumb drive territory – but that particular test was the random write test with just 8kb chunks.  That’s actually not terribly bad for the size of RAID array I was using at the time.

Disk Testing Alternatives: CrystalDiskMark, SQLIOSIM, Iometer

CrystalDiskMark Results

CrystalDiskMark Results

Let’s face it: SQLIO isn’t the easiest tool to use.  Sometimes you just want the easy button.  Here’s three popular tools that you can use to test the throughput of your storage.

CrystalDiskMark: The easy, free one-button solution (shown). This is about as easy as disk performance testing gets.  You download this tool, no installation required, and just click the big All button to start testing.  CrystalDiskMark generates sequential & random, read & write loads at your storage system in 512KB and 4KB chunks.  This gets you quick answers, but not necessarily SQL-related – after all, SQL Server doesn’t read or write in 512KB or 4KB chunks.  It’s an easy start though.  Download CrystalDiskMark for free here.

Iometer: The open-source, cross-platform tool. If you do a lot of SAN work, you might prefer a cross-platform tool that you can use across all of the clients that connect to the SAN.  Iometer works on Windows and Linux.  I gotta be honest with you: Iometer isn’t the friendliest tool around.  I think it makes SQLIO look easy.  Download Iometer free here.

SQLIOSim: Like SQLIO, but really SQL-related. While SQLIO doesn’t really simulate SQL Server IO at all, that’s where SQLIOSim comes in.  You can pass in all kinds of parameters to simulate OLTP databases, OLAP databases, Enterprise Edition read-aheads, and much more.  Download SQLIOSim for free here, and then get the free SQLIOSim Parser from Microsoft’s Jens Suessmeyer & Jimmy May.

Want Help Configuring & Testing Your Storage?

We specialize in helping companies configure and tune their SANs, SSDs, and direct attached storage.  Here’s where to go next:

If you’re stumped, zip up your SQLIO results text files and send them to us at Help@BrentOzar.com.  Tell us a little about the server and the kinds of problems you’re having, and we’ll be glad to take a quick look and see if anything jumps out at us.  You can also use the form below as long as the zip file’s under 10MB.

Your Name (required):

Your Email (required):

Your Phone Number:

File Attachment (10MB max):

Your Message

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

More Posts - Website

Follow Me:
TwitterFacebookLinkedInGoogle PlusYouTube

Oracle announces cloud computing support

I don’t have much insight to add here, but it’s something my readers are probably into: Oracle now supports running on Amazon EC2.  They’ve got prebuilt EC2 instances that you can just turn on, a cloud management portal, and licensing options.

This is such a cool time to be a database administrator.  I can’t wait for the day where people don’t make bad architecture decisions just because they can’t afford to get a real database (and I don’t just mean Oracle by that, of course) from the get-go.

Brent Ozar

Brent specializes in performance tuning for SQL Server, VMware, and storage. He's one of the very few Microsoft Certified Masters of SQL Server, a published author, and a Microsoft MVP. He likes travel, Jeeps, Apple gear, jokes, and writing about himself in the third person. Read more and contact Brent.

More Posts - Website

Follow Me:
TwitterFacebookLinkedInGoogle PlusYouTube