Diamond: Automating Data Management and Storage for Wide-Area, Reactive Applications
In their paper, Zhang proposed Diamond, which is a framework for reactive applications. A reactive application requires data consistency across clients. Traditional approaches such as notification servers or wide-area storage system are either slow or not fault-tolerant. To ease the pain of reactive application development, Zhan designed and implemented Diamond, which focuses on model and controller in the software MVC model. Diamond consists of the diamond cloud and the diamond client.
Each diamond client has a diamond library which provides some basic APIs to send and receive data from the diamond cloud. Diamond provides several primitive reactive data types, including collection types. The developer can map local variables to these reactive type variables to sync local value across devices. Every modification to the shared data is a read-write transaction. It ensures safe concurrent access to shared data. Diamond also provides API for registering callback functions, which is used to update UI when the shared variables change. This mechanism is similar to data binding in React.JS. For the diamond server, besides ACID requirements, they added reactivity requirement. Reactivity ensures all accesses in reactive transactions will eventually reflect the latest updates. Diamond uses timestamp ordering to enforce isolation across diamond clients and back-end storage. It assigns unique timestamps for transactions, and these timestamps will affect transactions execution order.
For evaluation, they refactored several open-source reactive application projects with diamond library and measured the lines of code. Their results show diamond can save about 30% lines of code on console applications and save 13% lines of code on GUI applications. Besides saving lines of code, using diamond API can also help developers avoid program bugs because they can pay more attention to application’s logic. Their evaluation also shows diamond cloud’s transaction throughput is close to Redis and its latency is acceptable.
My comments
This paper is useful in the industrial scenario. However, they still have these limitations:
- Examples in their paper are poorly chosen. The challenges showed in their examples are mainly caused by the programmer rather than traditional approaches.
- They didn’t compare diamond with other reactive frameworks such as React.JS or firebase
- They can use existing type system in the programming language, just like what GRPC did. There is no need to design a different type system.
Access presentation here.