<s>
dm-cache	B-Application
is	O
a	O
component	O
(	O
more	O
specifically	O
,	O
a	O
target	O
)	O
of	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
's	O
device	B-Application
mapper	I-Application
,	O
which	O
is	O
a	O
framework	B-Architecture
for	O
mapping	O
block	O
devices	O
onto	O
higher-level	O
virtual	B-Application
block	I-Application
devices	I-Application
.	O
</s>
<s>
It	O
allows	O
one	O
or	O
more	O
fast	O
storage	O
devices	O
,	O
such	O
as	O
flash-based	O
solid-state	B-Device
drives	I-Device
(	O
SSDs	B-Device
)	O
,	O
to	O
act	O
as	O
a	O
cache	B-General_Concept
for	O
one	O
or	O
more	O
slower	O
storage	O
devices	O
such	O
as	O
hard	B-Device
disk	I-Device
drives	I-Device
(	O
HDDs	B-Device
)	O
;	O
this	O
effectively	O
creates	O
hybrid	O
volumes	O
and	O
provides	O
secondary	O
storage	O
performance	O
improvements	O
.	O
</s>
<s>
The	O
design	O
of	O
dm-cache	B-Application
requires	O
three	O
physical	O
storage	O
devices	O
for	O
the	O
creation	O
of	O
a	O
single	O
hybrid	O
volume	O
;	O
dm-cache	B-Application
uses	O
those	O
storage	O
devices	O
to	O
separately	O
store	O
actual	O
data	O
,	O
cache	B-General_Concept
data	O
,	O
and	O
required	O
metadata	O
.	O
</s>
<s>
Configurable	O
operating	O
modes	O
and	O
cache	B-General_Concept
policies	O
,	O
with	O
the	O
latter	O
in	O
the	O
form	O
of	O
separate	O
modules	O
,	O
determine	O
the	O
way	O
data	O
caching	B-General_Concept
is	O
actually	O
performed	O
.	O
</s>
<s>
dm-cache	B-Application
is	O
licensed	O
under	O
the	O
terms	O
of	O
GNU	B-License
General	I-License
Public	I-License
License	I-License
(	O
GPL	B-License
)	O
,	O
with	O
Joe	O
Thornber	O
,	O
Heinz	O
Mauelshagen	O
and	O
Mike	O
Snitzer	O
as	O
its	O
primary	O
developers	O
.	O
</s>
<s>
dm-cache	B-Application
uses	O
solid-state	B-Device
drives	I-Device
(	O
SSDs	B-Device
)	O
as	O
an	O
additional	O
level	O
of	O
indirection	O
while	O
accessing	O
hard	B-Device
disk	I-Device
drives	I-Device
(	O
HDDs	B-Device
)	O
,	O
improving	O
the	O
overall	O
performance	O
by	O
using	O
fast	O
flash-based	O
SSDs	B-Device
as	O
caches	B-General_Concept
for	O
the	O
slower	O
mechanical	O
HDDs	B-Device
based	O
on	O
rotational	O
magnetic	B-Architecture
media	I-Architecture
.	O
</s>
<s>
As	O
a	O
result	O
,	O
the	O
costly	O
speed	O
of	O
SSDs	B-Device
becomes	O
combined	O
with	O
the	O
storage	O
capacity	O
offered	O
by	O
slower	O
but	O
less	O
expensive	O
HDDs	B-Device
.	O
</s>
<s>
Moreover	O
,	O
in	O
the	O
case	O
of	O
storage	O
area	O
networks	O
(	O
SANs	O
)	O
used	O
in	O
cloud	B-Architecture
environments	O
as	O
shared	O
storage	O
systems	O
for	O
virtual	B-Architecture
machines	I-Architecture
,	O
dm-cache	B-Application
can	O
also	O
improve	O
overall	O
performance	O
and	O
reduce	O
the	O
load	O
of	O
SANs	O
by	O
providing	O
data	O
caching	B-General_Concept
using	O
client-side	O
local	O
storage	O
.	O
</s>
<s>
dm-cache	B-Application
is	O
implemented	O
as	O
a	O
component	O
of	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
's	O
device	B-Application
mapper	I-Application
,	O
which	O
is	O
a	O
volume	B-Application
management	I-Application
framework	B-Architecture
that	O
allows	O
various	O
mappings	O
to	O
be	O
created	O
between	O
physical	O
and	O
virtual	B-Application
block	I-Application
devices	I-Application
.	O
</s>
<s>
The	O
way	O
a	O
mapping	O
between	O
devices	O
is	O
created	O
determines	O
how	O
the	O
virtual	O
blocks	B-General_Concept
are	O
translated	O
into	O
underlying	O
physical	O
blocks	B-General_Concept
,	O
with	O
the	O
specific	O
translation	O
types	O
referred	O
to	O
as	O
targets	O
.	O
</s>
<s>
Acting	O
as	O
a	O
mapping	O
target	O
,	O
dm-cache	B-Application
makes	O
it	O
possible	O
for	O
SSD-based	O
caching	B-General_Concept
to	O
be	O
part	O
of	O
the	O
created	O
virtual	B-Application
block	I-Application
device	I-Application
,	O
while	O
the	O
configurable	O
operating	O
modes	O
and	O
cache	B-General_Concept
policies	O
determine	O
how	O
dm-cache	B-Application
works	O
internally	O
.	O
</s>
<s>
The	O
operating	O
mode	O
selects	O
the	O
way	O
in	O
which	O
the	O
data	O
is	O
kept	O
in	O
sync	O
between	O
an	O
HDD	O
and	O
an	O
SSD	B-Device
,	O
while	O
the	O
cache	B-General_Concept
policy	O
,	O
selectable	O
from	O
separate	O
modules	O
that	O
implement	O
each	O
of	O
the	O
policies	O
,	O
provides	O
the	O
algorithm	O
for	O
determining	O
which	O
blocks	B-General_Concept
are	O
promoted	O
(	O
moved	O
from	O
an	O
HDD	O
to	O
an	O
SSD	B-Device
)	O
,	O
demoted	O
(	O
moved	O
from	O
an	O
SSD	B-Device
to	O
an	O
HDD	O
)	O
,	O
cleaned	O
,	O
etc	O
.	O
</s>
<s>
When	O
configured	O
to	O
use	O
the	O
multiqueue	O
(	O
mq	O
)	O
or	O
stochastic	O
multiqueue	O
(	O
smq	O
)	O
cache	B-General_Concept
policy	O
,	O
with	O
the	O
latter	O
being	O
the	O
default	O
,	O
dm-cache	B-Application
uses	O
SSDs	B-Device
to	O
store	O
the	O
data	O
associated	O
with	O
performed	O
random	B-General_Concept
reads	I-General_Concept
and	I-General_Concept
writes	I-General_Concept
,	O
capitalizing	O
on	O
near-zero	O
seek	O
times	O
of	O
SSDs	B-Device
and	O
avoiding	O
such	O
I/O	B-General_Concept
operations	I-General_Concept
as	O
typical	O
HDD	O
performance	O
bottlenecks	O
.	O
</s>
<s>
The	O
data	O
associated	O
with	O
sequential	B-General_Concept
reads	I-General_Concept
and	O
writes	O
is	O
not	O
cached	O
on	O
SSDs	B-Device
,	O
avoiding	O
undesirable	O
cache	B-General_Concept
invalidation	I-General_Concept
during	O
such	O
operations	O
;	O
performance-wise	O
,	O
this	O
is	O
beneficial	O
because	O
the	O
sequential	B-General_Concept
I/O	I-General_Concept
operations	O
are	O
suitable	O
for	O
HDDs	B-Device
due	O
to	O
their	O
mechanical	O
nature	O
.	O
</s>
<s>
Not	O
caching	B-General_Concept
the	O
sequential	B-General_Concept
I/O	I-General_Concept
also	O
helps	O
in	O
extending	O
the	O
lifetime	B-Error_Name
of	I-Error_Name
SSDs	I-Error_Name
used	O
as	O
caches	B-General_Concept
.	O
</s>
<s>
Another	O
dm-cache	B-Application
project	O
with	O
similar	O
goals	O
was	O
announced	O
by	O
Eric	O
Van	O
Hensbergen	O
and	O
Ming	O
Zhao	O
in	O
2006	O
,	O
as	O
the	O
result	O
of	O
an	O
internship	O
work	O
at	O
IBM	O
.	O
</s>
<s>
Later	O
,	O
Joe	O
Thornber	O
,	O
Heinz	O
Mauelshagen	O
and	O
Mike	O
Snitzer	O
provided	O
their	O
own	O
implementation	O
of	O
the	O
concept	O
,	O
which	O
resulted	O
in	O
the	O
inclusion	O
of	O
dm-cache	B-Application
into	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
.	O
</s>
<s>
dm-cache	B-Application
was	O
merged	O
into	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
mainline	O
in	O
kernel	B-Operating_System
version	O
3.9	O
,	O
which	O
was	O
released	O
on	O
April	O
28	O
,	O
2013	O
.	O
</s>
<s>
In	O
dm-cache	B-Application
,	O
creating	O
a	O
mapped	O
virtual	B-Application
block	I-Application
device	I-Application
that	O
acts	O
as	O
a	O
hybrid	O
volume	O
requires	O
three	O
physical	O
storage	O
devices	O
:	O
</s>
<s>
Internally	O
,	O
dm-cache	B-Application
references	O
to	O
each	O
of	O
the	O
origin	O
devices	O
through	O
a	O
number	O
of	O
fixed-size	O
blocks	B-General_Concept
;	O
the	O
size	O
of	O
these	O
blocks	B-General_Concept
,	O
equaling	O
to	O
the	O
size	O
of	O
a	O
caching	B-General_Concept
extent	B-Application
,	O
is	O
configurable	O
only	O
during	O
the	O
creation	O
of	O
a	O
hybrid	O
volume	O
.	O
</s>
<s>
The	O
size	O
of	O
a	O
caching	B-General_Concept
extent	B-Application
must	O
range	O
between	O
32KB	O
and	O
1GB	O
,	O
and	O
it	O
must	O
be	O
a	O
multiple	O
of	O
32KB	O
;	O
typically	O
,	O
the	O
size	O
of	O
a	O
caching	B-General_Concept
extent	B-Application
is	O
between	O
256	O
and	O
1024KB	O
.	O
</s>
<s>
The	O
choice	O
of	O
the	O
caching	B-General_Concept
extents	B-Application
bigger	O
than	O
disk	B-Application
sectors	I-Application
acts	O
a	O
compromise	O
between	O
the	O
size	O
of	O
metadata	O
and	O
the	O
possibility	O
for	O
wasting	O
cache	B-General_Concept
space	O
.	O
</s>
<s>
Having	O
too	O
small	O
caching	B-General_Concept
extents	B-Application
increases	O
the	O
size	O
of	O
metadata	O
,	O
both	O
on	O
the	O
metadata	O
device	O
and	O
in	O
kernel	B-Operating_System
memory	O
,	O
while	O
having	O
too	O
large	O
caching	B-General_Concept
extents	B-Application
increases	O
the	O
amount	O
of	O
wasted	O
cache	B-General_Concept
space	O
due	O
to	O
caching	B-General_Concept
whole	O
extents	B-Application
even	O
in	O
the	O
case	O
of	O
high	O
hit	O
rates	O
only	O
for	O
some	O
of	O
their	O
parts	O
.	O
</s>
<s>
Operating	O
modes	O
supported	O
by	O
dm-cache	B-Application
are	O
write-back	O
,	O
which	O
is	O
the	O
default	O
,	O
write-through	O
,	O
and	O
pass-through	O
.	O
</s>
<s>
In	O
the	O
write-back	O
operating	O
mode	O
,	O
writes	O
to	O
cached	O
blocks	B-General_Concept
go	O
only	O
to	O
the	O
cache	B-General_Concept
device	O
,	O
while	O
the	O
blocks	B-General_Concept
on	O
origin	O
device	O
are	O
only	O
marked	O
as	O
dirty	O
in	O
the	O
metadata	O
.	O
</s>
<s>
For	O
the	O
write-through	O
operating	O
mode	O
,	O
write	O
requests	O
are	O
not	O
returned	O
as	O
completed	O
until	O
the	O
data	O
reaches	O
both	O
the	O
origin	O
and	O
cache	B-General_Concept
devices	O
,	O
with	O
no	O
clean	O
blocks	B-General_Concept
becoming	O
marked	O
as	O
dirty	O
.	O
</s>
<s>
In	O
the	O
pass-through	O
operating	O
mode	O
,	O
all	O
reads	O
are	O
performed	O
directly	O
from	O
the	O
origin	O
device	O
,	O
avoiding	O
the	O
cache	B-General_Concept
,	O
while	O
all	O
writes	O
go	O
directly	O
to	O
the	O
origin	O
device	O
;	O
any	O
cache	B-General_Concept
write	O
hits	O
also	O
cause	O
invalidation	O
of	O
the	O
cached	O
blocks	B-General_Concept
.	O
</s>
<s>
The	O
pass-through	O
mode	O
allows	O
a	O
hybrid	O
volume	O
to	O
be	O
activated	O
when	O
the	O
state	O
of	O
a	O
cache	B-General_Concept
device	O
is	O
not	O
known	O
to	O
be	O
consistent	O
with	O
the	O
origin	O
device	O
.	O
</s>
<s>
The	O
rate	O
of	O
data	O
migration	O
that	O
dm-cache	B-Application
performs	O
in	O
both	O
directions	O
(	O
i.e.	O
,	O
data	O
promotions	O
and	O
demotions	O
)	O
can	O
be	O
throttled	O
down	O
to	O
a	O
configured	O
speed	O
so	O
regular	O
I/O	B-General_Concept
to	O
the	O
origin	O
and	O
cache	B-General_Concept
devices	O
can	O
be	O
preserved	O
.	O
</s>
<s>
Decommissioning	O
a	O
hybrid	O
volume	O
or	O
shrinking	O
a	O
cache	B-General_Concept
device	O
requires	O
use	O
of	O
the	O
cleaner	O
policy	O
,	O
which	O
effectively	O
flushes	O
all	O
blocks	B-General_Concept
marked	O
in	O
metadata	O
as	O
dirty	O
from	O
the	O
cache	B-General_Concept
device	O
to	O
the	O
origin	O
device	O
.	O
</s>
<s>
and	O
version4.2	O
of	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
,	O
the	O
following	O
three	O
cache	B-General_Concept
policies	O
are	O
distributed	O
with	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
mainline	O
,	O
out	O
of	O
which	O
dm-cache	B-Application
by	O
default	O
uses	O
the	O
stochastic	O
multiqueue	O
policy	O
:	O
</s>
<s>
The	O
multiqueue	O
(	O
mq	O
)	O
policy	O
has	O
three	O
sets	O
of	O
16	O
queues	B-Application
,	O
using	O
the	O
first	O
set	O
for	O
entries	O
waiting	O
for	O
the	O
cache	B-General_Concept
and	O
the	O
remaining	O
two	O
sets	O
for	O
entries	O
already	O
in	O
the	O
cache	B-General_Concept
,	O
with	O
the	O
latter	O
separated	O
so	O
the	O
clean	O
and	O
dirty	O
entries	O
belong	O
to	O
each	O
of	O
the	O
two	O
sets	O
.	O
</s>
<s>
The	O
age	O
of	O
cache	B-General_Concept
entries	O
in	O
the	O
queues	B-Application
is	O
based	O
on	O
their	O
associated	O
logical	O
time	O
.	O
</s>
<s>
The	O
selection	O
of	O
entries	O
going	O
into	O
the	O
cache	B-General_Concept
(	O
i.e.	O
,	O
becoming	O
promoted	O
)	O
is	O
based	O
on	O
variable	O
thresholds	O
,	O
and	O
queue	B-Application
selection	O
is	O
based	O
on	O
the	O
hit	O
count	O
of	O
an	O
entry	O
.	O
</s>
<s>
This	O
policy	O
aims	O
to	O
take	O
different	O
cache	B-General_Concept
miss	O
costs	O
into	O
account	O
,	O
and	O
to	O
make	O
automatic	O
adjustments	O
to	O
different	O
load	O
patterns	O
.	O
</s>
<s>
This	O
policy	O
internally	O
tracks	O
sequential	B-General_Concept
I/O	I-General_Concept
operations	O
so	O
they	O
can	O
be	O
routed	O
around	O
the	O
cache	B-General_Concept
,	O
with	O
different	O
configurable	O
thresholds	O
for	O
the	O
differentiation	O
between	O
random	B-General_Concept
I/O	I-General_Concept
and	O
sequential	B-General_Concept
I/O	I-General_Concept
operations	O
.	O
</s>
<s>
As	O
a	O
result	O
,	O
large	O
contiguous	O
I/O	B-General_Concept
operations	I-General_Concept
are	O
left	O
to	O
be	O
performed	O
by	O
the	O
origin	O
device	O
because	O
such	O
data	O
access	O
patterns	O
are	O
suitable	O
for	O
HDDs	B-Device
,	O
and	O
because	O
they	O
avoid	O
undesirable	O
cache	B-General_Concept
invalidation	I-General_Concept
.	O
</s>
<s>
The	O
stochastic	O
multiqueue	O
(	O
smq	O
)	O
policy	O
performs	O
in	O
a	O
similar	O
way	O
as	O
the	O
multiqueue	O
policy	O
,	O
but	O
requires	O
fewer	O
resources	O
to	O
operate	O
;	O
in	O
particular	O
,	O
it	O
uses	O
substantially	O
smaller	O
amounts	O
of	O
main	O
memory	O
to	O
track	O
cached	O
blocks	B-General_Concept
.	O
</s>
<s>
It	O
also	O
replaces	O
the	O
hit	O
counting	O
from	O
the	O
multiqueue	O
policy	O
with	O
a	O
"	O
hotspot	O
"	O
queue	B-Application
,	O
and	O
decides	O
on	O
data	O
promotion	O
and	O
demotion	O
on	O
a	O
least-recently	O
used	O
(	O
LRU	O
)	O
basis	O
.	O
</s>
<s>
The	O
cleaner	O
policy	O
writes	O
back	O
to	O
the	O
origin	O
device	O
all	O
blocks	B-General_Concept
that	O
are	O
marked	O
as	O
dirty	O
in	O
the	O
metadata	O
.	O
</s>
<s>
After	O
the	O
completion	O
of	O
this	O
operation	O
,	O
a	O
hybrid	O
volume	O
can	O
be	O
decommissioned	O
or	O
the	O
size	O
of	O
a	O
cache	B-General_Concept
device	O
can	O
be	O
reduced	O
.	O
</s>
<s>
Logical	B-Application
Volume	I-Application
Manager	I-Application
includes	O
lvmcache	O
,	O
which	O
provides	O
a	O
wrapper	O
for	O
dm-cache	B-Application
integrated	O
with	O
LVM	O
.	O
</s>
