SOSP '25 Artifacts and Proofs - Running Consistent Applications Closer to Users with Radical for Lower Latency
Abstract
This record contains the code for reproducing the experiments detailed in our SOSP 2025 Paper, as well as the protocol proofs for both the replicated and single server version of the system.
Full text
Running Consistent Applications Closer to Users with Radical for Lower Latency 1 Consistency Proof 1.1 Definitions Here we show that Radical provides linearizability guarantees to its users. Linearizability is a local consistency model, thus to prove that a system is linearizable, it is sufficient to show that operations on each individual key are linearizable [ 1 ]. Without loss of generality, consider key π . Radical supports two operations: reads ( π(ππ£) denoting that a read to key π returns its value version π£ ) and writes ( π€(ππ£) denoting a write to π of value version π£ ). Linearizability requires that there exists a total order of operations on π which we construct as follows: 1. Each write is ordered by its version number: π€(ππ£)ππ₯π βββ π€(ππ£+π),π >0. 2. Each read is ordered after the write that it observes: π€(ππ£)ππ₯π βββ π(ππ£) 3. All reads that observe the same write are ordered by invocation time: π1(ππ£)ππ₯π βββ ... ππ₯π βββ ππ(ππ£) if π1.πππ£ <... < ππ.πππ£ For the system to be linearizable, this total order must also obey real-time ordering constraints. 1.2 Proof Thus to show that Radical is linearizable, we must show that Radical respects the above-constructed total order under real-time constraints. First, let all operation be illustrated as a directed graph where the operations are nodes that are connected by real-time edges. Then we can say that there exists a total real-time order if and only if the directed graph is acyclic (operations do not circularly affect each other), meaning that the following invariant holds: βπππ, πππ,(πππ ππ‘π βββ πππ)=β Β¬(πππ ππ‘π βββ πππ). Note that there exists a real-time edge ππ1 ππ‘π βββ ππ2 if ππ2 sees the result of ππ1 and ππ2 starts after ππ1 ends ( ππ1.πππ π < ππ2.πππ£ ). Note that this implies that operations are transitive. That is if ππ1 ππ‘π βββ ππ2 and ππ2 ππ‘π βββ ππ3 , then ππ1 ππ‘π βββ ππ3 . Two operations have a real-time edge in one of two cases: 1. ππ1 and ππ2 are performed sequentially by the same function execution where ππ1precedes ππ2 2. ππ1 and ππ2 are performed by two different executions, and ππ2sees the result of ππ1via Radicalβs design We prove that Radicalβs total order is a real-time order by contradiction. More specifically, we consider pairs of operations (π€,π€),(π,π),(π, π€),(π€, π). 1. (π€,π€) :let there be two writes such that π€1=π€(ππ£)ππ₯π βββ π€2=π€(ππ£β²), π£β²>π£ . By the contradiction we assume we also have π€2 ππ‘π βββ π€1 . Because π€2 is real-time ordered before another operation, we know π€2 must have completed. There are two cases: a. π€2 completed at the edge. Then it must have acquired a write lock as part of its successful consistency check (lines XXβYY). This lock precludes any other operation from acquiring a write lock (lines XXβYY) until it is released. There are three subcases depending on how π€1executes: i. π€1 completes at the edge. Then it must also acquire a write lock as part of its successful consistency check. Since π€2 ππ‘π βββ π€1 , then π€2.π€πππ‘π_ππππ < π€2.πππ π <π€1.πππ£ <π€1.π€πππ‘π_ππππ , so we know that π€1 must acquire its lock after π€2 releases its lock. Version numbers only increase for subsequent writes (lines XXβYY), so π£β² (written by π€2 ) <π£(written by π€1). Contradiction. ii. π€1 completes in the datacenter. Then it must also acquire a write lock as part of its failed consistency check. π€2 must have released the locks before π€1 could start running at the datacenter, so if π€2 ππ‘π βββ π€1 , then π€2.π€πππ‘π_ππππ <π€2.πππ π < π€1.πππ£ <π€1.π€πππ‘π_ππππ , similarly to the case when π€1 completes in the edge. Version numbers only increase for subsequent writes, so π£β²<π£ . Contradiction. iii. π€2 completes at the datacenter or at the edge as part of a timeout. If π€2 started running at the edge, then it must have acquired a write lock as part of its consistency check. If the datacenter times out on the follow-up from the edge, the write lock is still held, and the execution is rerun in the datacenter. Thus, depending on whether the follow-up from the edge finally arrives or the function on the datacenter finishes executing first, the same logic from cases (i) and (ii) applies. If the function finished executing first, the later stale follow-up is discarded, and if the follow-up arrives during datacenter execution, the result of the datacenter execution is ignored. b. π€2 completes in the datacenter. Then it must have acquired a write lock as part of its failed consistency check (lines XX-YY). No other operations, whether in the datacenter or at the edge, could be performing operations on π until π€2 completes. There are two 1
subcases depending on where π€1 executes (we omit the timeout case as the reasoning is similar to what is described in 1(a)iii): i. π€1 completes at the edge. Then it must have been the case that π€1 acquired the write lock as part of its successful consistency check. This necessitates that π€2 released its lock first. If π€2 ππ‘π βββ π€1 , then π€2.π€πππ‘π_ππππ <π€2.πππ π <π€1.πππ£ < π€1.π€πππ‘π_ππππ . Version numbers only increase for subsequent writes, so π£β²<π£. Contradiction. ii. π€1 completes at the datacenter. Then it must have waited for π€2 to release its lock before acquiring the lock as part of its failed consistency check. Thus, π€2 and π€1 execute at the datacenter sequentially, in that order. As in the above case, π€2 ππ‘π βββ π€1=βπ€2.π€πππ‘π_ππππ <π€2.πππ π < π€1.πππ£ <π€1.π€πππ‘π_ππππ , and since version numbers only increase for subsequent writes, so π£β²<π£ . Contradiction. 2. (π,π) :let there be two reads such that π1 ππ₯π βββ π2 . By the contradiction we assume we also have π2 ππ‘π βββ π1 . Because π2 is real-time ordered before another operation, we know π2must have completed. There are two cases: a. If π1=π(ππ£) and π2=π(ππ£) return the same values, then the two reads are ordered by invocation time. Since π1.πππ£ <π2.πππ£ , there cannot be a real-time edge from π2to π1. Contradiction. b. If π1=π(ππ£) and π2=π(ππ£β²) where π£β²>π£ and π1 ππ₯π βββ π2 , then there must exist π€1 that π1 sees and π€2 that π2 sees, such that π€2 is ordered after π€1 . In other words, it must be the case that π€1 ππ₯π βββ π1 , π€2 ππ₯π βββ π2 , and π€1 ππ₯π βββ π€2 . Assuming there exists the edge π2 ππ‘π βββ π1 , then we know that π2 must have completed. There are two cases: i. If π2 completed at the edge, it must be the case that the read lock on π was acquired and the consistency check was successful. Thus, there could have been no writes to π between π2.πππ£ and π2.ππππ_ππππ . There are two subcases depending on where π1executes: A. π1 also completes at the edge. Then it must have also acquired a read lock on π to ensure all pending writes were complete. However, π1 would have acquired the read lock after π€1 executed. Since π€1 should have acquired a write lock before π1 , it is necessary that π€1 executed between π2.ππππ_π’πππππ and π1.ππππ_ππππ . In other words, the following must be true: π2.πππ£ <π2.ππππ_ππππ <π€1.π€πππ‘π_ππππ < π1.ππππ_ππππ . Since π2.πππ π <π1.πππ£ by assumption ( π2 ππ‘π βββ π1 ) and π€2.π€πππ‘π_ππππ < π2.ππππ_ππππ ( π€2 ππ₯π βββ π2 ), then transitively, it must be true that π€2 ππ‘π βββ π1 . Since reads must be ordered after the writes they observe, π€1 must occur between π€2 and π1 . However, writes are ordered in increasing version number in the total order, and since π€2=π€(ππ£β²),π€1= π€(ππ£), π£β²>π£, this is a contradiction. B. π1 completes at the datacenter. Then it must have acquired a read lock on π to avoid reading stale data. Similarly, π€1 must have acquired the write lock at some point before π1 acquired its read lock. Similar to the above, we necessarily expect that π2.πππ£ <π2.ππππ_ππππ < π€1.π€πππ‘π_ππππ <π1.ππππ_ππππ and π€2.π€πππ‘π_ππππ < π2.ππππ_ππππ . Thus π€2 ππ‘π βββ π1=βπ€2 ππ₯π βββ π€1 ππ₯π βββ π1 which violates legal ordering of writes by version number. Contradiction. ii. If π2 completed at the datacenter, then the read lock on π was acquired as part of a failed consistency check. No executions that write to π are possible (whether at datacenter or on edge) once the read lock is acquired. As described above, regardless of where π1 executes, π€1 must have obtained a write lock beforehand such that π€2.π€πππ‘π_ππππ < π2.ππππ_ππππ <π€1.π€πππ‘π_ππππ <π1.ππππ_ππππ . Consequently, π€2 ππ‘π βββ π1 , π€2 ππ₯π βββ π€1 ππ₯π βββ π1 which is out of order writes. Contradiction. 3. (π,π€) :let there be a read and a write such that π=π(ππ£)ππ₯π βββ π€β²=π€(ππ£β²), π£β²>π£ . By the contradiction we also have π€β²ππ‘π βββ π . Because π€β² is real-time ordered before another operation, we know π€β² must have completed. There are two cases: a. π€β² completes at the edge. Then it must have acquired a write lock on π before π executed. Whether π was executed on edge or in datacenter, it held the read lock and sent a response back to the user before π€β² took its write lock. In other words, since π€β²ππ‘π βββ π , then π€β².π€πππ‘π_ππππ <π€β².πππ π <π.πππ£ <π.ππππ_ππππ . However, π would return the value of π of version π£ , not π£β² . Thus there must exist a write π€=π€(ππ£) that is ordered between π€β² and π such that π€β²ππ₯π βββ π€π ββ , which are out-of-order writes. Contradiction. b. π€β² completed at the datacenter. Then it must have acquired a write lock as part of its failed consistency check. Then π€ , by the same logic as above, either executes in datacenter or on edge, after π€β² released its lock, so if π€β²ππ‘π βββ π , the operations must be ordered as π€β²ππ₯π βββ π€π ββ , guaranteed by π€β².π€πππ‘π_ππππ < π€.π€πππ‘π_ππππ <π.ππππ_ππππ , which are out-of-order writes. Contradiction. 2
4. (π€, π) :let there be a write and a read that observes that write such that π€=π€(ππ£)ππ₯π βββ π=π(ππ£) . By the contradiction we also have πππ‘π βββ π€ . Because π is real-time ordered before another operation, we know π must have completed. There are two cases: a. π completes at the edge. Then it must have acquired a read lock on π . There are then two subcases on where π€is executed: i. If π€ is executed on the edge, then it acquired the write lock and necessarily after π released its read lock. Thus π must have read some data before π€ executed. Since π read ππ£ before ππ£ was written by π€ , the read is not ordered by the write it observes. Contradiction. ii. If π€ executed in the datacenter, then similarly π.πππ£ <π.ππππ_ππππ <π.πππ π <π€.πππ£ <π€.π€πππ‘π_ππππ which means that the read is not ordered after the write it observes. Contradiction. b. π completes at the datacenter as a result of a failed consistency check. It does so after acquiring a read lock such that all pending writes complete first. Consider where π€is executed afterwards: i. If π€ is executed at the edge, then π€ acquired a write lock as part of a successful consistency check, thereby requiring that π.ππππ_ππππ <π€.π€πππ‘π_ππππ . The write lock is only released upon central datastore update as a result of the follow up from edge. Thus if πππ‘π βββ π€ , then the read would observe a write that did not yet occur. Contradiction. ii. If and when π€ is executed at the datacenter, then π must have already released its read lock. In other words, π and π€ are executed sequentially at the datacenter, so the read would not be ordered after the write it observes. Contradiction. Thus, the ordering obeys the real-time order for all pairs of operations on each key π . Because our given ordering is a legal total order that obeys real-time constraints, Radical provides linearizability. References [1] Maurice P Herlihy and Jeannette M Wing. Linearizability: A correctness condition for concurrent objects. ACM Transactions on Programming Languages and Systems (TOPLAS), 12(3):463β492, 1990. 3