2012年12月3日月曜日

AIX Makes Using RAM Easy

One of the most common concerns for system administrators is maximizing disk performance. The AIX command mkramdisk is ideal for producing very high speed I/O by letting the memory do all the work.

Database administrators are well aware of the benefits of keeping frequently accessed data in memory in order to reduce the need to retrieve that data from disk. The AIX mkramdisk command allows system administrators to create memory-resident file systems. The performance benefits of using RAM disk can be astonishing. The unload of a large TSM database was reduced from 40 hours on SAN disks down to 10 minutes using RAM disk.

Forgotten memory

If RAM disk is so spectacularly fast, why is it one of AIX's best kept secrets? Two good reasons spring to mind. First, most OSs started out with RAM measured in megabytes, not gigabytes. That meant using large chunks of memory for file systems– -or anything that might be memory-hungry–-was always avoided. The second reason is RAM disk doesn't survive a reboot, and system outages were much more common 20 years ago. Many servers had scheduled reboots every week, "just to clear out the cobwebs."

Although the mkramdisk command has been around since AIX 4.3, it's only now starting to be appreciated for the powerful tool that it is. As servers today have greater memory allocations, and with OS outages greatly reduced if not completely eliminated, using RAM disk file systems becomes a very attractive option.

Configuring RAM disk

The configuration of a RAM disk file system is very simple and takes just a few minutes. Once the file system is mounted, it can be used like any other file system. There are three steps involved: creating the RAM disk, making the file system and then mounting the file system.

First, we create the RAM disk, specifying the size we want. Let's create a RAM disk of 20 GB:

# mkramdisk 20G

The system will assign the next available RAM disk. Since this is our first one, it will be assigned the name ramdisk0:

# ls -l /dev | grep ram

If there isn't sufficient available memory to create the RAM disk you have requested, the mkramdisk command will alert you. Free up some memory or create a smaller size RAM disk. You can use Dynamic LPAR on the HMC or IVM to assign more memory to your partition.

Creating a JFS2 file system

We could use the RAM disk /dev/ramdisk0 as a raw logical volume, but here we're going to create and mount a JFS2 file system. Here's how to create the file system using the RAM disk as its logical volume:

# mkfs -V jfs2 /dev/ramdisk0

Now create the mount point:

# mkdir -p /ramdisk0

And mount the file system:

# mount -V jfs2 -o log=NULL /dev/ramdisk0 /ramdisk0

You should now be able to see the new file system using df and you can write to it as you would any other file system. When you're finished, unmount the file system and then remove the ramdisk using the rmramdisk command.

Using pinned memory

The mkramdisk man page advises that when using a file system on a RAM disk, the RAM disk must be pinned. This may explain why a partition with 150 Gb of RAM allocated to it, can't create a RAM disk of 140 Gb. You may not have that much available pinned memory.

Check the output of svmon –P to determine how much pinned memory you can allocate to a RAM disk. You may also need to adjust the vmo setting maxpin% to ensure you haven't hit an upper limit of the memory you can allocate to a RAM disk.

A Good Memory

Using RAM disk offers outstanding performance benefits for logical volumes and file systems that don't need to survive a reboot. RAM disk is quick and easy to configure and can resolve sometimes overwhelming I/O performance issues.

Resources

IBM Info Center, "Commands reference: mkramdisk"
http://publib.boulder.ibm.com/infocenter/systems/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds3/mkramdisk.htm

0 件のコメント:

コメントを投稿