Showing posts with label storage. Show all posts
Showing posts with label storage. Show all posts

April 9, 2014

Storage Statics

In a physical server, storage such as RAM and persistent block storage is treated in a rather static way by the operating system. This makes sense since usually new storage is not added on the fly but involves a reboot, when you open the chassis and plug the new hardware in. There are some expensive machines that can do it while running, but I have never seen somebody buying one. For a virtual server this does not change a lot. I still spent a lot of time scheduling a maintenance window of a server to just shut it down, bump its virtual memory and power it up again. Or trying to find out if and how I can resize that disk on the fly through the endless layers of storage protocols, block devices, volume managers, partition tables and filesystems.

Virtual Storage

So for virtual servers this static view of storage resources makes much less sense. There is no physical task involved when adding storage and it is shared among multiple guests on the same host. But its only natural if you know that the implementation comes from the design for physical servers. The main goals I see are:

  1. Provide additional storage to a guest when it needs it.
  2. Give back unneeded storage so other guests in need can use it.
There are a few hacks that make this easier in the virtualized world:
  • Lazily initialize storage. So you can give a guest much more than it needs now without really occupying the space. Later on it will not be necessary to reboot it for more storage. Of course once the Kernel sees all that free RAM it will gladly use it as I/O cache and fill it up. And your not so lazy initializing filesystem will take a very long time writing all that meta information at mkfs time for the mega-sized disk. To be fair I/O caching is tuneable and there are lazily initializing filesystems. But once the storage is written its initialized and there is no more chance to free it. There is no giving back of free RAM or unused blocks on disk. And the host system can not know from the outside what blocks are actually free. Although there is something like memory ballooning, but that looks a bit hacky to me. So this somehow works around goal 1 and does nothing for 2.
  • Hot add/grow storage. Seems to work fairly good these days. For memory this works fine. For block storage you still have to kick the OS a bit so that it sees the new blocks and resizes the volumes and filesystems. Goal 1 achieved. But giving back storage is still a no go, I have never seen a hot remove.
  • Deduplication. Does not really achieve any of the two goals. But it helps so you can overcommit storage on the host and give the guests more resources in the first place. So you do not have to worry about adding later on.

The malloc/free for system resources

In the same way resources are shared between processes within one system, why can one not share resources between virtual guests on a host? Reserve and guarantee certain amounts to a guest, request additional resources from the host and release them back to the host if not needed anymore. I wonder what it would take to implement this ...

June 24, 2010

A Storage Nightmare

Recently, I faced the following storage setup for a virtual server, and instantly I got a headache from it:

  1. An enterprise storage system that abstracts almost everything presents a simple SCSI device with a virtual LUN on the SAN.
  2. VMWare binds the LUN and formats it with VMFS, its proprietary cluster filesystem.
  3. Inside the VMFS one VMDK file is created that uses all the space.
  4. The VMDK file is attached as virtual disk to the guest system.
  5. Inside Linux, the disk is partitioned into one primary partition, which is formatted as an LVM physical volume. It belongs to one volume group, from which multiple logical volumes are created.
  6. The logical volumes are formatted with ext3.
To summarize this setup: The data from the application goes over 2 filesystem layers (ext3, VMFS) and 3 virtualization layers (LVM, VMWare, storage system) until it finally reaches the disk.

As if this wasn't enough to cause a headache, I further discovered some special setups:

  • Multiple LUNs are aggregated to one device in VMWare to work around the maximum size limit of the storage system.
  • The Linux LVM layer stripes a logical volume over multiple LUNs, which are directly passed through by VMWare from the SAN. Apparently the intention was to use LUNs from different RAID groups in the storage system for performance increase.

Consider a simple question like "This filesystem is too slow, which volume in the storage system do we have to move to a faster tier?". To answer it you might get yourself into quite some typing: Look up the device of the filesystem's mount point, map the logical volume to the right volume group, look up the physical volume for it, remember its LUN, in VMWare map the LUN to the right virtual disk, identify the VMFS where the disk's VMDK file lies, and finally look up the LUN for the VMFS. Oh my!

The different layers in this setup surely have their reasons. The storage system hides the fact that you actually have a lot of small disks instead of a huge pool. It gives you reliability and flexibility when migrating and expanding your data volumes. Without the VMWare layer you loose snapshot functionality. But then again, snapshots are also something you find in the LVM layer. As you do with logical volume management. It is somehow present in both, the storage system and LVM. This redundancy between layers and the missing integration between them leads to really bad understanding and probably also bad performance, but I would not want to have to debug the latter.

Another fundamental problem in this respect is the block layer. There are such things like adding a SCSI device on a running system. But all dynamic functions that go beyond this are implemented in layers on top of that. Wouldn't it be nice to e.g. implement dynamic resizing in the block layer? You just resize the volume in the SAN and instantly the system sees more space and adds it to the filesystem. No manual work is needed like adding a new disk in VMWare or extending the volume group with a new physical volume and growing the logical volume.

ZFS got the integration of layers right. Inside a pool you do not have a static partitioning that allocates blocks to a filesystem in the first place. Resizing volumes is merely a matter of setting quotas and reservations that are totally dynamic. But besides working in the direction of applications and integrating network filesystems like Lustre and databases into ZFS, it is also interesting to go into the other direction of integrating and enhancing the block layer. One way would be to integrate it better with existing SCSI and Fibrechannel protocols to better cooperate with existing SAN solutions. Yet a more interesting way would be to eliminate the classic SAN and let ZFS do all the work. What ZFS currently lacks is fine grained control over how data is arranged on disks. E.g. the definition of different tiers with different speeds and moving filesystems dynamically between them. And then there are all the pretty things that come with storage networks: multipathing, replication, server based RAIDs, clustering, et cetera, et cetera.