
Figure 1: Overview of a Metric deployment where in-
stances of Metric and the SQL DB are deployed on each site
with a geo-distributed redo log deployed across the sites.
Service replicas issue requests to the Metric process closest
to them.
• Support new DBs easily with minimal additions or
changes to the middleware.
Metric achieves these goals through a novel design that
leverages the single-site guarantees of the service’s existing
DB coupled with the use of an entry-consistent (EC) key-
value store [5, 3] to maintain a geo-distributed redo log of
DB records. The EC store provides critical functionality in
the form of fault-tolerant lock-based critical sections that
are used by Metric to obtain table-level locks that guaran-
tee exclusive access to the latest values of records accessed
by a given transaction. Figure 1 illustrates this approach,
where a Metric process executes the operations in a trans-
action locally on a DB, with just one round-trip per trans-
action across sites to commit modified records in the EC
log. This is operationally not only much more efficient than
both MariaDB synchronous and PostgreSQL master-slave
clustering, but is also similar to optimized geo-distributed
DBs [19, 17], despite the drop-in nature of the Metric so-
lution. Further, Metric makes effective use of the EC
store’s higher level abstraction of critical sections that han-
dle failures to build a redo log. The above-mentioned geo-
distributed DBs design their redo log from first principles—
a complex error prone process, especially considering the
wider array of failures in geo-distributed systems.
A key aspect of Metric’s drop-in solution is that it sup-
ports general SQL queries and parses the query to determine
automatically the potentially impacted tables over which to
acquire table-level locks. For our use-cases such as DCAE
and SO, transactions are naturally partitioned across ser-
vice replicas and have no overlap in the DB records they
access, meaning that a given table is usually accessed only
by processes within a specific site. For example, SO replicas
typically deploy different VNFs, with each replica modify-
ing records in distinct DB schemas. An SO replica requires
access to another replica’s records only when the latter fails,
in order to complete VNF deployments. For this common
usage pattern Metric achieves optimal performance.
Metric is implemented in Java with support for MariaDB
and PostgreSQL [25]. Services use the middleware by replac-
ing their existing JDBC driver [62] with the Metric JDBC
driver for the choice of their DB. Through the use of SQL
triggers and basic SQL parsing, we ensure that support for
a new DB can be added with less than 1000 LOC, consisting
mainly of boilerplate code for initialization, trigger manage-
ment, and the mapping of DB data types to Java data types.
We evaluated Metric with strict serializability in multi-
site settings across different WAN latency profiles using
micro-benchmarks, use-case workloads, and TPC-C work-
loads. For the access patterns described above where ser-
vice replicas access different tables on different sites, Metric
achieves up to 56% less latency and 5.2x higher through-
put than MariaDB’s Galera synchronous clustering solution
and PostgreSQL’s master-slave clustering solution. Metric
also outperforms DBs optimized for geo-distribution on the
same access patterns, and achieves up to 90% less latency
and 26.2x higher throughput than CockroachDB and TiDB.
We also evaluated Metric for access patterns that devi-
ate from the expected workload, where service replicas fre-
quently access the same tables across sites. As expected,
Metric’s performance drops relative to the other solutions
mentioned above, which demonstrate up to 90% less latency
and 32x higher throughput than Metric. We present several
mitigation strategies in §9 as future work.
In summary, this paper makes these contributions:
• A novel approach to providing drop-in DB clustering
across sites supported by detailed correctness argu-
ments showing strict serializability (§3, §4).
• An implementation [25] with clustering support for
MariaDB and PostgreSQL that is being deployed in
production for multiple use-cases and that is open-
sourced through ONAP (§5, §6).
• Experimental results validating Metric’s effectiveness
(§7).
A previous Metric workshop paper oriented towards edge
use-cases [57] presents some of the initial design ideas related
to the system. These include how the ownership API can
be exposed to a client or service, and an approach for guar-
anteeing transactionality only to the owner of certain tables
in the DB. While we retain the name for legacy reasons,
3
this paper significantly extends these concepts to encom-
pass strict serializability guarantees, and presents complete
correctness arguments, details of an implementation, and an
experimental evaluation.
2. ARCHITECTURE AND OVERVIEW
Architecture. Metric provides the abstraction of a repli-
cated geo-distributed DB that can be accessed by applica-
tions implementing higher-level services. As shown in Fig-
ure 1, each application is generally composed of multiple
service replicas that are hosted on different sites for locality,
availability, and fault-tolerance. Metric itself is also geo-
distributed, with one replica per site. Service replicas sub-
mit transactions to the closest Metric process, usually at the
same site and often on the same machine. A Metric process
is in turn associated with an instance of a SQL DB, referred
to as the Metric process’s local DB. Currently, a given multi-
site Metric deployment supports a single type of SQL DB
(e.g., MariaDB, PostgreSQL), where the choice is based on
application requirements. Each local DB contains at least
the records accessed by transactions submitted to the Metric
process at that site. The DB must support strict serializ-
ability, at least for transactions within the same node.
4
To
avoid conflicts and optimize performance, any internal cross-
site clustering facility provided by the DB is disabled (e.g.,
Galera clustering for MariaDB.) However, the DBs can use
their clustering solution within a site as long as that solution
provides strict serializability for transactions.
3
The name is no longer considered an acronym, however.
4
§9 describes strategies to relax this assumption
3341
评论