LVM in Linux Environment Case Study
LVM in Linux Environment Case Study
Keywords: disk model; ext3/ext2; file systems; hard disks; journaling; Linux; LVM-Logical Volume Manager
Ključne riječi: datotečni sustavi; ext3/ext2; journaling; Linux; LVM-Logical Volume Manager; model diska; tvrdi diskovi
non-LVM file system, for specified workload, comprises Actually, there are three dominant components,
following components: whose sum can be presented as disk service time TDST,
which is the service time for a request related to the disk
TFSA = TDO + TMO + TFL + TDFA + TJ . (1) mechanism.
These components are: (1) the seek time TSeek, which
Where TFSA (File System Access time) represents total is the amount of time needed to move the disk heads to
time that workload needs to carry out all operations; TDO the desired cylinder; (2) the rotational latency time TRL,
(Directory Operation time) represents the total time for all which stands for the time that the platter needs to rotate to
operations related to working with directories (search, the desired sector; and (3) the transfer time TM, is the time
new object creation and delete of existing objects); TMO to transfer the data from the disk medium to the next
(Metadata Operation time) represents total time needed higher level. Since these are typically independent
for performing metadata operations (metadata search variables, we can approximate the expected value of the
operations, metadata cache forming, and metadata objects disk mechanism service time to:
modifications); TFL (Free List time) presents total time
needed for performing operations with free blocks and i- TDST = TSeek + TRL + TM . (5)
node lists (file expansion/shrinking, creation of new
objects or deletion of existing objects); TDFA (Direct File The transfer time TM, is a function of two parameters,
Access time) is the time required for direct file blocks the transfer rate RT, which is the transfer rate of data
operations (read/write); TJ (Journaling time) is total time off/onto the disk and SR which represents the request size.
needed for performance of journaling operations, Function can be approximated to:
covering metadata writes to the log, and metadata log
discharge. SR
Directory operations TDO, metadata operations TMO TM = . (6)
RT
and direct file accesses TDFA are cache based accesses and
their performances directly depend on cache. Under these
conditions, the expected cache service time would be: Some variations will occur as a result of track and
cylinder switches operations and existence of different
track sizes in different disk zones. The rest of this section
SR
TCST ≈ PH ⋅ + PM ⋅ TDST . (2) describes our technique for approximating seek time and
RCT rotational latency time parameters.
Seek time. The seek time TSeek, can be approximated
Where Cache Service Time is represented by TCST, hit as the following function of dis, which is the distance
probability is denoted by PH, and represents the number calculated based on the number of cylinders to be
of hits in cache versus the total number of requests, while travelled [30]:
PM, miss probability, represents the probability of cache
miss, counted as number of misses in a cache versus the 0 dis = 0
total number of requests. The cache transfer rate is
marked by RCT, SR is expected request size, while disk TSeek [dis ] = a + b dis 0 dis ≤ e, (7)
service time TDST, is the total time needed to perform disk c + d ⋅ dis dis = e
data transfer.
In the case of cache-miss, performances are strictly
dependent on disk characteristics TDST, and consist of where a, b, c, d and e are device-specific parameters. The
number of time based components [30]: parameters a, b, c, d are obtained with an interpolation of
the seek function which is obtained after multiple
intensive measurements of time needed for positioning of
TDST = TA + TM + TI . (3)
a specific hard drive.
Rotational latency time. If we assume that the
Where access time, TA is total access time needed for requests are randomly distributed on the sectors of the
mechanical components of disk transfer, TM is total time given cylinder using a uniform distribution, than the
needed for write/read operations from disk medium, and rotational latency time would be calculated as 1/2 of full
interface time TI is total time needed for read/write rotation time, Rrotate according to:
operations from disk cache buffer. The access time is
further defined as:
Rrotate
TRL = . (8)
TA = TCO + TSeek + TSetle + TRL . (4) 2
Although on the basis of Eq. (10), we expect that LVM Table 1 FS layout without LVM
slows the performances, we must be careful. In the area of File system Size description
the computer techniques many things are not obvious as LogVol00 58GB root FS
they can look like. For example, let's take the journaling LogVol01 1GB Swap
dev/sda3 20GB testing FS
technique into consideration. Many potential users will
think that journaling techniques with their additional log
writes would slow down the performances, but experience In the second case, LVM is made of one physical
shows that this is not always the case. Many papers that volume (/dev/sda3 as a physical volume of 20 GB and
can be found as open literature, including some of our logical group LogVol02 of 20GB in ext3 format), as
own researches [9], show that journaling can also provided in Tab. 2.
accelerate the performance. Thus, from these
Table 2 FS layout with an LVM composed of one PV, LVM-1
experimental researches we could learn that nothing can File system Size Description
be taken as obvious, but it has to be proven. LogVol00 58GB root FS
A very similar situation can occur in the case of LogVol01 1GB Swap
LVM/Non-LVM environments. We have tried to very dev/sda3 20GB physical volume
precisely examine: (1) whether LVM slows down or even LogVol02 20GB testing FS
improves the performances; (2) what are the
circumstances when it slows down; and (3) what are the In the third case, LVM is composed of two physical
parameters that this trend depends on. volumes (/dev/sda3 and /dev/sda4 as physical volumes of
10GB and logical group LogVol02 of 20 GB in ext3
4 Mathematical model validation and result analysis format). Details are given in Tab. 3.
For second and third case, an empty ext3 file system
The validation of the proposed mathematical model, is created in a logical group LogVol02. LogVol02 is
as well as the confirmation of stated hypotheses is specially created for the purpose of testing, and it can be
achieved through a synthetic benchmarking for 32bit ext3, accessed through the path /dev/mapper/VolGroup00-
which is one of the most stable, fast and widely accepted LogVol02. The file system used for testing is of exactly
32bit journaling file systems, with a long history of bug- the same size for all the tests and tested LVM levels.
fixes and performance improvements. We emphasize that
this file system is still relevant, as there is a large number Table 3 FS layout with an LVM composed of two PVs, LVM-2
of ext3 file system users. Just to mention that ext3 file File system Size Description
system is often present in Linux Xen virtualization, which LogVol00 58 GB Root FS
shows superior results in comparison to competitors LogVol01 1 GB Swap
(KVM, VMware, Hyper-V). However, such a Linux Xen- dev/sda3 10 GB physical volume
based virtualization is typical for some older Linux dev/sda4 10 GB physical volume
distributions, where ext3 was the default file system (FS). LogVol02 20 GB testing FS
Although the newer ext4 file system would be an
interesting topic for LVM examination, there is also a 4.2 Testing procedures and analysis
long list of possible FS candidates for creating LVM
volumes: 32bit ext2/ext3, and different 64bit file systems For the purpose of this paper we have used PostMark
(ext4, xfs, jfs, btrfs). As we have thoroughly examined the [31], software that simulates loading an Internet Mail
LVM vs. non-LVM for ext3, we believe that it would be server. PostMark creates a large initial pool of randomly
interesting for further work to proceed with same testing generated files in any place in the file system. This pool is
procedure for the mentioned 64bit candidates, and we further used for creating, reading, writing and file
expect that the results would confirm our hypotheses, deleting, and the time required for these operations is
especially H1 and H3 (that LVM introduces performance determined. The sequence of these operations is random
decrease when compared to native file system, and that therefore the simulation credibility is guaranteed. The
these decelerations are greatly affected by the complexity number of files, their size range and the number of
of the LVM configuration). transactions are fully configurable. In order to eliminate
the cache effect it is recommendable to create an initial
4.1 Test configuration pool with as many files as possible (at least 10,000) and
perform as many transactions as possible.
For testing purposes, we have chosen disks from the We have presented the results of three different test
WDC WD800BD-22MR-80GB series (80 GB, average procedures. Test 1 is based on testing of small files (file
seek time 8,9 ms, rotational speed 7200 rpm, maximum sizes between 1KB and 100KB) and this test results will
disk buffer throughput 1,5 Gb/sec) and Red Hat Linux be a reference when comparing other test results. Test 2
version Fedora 10 with kernel version 2.6.27. For the considers drastically smaller files (sizes between 1byte
purpose of testing, the file system is organized in the form and 1KB) and appreciably increased number of generated
of logical partitions, where the last part of disk (20GB) is files, which will generate high number of metadata
created in three different ways and used for testing. operations with ultra-small objects. Test 3 considers
In the first case, direct file system realization was slightly increased size of generated files when comparing
created without the use of LVM (/dev/sda3 of 20GB in to Test 1, which implies higher dataflow in workload.
ext3 format), as it is provided in Tab. 1.
LVM realization with one physical volume is H3. LVM shows greater loading and weaker
significantly faster (2,5 times) than an LVM realization performance if realized in a more complex way,
with 2 physical volumes. meaning that if an LVM is created from several
The workload for this test is characterized with lower different volumes it is possible to achieve
number of files (4000), moderate number of create/delete significantly lower performances. It is also expected
operations, file size of 100 k ÷ 300 k, and solid amount of that the performances will further decrease if a LVM
reads/writes (4.6GB-r/5.4GB-w). Having into is created from volumes located on different physical
consideration the Eq. (1), it can be expected that TDFA disks, which was not directly tested in this paper and
component will be dominant. Again, it is worth will be discussed in some further work.
considering Eq. (11), and notice that in Test 3, as the size • The performance decrease depends directly on the
of tested files has increased in comparison to the files workload, number of the required disk operations,
generated in Test 1, there is appreciably higher number of metadata operations and number of direct file block
file blocks, while the number of metadata operations is operations (confirmation of the H4 hypothesis).
approximately the same as in Test 1. Therefore, the file • The main cause of the noticed performance decline is
blocks mapping overhead in LVM has dominant role to the feature of remapping. The remapping in the case
the very significant decreasing of LVM performances. of the LVM is performed by the DMD. This
The more complex file block remapping procedure for procedure is weakly compensated by the remapping
increased number of file blocks in the case of LVM-2 has caching. The obtained results confirm the H2
caused appreciable decrease in performance when hypothesis.
compared to LVM-1, and this difference is more intense
than the one detected in Test 1. It is pointed out to the users that the complex LVM
implementation should be an interim solution, while final
4.3 General remarks for all three Postmark tests one should be the LVM with the simplest possible design
or non-LVM at all.
In this paper, we have presented the results of Our LVM test methodology fits well when dealing
PostMark tests for (1) basic file system without the use of with QoS (Quality of Service) issues related to
LVM, and (2) two LVM realizations with one or two virtualization and cloud computing, as the concept of
physical volumes. Our goal was to consider different LVM is often seen as file system options for Linux based
working circumstances, by first examining a workload of host and guest operating systems. Therefore, LVM could
small files, and then in the second test substantially have a large performance impact on virtual environments,
increased the number of metadata operations, while in the different cloud computing environments, as well as to
third experiment we have considerably increased the data centers. Many Linux users or administrator will
number of blocks for file transfer. linearly proceed with expand their storage space of
Taking into consideration all the obtained results, as existing workstations/servers by simply adding new hard
the confirmation of the preliminary hypotheses H1 ÷ H4, drives, thus obtaining the needed expansion in rapid and
it can be observed that the native non-LVM realization is non-destructive way. Their existing LVM volumes will be
solidly better than LVM, while LVM with one or two expanded with new disks and partitions without data loss,
physical volumes shows significantly lower performance which is a relatively quick procedure and is in compliance
in 2 out of 3 tests: in the test with ultra-small files and in with the primary purpose of LVM (easy storage
the test with somewhat larger files, in each case with huge expansion/shrinking). But, in that way there is a risk of
number of disk metadata or direct file access operations. creating relatively complex LVM designs. In this paper, it
is proved that the complex LVM can suffer from
5 Conclusion significant performance decline, and showed that this
quick and easy solution based on the LVM volume
The obtained experimental results fully confirm the spreading should be just an interim solution, not the final
set of preliminary hypotheses and validate the proposed one. The suggested solution is based on first proceeding
mathematical model. The beneficial characteristics of with long-term full backup operation, following with
LVM should be highly appreciated, as LVM provides the reconfiguration of the used LVM to the simplest possible
flexible widening of file systems, with new partitions on design. Finally, after these steps it is recommendable to
the same or different disks, during which there is no data run a full restore procedure. Alternatively, in the presence
loss. But it has to be taken care of the fact that LVM of the performance-critical applications, it is
represents a new layer in the virtual file system hierarchy, recommendable to proceed with the complete replacement
which creates overheads for processing, thus has a of the LVM with available native file system.
negative impact on performances. The compensation of Future work will encompass performance analysis of
the LVM mapping overhead is partially performed by more sophisticated LVM types, with focus on LVM case
file-caching features, although it is always present in when implementing multiple partitions and multiple
some form. This is confirmed by the provided test results. physical disks. It will cover LVM performances on the
In general we can conclude that: 64bit file systems as an enhancement to the results
• LVM provides reduced level of performances when presented in this paper, as well as LVM on the RAID,
compared to non-LVM file system, which confirms LVM with activated snapshots options and LVM in the
H1. virtual and cloud computing environment.
• Decrease in performances highly depends on the
complexity of LVM configuration, thus confirming