
the aggregated load of network trac from all connected servers at
line-rate. (2) The switch can be reached from database nodes that
are directly connected to the switch with only half of the network
latency compared to the latency required to reach any other (re-
mote) database node that is connected to the same switch. Based
on these characteristics, we next argue that a programmable switch
is an ideal place for storing and processing hot items of an OLTP
workload that are most frequently accessed by transactions.
In a traditional distributed DBMS architecture, hot items that
are accessed frequently by transactions typically lead to a severely
degraded performance, as mentioned before. This is especially true,
when hot items are involved in distributed transactions, as hot items
typically suer from increased remote access latencies. The latency
increase, in turn, leads to an increased likelihood of contention on
those items and thus higher abort rates [
71
]. In contrast, P4DB can
mitigate these eects if hot items are stored and processed on a
programmable switch: This is because when hot tuples are involved
in distributed transactions, storing them on a switch reduces access
latencies, which reduces the overall contention, directly leading to
performance benets.
Surprisingly, however, as we show in our evaluation, even if an
OLTP workload is perfectly partitionable and no distributed trans-
actions are involved in a workload, or even if there is only limited
skew in a workload, P4DB can still speed up processing compared
to a traditional DBMS. The reason is that programmable switches
provide an execution model that enables a new lock-free execution
scheme for transactions, which allows the switch in P4DB to pro-
cess transactions on hot tuples at high speeds since it avoids any
contention. However, implementing a transaction engine on top of
a programmable switch does not come “for free” and many chal-
lenges need to be addressed. For example, typical programmable
switches of today, such as recent Tono-based switches [
5
], have
restrictions not only on the memory model (i.e., how data in the
switch memory can be accessed by in-switch-programs), but also
what kinds of in-switch-programs are supported by their execution
models. By making clever use of the switch memory and the execu-
tion models of programmable switches though, we can eciently
support the concurrent execution of transactions in an abort-free
manner on the switch, as mentioned before.
Finally, we think P4DB is deployable and compatible with ex-
isting datacenter networks. As a main deployment model, P4DB
targets cloud providers that have dedicated racks for database ser-
vices, which is a common scheme to provide high performance for
distributed DBMSs [
68
]. For such a deployment, P4DB only needs
to augment the Top-of-Rack (ToR) switches with a custom data
plane module for processing transactions on hot tuples. But other
deployments, e.g. hierarchies of switches or multi-tenant deploy-
ments, are clearly also interesting. While such deployments are out
of the scope of this paper and are important avenues of future work,
at the end of the paper we provide a short discussion of how we
think P4DB can generalize to such deployments.
Outline. The remainder of this paper is organized as follows:
First, in Section 2 we discuss the relevant background on pro-
grammable switches and their memory and execution models. In
Section 3 we provide an overview of P4DB before we then explain
in Section 4 and Section 5 the details of the storage and execu-
tion model we implemented to execute database transactions on
Parser
Match-Action Pipeline
MAU Stage
Table Action
Table Action
Table Action
Table Action
MAU Stage
Table Action
Table Action
Table Action
Table Action
MAU Stage
Table Action
Table Action
Table Action
Table Action
Deparser
+
+
+
Metadata
Metadata
Metadata
Metadata
Figure 2: The Protocol Independent Switch Architecture
(PISA): All stages (Parser, MAU Stages and Deparser) are pro-
grammable and allow exible packet processing in the data
plane based on packet headers and metadata.
a programmable switch. Afterwards, in Section 6 we then discuss
the integration of the in-switch transaction processing into a host
DBMS. Finally, we conclude with an extensive evaluation of P4DB
in Section 7 using various OLTP benchmarks as well as an overview
of related work in Section 8 and a summary in Section 9.
2 BACKGROUND
In the following, we discuss the relevant background on the typical
programmable switches that are commercially available today.
2.1 Programmable Switches
Programmable switches are an emerging trend on the market with
specialized ASICs from vendors such as Intel [
24
] or Cavium [
12
].
Compared to traditional switches, programmable switches provide
capabilities for exible packet processing at line-rate of up to billion
pkt/s. In-network processing (INP) enables advancements in the
programmability of the data plane by providing a recongurable
architecture [
10
] based on match-action tables. This increases the
exibility of switches to be used not only for data routing but also
for ooading application logic to the switches by implementing
customer match-action rules.
The de facto standard for programming the data plane [
9
] is
P4 (Programming Protocol-Independent Packet Processors) . P4 is
a high-level language that allows to write match-action rules to
express the processing of packets in the data plane [
9
]. Initially
designed for programmable network switches, P4 is now used in
a variety of systems which can also be used to process packets
including SmartNICs or FPGAs [6, 38, 63].
P4 programs in general operate on packet headers and specify
how to rewrite those headers. Although it uses a C-like syntax, it
does not allow the use of pointers and has many other restrictions
regarding oating-point numbers or loops to allow the processing
of P4 programs at line-rate. These constraints can be overcome
by common techniques like loop-unrolling, xed-point arithmetic
or dictionary encoding for strings. Switch vendors can also add
dierent dedicated hardware-accelerators (e.g.: a checksum-engine
or FPU) to the ASIC, which are then available through P4-externs.
2.2 Protocol Independent Switch Architecture
For executing P4 programs, the commercially available program-
mable switches typically implement the so-called Protocol Inde-
pendent Switch Architecture (PISA) as shown in Figure 2. PISA
provides protocol-independence by allowing programmers to spec-
ify how a packet should be parsed and processed in a declarative
manner using match-action tables as mentioned before. In P4DB,
for example, we use custom match-action rules to implement the
logic of the transaction engine on the switch.
Session 19: Databases for Emerging Hardware
SIGMOD ’22, June 12–17, 2022, Philadelphia, PA, USA
评论