views:

29

answers:

3

Hello All,

I want to ensure I have done all I can to configure a system's disks for serious database use. The three areas I know of (any others?) to be concerned about are:

  1. I/O size: the database engine and disk's native size should either match, or the database's native I/O size should be a multiple of the disk's native I/O size.
  2. Disks that are capable of Direct Memory Access (eg. IDE) should be configured for it.
  3. When a disk says it has written data persistently, it must be so! No keeping it in cache and lying about it.

I have been looking for information on how to ensure these are so for CENTOS and Ubuntu, but can't seem to find anything at all!

I want to be able to check these things and change them if needed.

Any and all input appreciated.

PLEASE NOTE: The actual hardware involved is VERY modest. The point is to get the most out of what hardware we do have, even though it's "not very serious hardware" from a broader perspective.

MORE:

I appreciate the time taken to read and reply, but I'm hoping to get "answers" that aren't just good database / hardware advice but answers that actually address the specific things I asked about. Namely:

1) What's a good easy way to tell what the I/O unit size is that the OS wants to do? How can I change it? (IOW: If this exclusively a file-system-format issue, how can I tell what was used on an already-created file system? I know /etc/fstab will tell me the file system format... In this case, it's ext3.

2) How can I tell if a disk drive has DMA? If so, how can I turn it on? (I've been told that some drives have this capability, but now I want to follow up and ensure that if these drives have it, it's turned on.)

And, finally;

3) How can I tell if a drive is merely telling the writer that their material is written when it's actually still in cache? And, more importantly, how can I set the system to NOT use such features if / when they exist?

Thank you for your insights. RT

+1  A: 

"serious database use" and you mention IDE in the same sentence?

SSDs or 15k SCSI in a many spindle RAID 1+0 array with separate arrays for data, log and backup. Consider a separate array for tempdb too.

You'd also switch the controller cache to 100% read too to avoid caching issues

Of course, if it's "serious" then you'd consider clustering etc: so a SAN comes in useful here but you may not be as quick as local spindles

gbn
+1, yes, I've never had any good come of using write-back cache.
mrjoltcola
Hey, don't laugh! (OK, laugh away! -smile- ) This is for a customer who sells a solution including a really cheap set of hardware that the solution comes pre-installed on... No, I have nothing to do with the choices!
Richard T
BTW, "serious" meaning not that this is for a big data center, serious as in we need to get as much out of what hardware we do have.
Richard T
I sympathise... back in my 100% DBA days I've seen vendors sell large systems with "minimum RAID 5" and had to argue the toss with an analyst or a business person...
gbn
A: 

You didn't include any info on filesystem or database, so here are some misc pointers.

It is inevitable that you will lose a disk eventually, so its equally important to put a good backup and recovery strategy in place, and mirror your transaction logs, so you can handle a disk failure or even full datafile loss.

1) If possible, put at least one copy of your transaction log on a fixed disk. Don't put your sole transaction log to an external storage subsystem. (Assuming you use a db that supports log mirroring).

2) I agree with gbn, in practice, don't use write caching. I've lost databases on RAID arrays with battery backup. Configure the storage controller card for write-through.

3) Raw devices provide guaranteed writes, but its not worth the hassle. Some filesystems provide synchronous write options too, use one if possible. I am partial to VxFS, but I'm from the Sun world. On Linux, btrfs is eminent at least, but for now, Ext3 works fine if you setup your db properly.

mrjoltcola
Do I gather correctly that merely using the sync option in fstab is sufficient? Somehow I doubt it! I mean; if the hardware has this cache, lie when writes complete feature, it may not honor the OS' wishes regarding sync... To clarify; are there OS / kernel level features that are used to tell drives what to do in such regards?
Richard T
When I said sync, I meant the filesystem supports it, and the user process (the database) can open its datafiles in synchronous mode.
mrjoltcola
+1  A: 

1) Check /sys/block/sdX/queue/{max_hw_sectors_kb,max_sectors_kb}. The first is that max transfer size the hw allows, the other is the current maximum which can be set to any value <= max_hw_sectors_kb

2) hdparm -i /dev/sdX

3) Turn off write-back caching (hdparm can do it), or make sure that the filesystem issues barriers when synchronizing (as in fsync(), or journal commit).

janneb