scieee Science in your language
[en] (orig)

SOSP '25 Artifacts and Proofs - Running Consistent Applications Closer to Users with Radical for Lower Latency

Author: Kaashoek, Nicolaas
Publisher: Zenodo
DOI: 10.5281/zenodo.17009555
Source: https://zenodo.org/records/17009555/files/proof.pdf
Running Consis en Applica ions Close o Use s wi h
Radical o Lowe La ency
1 Consis ency P oo
1.1 De ini ions
He e we show ha Radical p o ides linea izabili y gua an-
ees o i s use s. Linea izabili y is a local consis ency model,
hus o p o e ha a sys em is linea izable, i is su icien o
show ha ope a ions on each indi idual key a e linea izable
[
1
]. Wi hou loss o gene ali y, conside key
π‘˜
. Radical sup-
po s wo ope a ions: eads (
π‘Ÿ(π‘˜π‘£)
deno ing ha a ead o
key
π‘˜
e u ns i s alue e sion
𝑣
) and w i es (
𝑀(π‘˜π‘£)
deno -
ing a w i e o
π‘˜
o alue e sion
𝑣
). Linea izabili y equi es
ha he e exis s a o al o de o ope a ions on
π‘˜
which we
cons uc as ollows:
1.
Each w i e is o de ed by i s e sion numbe :
𝑀(π‘˜π‘£)𝑒π‘₯𝑒
βˆ’βˆ’β†’
𝑀(π‘˜π‘£+𝑖),𝑖 >0.
2.
Each ead is o de ed a e he w i e ha i obse es:
𝑀(π‘˜π‘£)𝑒π‘₯𝑒
βˆ’βˆ’β†’
π‘Ÿ(π‘˜π‘£)
3.
All eads ha obse e he same w i e a e o de ed by in-
oca ion ime:
π‘Ÿ1(π‘˜π‘£)𝑒π‘₯𝑒
βˆ’βˆ’β†’ ... 𝑒π‘₯𝑒
βˆ’βˆ’β†’ π‘Ÿπ‘›(π‘˜π‘£)
i
π‘Ÿ1.𝑖𝑛𝑣 <... <
π‘Ÿπ‘›.𝑖𝑛𝑣
Fo he sys em o be linea izable, his o al o de mus also
obey eal- ime o de ing cons ain s.
1.2 P oo
Thus o show ha Radical is linea izable, we mus show
ha Radical espec s he abo e-cons uc ed o al o de un-
de eal- ime cons ain s. Fi s , le all ope a ion be illus-
a ed as a di ec ed g aph whe e he ope a ions a e nodes
ha a e connec ed by eal- ime edges. Then we can say
ha he e exis s a o al eal- ime o de i and only i he
di ec ed g aph is acyclic (ope a ions do no ci cula ly a -
ec each o he ), meaning ha he ollowing in a ian holds:
βˆ€π‘œπ‘π‘–, π‘œπ‘π‘—,(π‘œπ‘π‘–
π‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ π‘œπ‘π‘—)=β‡’ Β¬(π‘œπ‘π‘—
π‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ π‘œπ‘π‘–).
No e ha he e exis s a eal- ime edge
π‘œπ‘1
π‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ π‘œπ‘2
i
π‘œπ‘2
sees he esul o
π‘œπ‘1
and
π‘œπ‘2
s a s a e
π‘œπ‘1
ends (
π‘œπ‘1.π‘Ÿπ‘’π‘ π‘ <
π‘œπ‘2.𝑖𝑛𝑣
). No e ha his implies ha ope a ions a e ansi i e.
Tha is i
π‘œπ‘1
π‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ π‘œπ‘2
and
π‘œπ‘2
π‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ π‘œπ‘3
, hen
π‘œπ‘1
π‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ π‘œπ‘3
.
Two ope a ions ha e a eal- ime edge in one o wo cases:
1. π‘œπ‘1
and
π‘œπ‘2
a e pe o med sequen ially by he same unc-
ion execu ion whe e π‘œπ‘1p ecedes π‘œπ‘2
2. π‘œπ‘1
and
π‘œπ‘2
a e pe o med by wo di e en execu ions,
and π‘œπ‘2sees he esul o π‘œπ‘1 ia Radical’s design
We p o e ha Radical’s o al o de is a eal- ime o de by
con adic ion. Mo e speci ically, we conside pai s o ope a-
ions (𝑀,𝑀),(π‘Ÿ,π‘Ÿ),(π‘Ÿ, 𝑀),(𝑀, π‘Ÿ).
1. (𝑀,𝑀)
:le he e be wo w i es such ha
𝑀1=𝑀(π‘˜π‘£)𝑒π‘₯𝑒
βˆ’βˆ’β†’
𝑀2=𝑀(π‘˜π‘£β€²), 𝑣′>𝑣
. By he con adic ion we assume we
also ha e
𝑀2
π‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ 𝑀1
. Because
𝑀2
is eal- ime o de ed be-
o e ano he ope a ion, we know
𝑀2
mus ha e comple ed.
The e a e wo cases:
a. 𝑀2
comple ed a he edge. Then i mus ha e acqui ed
a w i e lock as pa o i s success ul consis ency check
(lines XX–YY). This lock p ecludes any o he ope a ion
om acqui ing a w i e lock (lines XX–YY) un il i is
eleased. The e a e h ee subcases depending on how
𝑀1execu es:
i. 𝑀1
comple es a he edge. Then i mus also ac-
qui e a w i e lock as pa o i s success ul consis-
ency check. Since
𝑀2
π‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ 𝑀1
, hen
𝑀2.π‘€π‘Ÿπ‘–π‘‘π‘’_π‘™π‘œπ‘π‘˜ <
𝑀2.π‘Ÿπ‘’π‘ π‘ <𝑀1.𝑖𝑛𝑣 <𝑀1.π‘€π‘Ÿπ‘–π‘‘π‘’_π‘™π‘œπ‘π‘˜
, so we know
ha
𝑀1
mus acqui e i s lock a e
𝑀2
eleases i s
lock. Ve sion numbe s only inc ease o subse-
quen w i es (lines XX–YY), so
𝑣′
(w i en by
𝑀2
)
<𝑣(w i en by 𝑀1). Con adic ion.
ii. 𝑀1
comple es in he da acen e . Then i mus also
acqui e a w i e lock as pa o i s ailed consis-
ency check.
𝑀2
mus ha e eleased he locks be-
o e
𝑀1
could s a unning a he da acen e , so
i
𝑀2
π‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ 𝑀1
, hen
𝑀2.π‘€π‘Ÿπ‘–π‘‘π‘’_π‘™π‘œπ‘π‘˜ <𝑀2.π‘Ÿπ‘’π‘ π‘ <
𝑀1.𝑖𝑛𝑣 <𝑀1.π‘€π‘Ÿπ‘–π‘‘π‘’_π‘™π‘œπ‘π‘˜
, simila ly o he case
when
𝑀1
comple es in he edge. Ve sion numbe s
only inc ease o subsequen w i es, so
𝑣′<𝑣
.
Con adic ion.
iii. 𝑀2
comple es a he da acen e o a he edge as
pa o a imeou . I
𝑀2
s a ed unning a he
edge, hen i mus ha e acqui ed a w i e lock as
pa o i s consis ency check. I he da acen e
imes ou on he ollow-up om he edge, he
w i e lock is s ill held, and he execu ion is e un
in he da acen e . Thus, depending on whe he
he ollow-up om he edge inally a i es o
he unc ion on he da acen e inishes execu ing
i s , he same logic om cases (i) and (ii) applies.
I he unc ion inished execu ing i s , he la e
s ale ollow-up is disca ded, and i he ollow-up
a i es du ing da acen e execu ion, he esul o
he da acen e execu ion is igno ed.
b. 𝑀2
comple es in he da acen e . Then i mus ha e
acqui ed a w i e lock as pa o i s ailed consis ency
check (lines XX-YY). No o he ope a ions, whe he
in he da acen e o a he edge, could be pe o ming
ope a ions on
π‘˜
un il
𝑀2
comple es. The e a e wo
1
subcases depending on whe e
𝑀1
execu es (we omi
he imeou case as he easoning is simila o wha is
desc ibed in 1(a)iii):
i. 𝑀1
comple es a he edge. Then i mus ha e been
he case ha
𝑀1
acqui ed he w i e lock as pa
o i s success ul consis ency check. This neces-
si a es ha
𝑀2
eleased i s lock i s . I
𝑀2
π‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’
𝑀1
, hen
𝑀2.π‘€π‘Ÿπ‘–π‘‘π‘’_π‘™π‘œπ‘π‘˜ <𝑀2.π‘Ÿπ‘’π‘ π‘ <𝑀1.𝑖𝑛𝑣 <
𝑀1.π‘€π‘Ÿπ‘–π‘‘π‘’_π‘™π‘œπ‘π‘˜
. Ve sion numbe s only inc ease o
subsequen w i es, so 𝑣′<𝑣. Con adic ion.
ii. 𝑀1
comple es a he da acen e . Then i mus ha e
wai ed o
𝑀2
o elease i s lock be o e acqui ing
he lock as pa o i s ailed consis ency check.
Thus,
𝑀2
and
𝑀1
execu e a he da acen e se-
quen ially, in ha o de . As in he abo e case,
𝑀2
π‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ 𝑀1=⇒𝑀2.π‘€π‘Ÿπ‘–π‘‘π‘’_π‘™π‘œπ‘π‘˜ <𝑀2.π‘Ÿπ‘’π‘ π‘ <
𝑀1.𝑖𝑛𝑣 <𝑀1.π‘€π‘Ÿπ‘–π‘‘π‘’_π‘™π‘œπ‘π‘˜
, and since e sion num-
be s only inc ease o subsequen w i es, so
𝑣′<𝑣
.
Con adic ion.
2. (π‘Ÿ,π‘Ÿ)
:le he e be wo eads such ha
π‘Ÿ1
𝑒π‘₯𝑒
βˆ’βˆ’β†’ π‘Ÿ2
. By he
con adic ion we assume we also ha e
π‘Ÿ2
π‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ π‘Ÿ1
. Because
π‘Ÿ2
is eal- ime o de ed be o e ano he ope a ion, we know
π‘Ÿ2mus ha e comple ed. The e a e wo cases:
a.
I
π‘Ÿ1=π‘Ÿ(π‘˜π‘£)
and
π‘Ÿ2=π‘Ÿ(π‘˜π‘£)
e u n he same alues,
hen he wo eads a e o de ed by in oca ion ime.
Since
π‘Ÿ1.𝑖𝑛𝑣 <π‘Ÿ2.𝑖𝑛𝑣
, he e canno be a eal- ime edge
om π‘Ÿ2 o π‘Ÿ1. Con adic ion.
b.
I
π‘Ÿ1=π‘Ÿ(π‘˜π‘£)
and
π‘Ÿ2=π‘Ÿ(π‘˜π‘£β€²)
whe e
𝑣′>𝑣
and
π‘Ÿ1
𝑒π‘₯𝑒
βˆ’βˆ’β†’
π‘Ÿ2
, hen he e mus exis
𝑀1
ha
π‘Ÿ1
sees and
𝑀2
ha
π‘Ÿ2
sees, such ha
𝑀2
is o de ed a e
𝑀1
. In o he wo ds,
i mus be he case ha
𝑀1
𝑒π‘₯𝑒
βˆ’βˆ’β†’ π‘Ÿ1
,
𝑀2
𝑒π‘₯𝑒
βˆ’βˆ’β†’ π‘Ÿ2
, and
𝑀1
𝑒π‘₯𝑒
βˆ’βˆ’β†’ 𝑀2
. Assuming he e exis s he edge
π‘Ÿ2
π‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ π‘Ÿ1
,
hen we know ha
π‘Ÿ2
mus ha e comple ed. The e a e
wo cases:
i.
I
π‘Ÿ2
comple ed a he edge, i mus be he case
ha he ead lock on
π‘˜
was acqui ed and he
consis ency check was success ul. Thus, he e
could ha e been no w i es o
π‘˜
be ween
π‘Ÿ2.𝑖𝑛𝑣
and
π‘Ÿ2.π‘Ÿπ‘’π‘Žπ‘‘_π‘™π‘œπ‘π‘˜
. The e a e wo subcases depending
on whe e π‘Ÿ1execu es:
A. π‘Ÿ1
also comple es a he edge. Then i mus
ha e also acqui ed a ead lock on
π‘˜
o en-
su e all pending w i es we e comple e. How-
e e ,
π‘Ÿ1
would ha e acqui ed he ead lock
a e
𝑀1
execu ed. Since
𝑀1
should ha e ac-
qui ed a w i e lock be o e
π‘Ÿ1
, i is necessa y
ha
𝑀1
execu ed be ween
π‘Ÿ2.π‘Ÿπ‘’π‘Žπ‘‘_π‘’π‘›π‘™π‘œπ‘π‘˜
and
π‘Ÿ1.π‘Ÿπ‘’π‘Žπ‘‘_π‘™π‘œπ‘π‘˜
. In o he wo ds, he ollowing
mus be ue:
π‘Ÿ2.𝑖𝑛𝑣 <π‘Ÿ2.π‘Ÿπ‘’π‘Žπ‘‘_π‘™π‘œπ‘π‘˜ <𝑀1.π‘€π‘Ÿπ‘–π‘‘π‘’_π‘™π‘œπ‘π‘˜ <
π‘Ÿ1.π‘Ÿπ‘’π‘Žπ‘‘_π‘™π‘œπ‘π‘˜
. Since
π‘Ÿ2.π‘Ÿπ‘’π‘ π‘ <π‘Ÿ1.𝑖𝑛𝑣
by as-
sump ion (
π‘Ÿ2
π‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ π‘Ÿ1
) and
𝑀2.π‘€π‘Ÿπ‘–π‘‘π‘’_π‘™π‘œπ‘π‘˜ <
π‘Ÿ2.π‘Ÿπ‘’π‘Žπ‘‘_π‘™π‘œπ‘π‘˜
(
𝑀2
𝑒π‘₯𝑒
βˆ’βˆ’β†’ π‘Ÿ2
), hen ansi i ely,
i mus be ue ha
𝑀2
π‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ π‘Ÿ1
. Since eads
mus be o de ed a e he w i es hey obse e,
𝑀1
mus occu be ween
𝑀2
and
π‘Ÿ1
. Howe e ,
w i es a e o de ed in inc easing e sion num-
be in he o al o de , and since
𝑀2=𝑀(π‘˜π‘£β€²),𝑀1=
𝑀(π‘˜π‘£), 𝑣′>𝑣, his is a con adic ion.
B. π‘Ÿ1
comple es a he da acen e . Then i mus
ha e acqui ed a ead lock on
π‘˜
o a oid ead-
ing s ale da a. Simila ly,
𝑀1
mus ha e ac-
qui ed he w i e lock a some poin be o e
π‘Ÿ1
acqui ed i s ead lock. Simila o he abo e, we
necessa ily expec ha
π‘Ÿ2.𝑖𝑛𝑣 <π‘Ÿ2.π‘Ÿπ‘’π‘Žπ‘‘_π‘™π‘œπ‘π‘˜ <
𝑀1.π‘€π‘Ÿπ‘–π‘‘π‘’_π‘™π‘œπ‘π‘˜ <π‘Ÿ1.π‘Ÿπ‘’π‘Žπ‘‘_π‘™π‘œπ‘π‘˜
and
𝑀2.π‘€π‘Ÿπ‘–π‘‘π‘’_π‘™π‘œπ‘π‘˜ <
π‘Ÿ2.π‘Ÿπ‘’π‘Žπ‘‘_π‘™π‘œπ‘π‘˜
. Thus
𝑀2
π‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ π‘Ÿ1=⇒𝑀2
𝑒π‘₯𝑒
βˆ’βˆ’β†’
𝑀1
𝑒π‘₯𝑒
βˆ’βˆ’β†’ π‘Ÿ1
which iola es legal o de ing o
w i es by e sion numbe . Con adic ion.
ii.
I
π‘Ÿ2
comple ed a he da acen e , hen he ead
lock on
π‘˜
was acqui ed as pa o a ailed consis-
ency check. No execu ions ha w i e o
π‘˜
a e pos-
sible (whe he a da acen e o on edge) once he
ead lock is acqui ed. As desc ibed abo e, ega d-
less o whe e
π‘Ÿ1
execu es,
𝑀1
mus ha e ob ained a
w i e lock be o ehand such ha
𝑀2.π‘€π‘Ÿπ‘–π‘‘π‘’_π‘™π‘œπ‘π‘˜ <
π‘Ÿ2.π‘Ÿπ‘’π‘Žπ‘‘_π‘™π‘œπ‘π‘˜ <𝑀1.π‘€π‘Ÿπ‘–π‘‘π‘’_π‘™π‘œπ‘π‘˜ <π‘Ÿ1.π‘Ÿπ‘’π‘Žπ‘‘_π‘™π‘œπ‘π‘˜
.
Consequen ly,
𝑀2
π‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ π‘Ÿ1
,
𝑀2
𝑒π‘₯𝑒
βˆ’βˆ’β†’ 𝑀1
𝑒π‘₯𝑒
βˆ’βˆ’β†’ π‘Ÿ1
which is ou o o de w i es. Con adic ion.
3. (π‘Ÿ,𝑀)
:le he e be a ead and a w i e such ha
π‘Ÿ=π‘Ÿ(π‘˜π‘£)𝑒π‘₯𝑒
βˆ’βˆ’β†’
𝑀′=𝑀(π‘˜π‘£β€²), 𝑣′>𝑣
. By he con adic ion we also ha e
π‘€β€²π‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ π‘Ÿ
. Because
𝑀′
is eal- ime o de ed be o e ano he
ope a ion, we know
𝑀′
mus ha e comple ed. The e a e
wo cases:
a. 𝑀′
comple es a he edge. Then i mus ha e acqui ed
a w i e lock on
π‘˜
be o e
π‘Ÿ
execu ed. Whe he
π‘Ÿ
was
execu ed on edge o in da acen e , i held he ead
lock and sen a esponse back o he use be o e
𝑀′
ook i s w i e lock. In o he wo ds, since
π‘€β€²π‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ π‘Ÿ
,
hen
𝑀′.π‘€π‘Ÿπ‘–π‘‘π‘’_π‘™π‘œπ‘π‘˜ <𝑀′.π‘Ÿπ‘’π‘ π‘ <π‘Ÿ.𝑖𝑛𝑣 <π‘Ÿ.π‘Ÿπ‘’π‘Žπ‘‘_π‘™π‘œπ‘π‘˜
.
Howe e ,
π‘Ÿ
would e u n he alue o
π‘˜
o e sion
𝑣
,
no
𝑣′
. Thus he e mus exis a w i e
𝑀=𝑀(π‘˜π‘£)
ha
is o de ed be ween
𝑀′
and
π‘Ÿ
such ha
𝑀′𝑒π‘₯𝑒
βˆ’βˆ’β†’ π‘€π‘Ÿ
βˆ’β†’
,
which a e ou -o -o de w i es. Con adic ion.
b. 𝑀′
comple ed a he da acen e . Then i mus ha e ac-
qui ed a w i e lock as pa o i s ailed consis ency
check. Then
𝑀
, by he same logic as abo e, ei he
execu es in da acen e o on edge, a e
𝑀′
eleased
i s lock, so i
π‘€β€²π‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ π‘Ÿ
, he ope a ions mus be o -
de ed as
𝑀′𝑒π‘₯𝑒
βˆ’βˆ’β†’ π‘€π‘Ÿ
βˆ’β†’
, gua an eed by
𝑀′.π‘€π‘Ÿπ‘–π‘‘π‘’_π‘™π‘œπ‘π‘˜ <
𝑀.π‘€π‘Ÿπ‘–π‘‘π‘’_π‘™π‘œπ‘π‘˜ <π‘Ÿ.π‘Ÿπ‘’π‘Žπ‘‘_π‘™π‘œπ‘π‘˜
, which a e ou -o -o de
w i es. Con adic ion.
2
4. (𝑀, π‘Ÿ)
:le he e be a w i e and a ead ha obse es ha
w i e such ha
𝑀=𝑀(π‘˜π‘£)𝑒π‘₯𝑒
βˆ’βˆ’β†’ π‘Ÿ=π‘Ÿ(π‘˜π‘£)
. By he con-
adic ion we also ha e
π‘Ÿπ‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ 𝑀
. Because
π‘Ÿ
is eal- ime
o de ed be o e ano he ope a ion, we know
π‘Ÿ
mus ha e
comple ed. The e a e wo cases:
a. π‘Ÿ
comple es a he edge. Then i mus ha e acqui ed a
ead lock on
π‘˜
. The e a e hen wo subcases on whe e
𝑀is execu ed:
i.
I
𝑀
is execu ed on he edge, hen i acqui ed he
w i e lock and necessa ily a e
π‘Ÿ
eleased i s ead
lock. Thus
π‘Ÿ
mus ha e ead some da a be o e
𝑀
execu ed. Since
π‘Ÿ
ead
π‘˜π‘£
be o e
π‘˜π‘£
was w i en by
𝑀
, he ead is no o de ed by he w i e i obse es.
Con adic ion.
ii.
I
𝑀
execu ed in he da acen e , hen simila ly
π‘Ÿ.𝑖𝑛𝑣 <π‘Ÿ.π‘Ÿπ‘’π‘Žπ‘‘_π‘™π‘œπ‘π‘˜ <π‘Ÿ.π‘Ÿπ‘’π‘ π‘ <𝑀.𝑖𝑛𝑣 <𝑀.π‘€π‘Ÿπ‘–π‘‘π‘’_π‘™π‘œπ‘π‘˜
which means ha he ead is no o de ed a e
he w i e i obse es. Con adic ion.
b. π‘Ÿ
comple es a he da acen e as a esul o a ailed
consis ency check. I does so a e acqui ing a ead lock
such ha all pending w i es comple e i s . Conside
whe e 𝑀is execu ed a e wa ds:
i.
I
𝑀
is execu ed a he edge, hen
𝑀
acqui ed
a w i e lock as pa o a success ul consis ency
check, he eby equi ing ha
π‘Ÿ.π‘Ÿπ‘’π‘Žπ‘‘_π‘™π‘œπ‘π‘˜ <𝑀.π‘€π‘Ÿπ‘–π‘‘π‘’_π‘™π‘œπ‘π‘˜
.
The w i e lock is only eleased upon cen al da as-
o e upda e as a esul o he ollow up om edge.
Thus i
π‘Ÿπ‘Ÿπ‘‘π‘œ
βˆ’βˆ’β†’ 𝑀
, hen he ead would obse e a
w i e ha did no ye occu . Con adic ion.
ii.
I and when
𝑀
is execu ed a he da acen e , hen
π‘Ÿ
mus ha e al eady eleased i s ead lock. In o he
wo ds,
π‘Ÿ
and
𝑀
a e execu ed sequen ially a he
da acen e , so he ead would no be o de ed a e
he w i e i obse es. Con adic ion.
Thus, he o de ing obeys he eal- ime o de o all pai s
o ope a ions on each key
π‘˜
. Because ou gi en o de ing is
a legal o al o de ha obeys eal- ime cons ain s, Radical
p o ides linea izabili y.
Re e ences
[1]
Mau ice P He lihy and Jeanne e M Wing. Linea izabili y: A co ec ness
condi ion o concu en objec s. ACM T ansac ions on P og amming
Languages and Sys ems (TOPLAS), 12(3):463–492, 1990.
3