|
Swarm: Scalable Wide Area Replication Middleware |
Sai Susarla and John Carter, University of Utah
Modern Internet-based services increasingly operate in a dynamic wide area environment spanning diverse networks, and cater to geographically widespread users accessing them via devices of diverse capabilities. Replicating/caching service state and user data at multiple locations is well-understood as a key technique to hide this variability from users and to provide a responsive and highly available service. Replication of mutable data requires consistency management among replicas. Unlike a clustered environment, a dynamic wide area environment poses several unique challenges to replication algorithms, such as diverse network characteristics (latencies and bandwidths), Internet congestion and node churn (nodes continually joining and leaving the network). To efficiently manage replicas that are not uniformly well accessible to each other, replication algorithms must take their non-uniform communication costs into account, and allow applications to make different tradeoffs between consistency, availability and performance. Their complexity motivates the need for a reusable solution to manage data replication and consistency in new distributed services and applications.
Our research addresses the following question: is it feasible to provide reusable middleware support for effectively managing data replication in a wide variety of distributed services (e.g., ranging from distributed file services and databases to distributed multi-player games and content distribution systems like Kazaa or Gnutella)?
To identify the core desirable features of such a replication solution, we have surveyed the data sharing needs of a wide variety of distributed applications ranging from personal file access (with little data sharing) to widespread real-time collaboration (with fine-grain sharing). From our study, we made three important observations. First, we found that though replicable data is prevalent in many applications, their data characteristics (e.g., the unit of data access, its mutability and extent of sharing) and consistency requirements vary widely. This warrants a high degree of customizability in all these respects. Second, applications operate in diverse networking environments ranging from well-connected corporate servers to intermittently connected mobile devices. The ability to promiscuously replicate data and synchronize with any available replica, called pervasive replication [6], greatly enhances application availability and performance in such environments. Finally, we found that certain core design choices often recur in the consistency management of diverse applications, albeit the actual combination of choices differs from one application to another. This leads to our hypothesis that there is sufficient commonality in the replication needs of a variety of services, that could be supported in a reusable middleware.
Based on the above observations, we have developed a consistency model that offers a novel approach to flexible consistency management in dynamic environments, called composable consistency. Its consistency model can express a broader range of consistency requirements than existing models in terms of primitive design choices along several orthogonal dimensions, giving applications a high degree of customizability.
To show how composable consistency paves the way for reusable replicated data management middleware, we designed and prototyped such a middleware called Swarm1, and developed several diverse distributed services using it. Swarm is a wide area peer file service that supports aggressive replication and composable consistency behind a file system-like interface. Swarm can be used to implement and deploy wide area proxies for a variety of distributed services that operate on cached service data. In particular, Swarm has three properties that we believe are key to successful reuse of replication middleware for a variety of sharing needs: (i) customizable consistency to allow applications to tune consistency to their sharing needs and network constraints, (ii) pervasive peer replication to give applications freedom to structure themselves for efficient network usage and scaling, and (iii) a flexible interface to support a variety of useful data access paradigms. Previous wide-area replicated services lacked one or more of these properties, thus restricting their reusability.
We developed the composable consistency model based on the observation from our application survey that the diverse consistency needs of many applications can be decomposed into primitive consistency requirements. Those requirements can be classified along five major dimensions that are largely orthogonal:
|
There are multiple reasonable options along each of these dimensions, that create a multi-dimensional space for expressing consistency requirements of applications. Table 1 lists the options we identified to include in the Composable Consistency Model. When these options are combined in various ways, they yield a rich collection of consistency semantics for reads and updates to shared data, covering the needs of a broad mix of applications. For instance, our approach lets a replicated auction service employ strong consistency for updates across all peer service replicas, while enabling different peers to answer queries with different levels of accuracy by relaxing consistency for reads to limit synchronization cost. A user can still get an accurate answer incurring higher latency by specifying a stronger consistency requirement for queries.
We envision Swarm being employed to provide coherent wide area caching to distributed services (such as file and directory services) in two ways. First, a new distributed service can be implemented as a collection of peer-to-peer service agents that operate on Swarm-hosted service data. Alternatively, an existing centralized service (such as an enterprise service) can export its data into Swarm's space at its home site, and deploy wide area service proxies that access the data via Swarm caches to improve responsiveness to wide area clients.
For example, consider an enterprise service such as payroll that serves its clients by accessing information in a centralized database. Figure 1 shows how such a service is typically organized. Clients access the service from geographically dispersed campuses by contacting the primary server in its home campus via RPCs. As the figure shows, the enterprise server is normally implemented on a cluster of machines and consists of two tiers: the ``application server'' (labeled 'AS' in the figure) implements payroll logic, while the ``DB'' server (such as mySQL, BerkeleyDB, or Oracle) handles database access when requested by 'AS' using the storage provided by a local storage service (FS).
Figure 2 shows how the same service could be organized to employ wide area proxies based on Swarm. Each enterprise server (home or proxy) is a clone of the original two-tier server with an additional component, namely, a Swarm server. Clients can now access any of the available servers, as they are functionally identical. At each enterprise server cluster, the 'AS' must be modified to issue its database queries and updates to the Swarm server by wrapping them within Swarm sessions with desired consistency semantics. In response, Swarm brings the local database to desired consistency by coordinating with Swarm servers at other proxy locations, and then invokes the operations on the local DB server. The DB server remains unchanged. Employing this 3-tier architecture offloads data replication and consistency management complexity from the enterprise service.
Figure 3 shows the architecture of the server cluster and its control flow in more detail. The DB plugin encapsulates DB-specific logic needed by Swarm to manage replicated access. It must be implemented and linked to each Swarm server and has two functions: (i) it must apply the DB query and update operations that Swarm gets from the AS and remote Swarm servers to the local database replica; (ii) it must detect and resolve conflicts among concurrent updates when requested by Swarm.
We have built a prototype of Swarm and used it to build four representative network services with distinct data characteristics and consistency needs:
Middleware Support for Locality-aware Wide area Replication
.
Sai Susarla and John Carter.
Technical report UUCS-04-017
Department of Computer Science,
University of Utah.
This report presents the design and implementation of the Swarm data store.