
Strict Serializability is Harmless: A New Architecture for Enterprise Applications Sergio´ Miguel Fernandes Joao˜ Cachopo INESC-ID Lisboa / Instituto Superior Tecnico,´ Technical University of Lisbon {Sergio.Fernandes,Joao.Cachopo}@ist.utl.pt Abstract 1. Introduction Despite many evolutions in the software architecture of en- The adoption of multicore architectures as the only way terprise applications, one thing has remained the same over to increase the computational power of new generations the years: They still use a relational database both for data of hardware spurred intense research on Software Trans- persistence and transactional support. We argue that such de- actional Memory (STM), leading to many advances in this sign, once justified by hardware limitations, endured mostly area over the last eight years (for an actual and comprehen- for legacy reasons and is no longer adequate for a significant sive description of the research made on STMs, see [19]). portion of modern applications running in a new generation STMs bring into the realm of programming languages, of multicore machines with very large memories. the age-old notion of transactions, well known in the area of We propose a new architecture for enterprise applications Database Management Systems (DBMSs). STMs, however, that uses a Software Transactional Memory for transactional are not concerned with the durability property of ACID, and, support at the application server tier, thereby shifting the re- because of this, most, if not all, of the STMs’ design deci- sponsibility of transaction control from the database to the sions and implementations have little in common with their application server. The database tier remains in our architec- counterparts of the database world [14]: Unlike DBMSs, ture with the sole purpose of ensuring the durability of data. modern STMs are designed to scale well to machines with With this change we are able to provide strictly serializ- many cores, to provide strong correctness guarantees such as able transaction semantics, and we do so with increased per- opacity [18], and to ensure nonblocking progress conditions formance. Thus, we claim that strict serializability is harm- such as lock freedom [15]. less, in the sense that programmers no longer have to trade And yet, surprisingly, all of these great advances in the correctness for performance for a significant class of appli- area of STMs have been mostly ignored by one of the com- cations. We have been using this new architecture since 2005 munities that could benefit the most from them: The com- in the development of real-world complex object-oriented munity of enterprise application development. In this paper, applications, and we present statistical data collected over we show that there is much to gain by merging these two several years about the workload patterns of these applica- areas, namely, both in terms of development effort and of tions, revealing a surprisingly low rate of write transactions. performance. We propose a new architecture for enterprise applications Categories and Subject Descriptors D.2.11 [Software En- that uses an STM, rather than a DBMS, to ensure the transac- gineering]: Software Architectures tional semantics for its business operations. Because STMs General Terms Design, Performance do not guarantee the durability of the data, we show how to extend the STM to collaborate with a persistent storage Keywords Enterprise Application Architecture, Software system to ensure that the application’s data are safely stored. Transactional Memory, Strict Serializability, Persistence, We claim, and provide evidence, that this new architec- Transactions, Object-Oriented Programming, Rich-Domain ture is not only much better to develop many of today’s com- Applications, Fenix´ Framework plex, rich enterprise applications, but is also better suited to use the new generation of machines with many cores and very large memories that are increasingly running the Permission to make digital or hard copies of all or part of this work for personal or application-server tiers of those applications. classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation Both this architecture and its implementation were de- on the first page. To copy otherwise, to republish, to post on servers or to redistribute veloped over the last six years alongside the development to lists, requires prior specific permission and/or a fee. SPLASH’11 Companion, October 22–27, 2011, Portland, Oregon, USA. Copyright c 2011 ACM 978-1-4503-0942-4/11/10. $10.00 of a real-world complex application—the FenixEDU´ 1 web transactions, peaking below 10% for short periods of write- application—and have been driving the execution of that intensive activity. These numbers are, actually, well below application in a demanding production environment since the numbers that are typically observed in benchmarks such 2005. In 2008, the FenixEDU´ web application went through as TPC-W. Second, these results confirm our claim that a major refactoring to separate the infrastructure code from strict serializability is harmless for (at least some) enterprise the rest of the application code, resulting in the initial ver- applications: The rate of conflicts among write transactions sion of the Fenix´ Framework—a Java framework to develop is almost negligible for these applications, averaging less applications that need a transactional and persistent domain than 0.2% of the total number of write transactions (meaning model, and that implements our proposed STM-based archi- that they represent less than 0.004% of the total number of tecture.2 transactions). The remainder of this paper is organized as follows. In 1.1 Main contributions Section 2 we argue why a new architecture for enterprise ap- The main contributions of this paper are threefold. plications is needed: We believe that historical reasons have First, we propose an architecture that is especially suited led to some limitations in the programming model, namely for the development of many of today’s object-oriented en- with regard to transactional semantics. We discuss those lim- terprise applications, providing not only strictly serializable itations and how they affect programmers and software de- semantics to the applications’ business transactions, but also velopment. Then, in Section 3 we describe the STM-based improved performance over traditional implementations. Se- architecture that we propose and discuss some of its imple- rializability alone requires that transactions be ordered as mentation details. Next, in Section 4, we describe a real- if they had executed sequentially. Strict serializability is an world case of a large application, as well as a smaller-sized additional requirement on top of serializability: It imposes application, both developed with this architecture. Addition- that transactions be serialized without reversing the order ally, we provide a performance comparison between two im- of temporally nonoverlapping transactions [24]. Intuitively, plementations of the TPC-W benchmark, one using a tradi- programmers can think of strictly serializable transactions tional approach and another using our architecture. We dis- as transactions that are serialized in an instant within the cuss related work in Section 5 and conclude in Section 6. real-time interval in which they executed. Regarding per- formance, our tests show an increase of throughput in the 2. Why We Need a New Architecture TPC-W benchmark, for a variety of workloads and cluster configurations, up to 23.7 times, having the best results in Over the last 30 years, the development of enterprise appli- the read-intensive workloads. cations has evolved, influenced by diverse factors such as Second, we describe the key elements of an implemen- the changes in hardware, or the changes in the users’ expec- tation of this architecture in a Java-based framework—the tations about how applications should behave. Often, these Fenix´ Framework: We describe how to extend the commit changes had a reflection in the architecture of applications. algorithm of the STM that we use to ensure the durability of Still, one thing has remained the same for most applica- the application’s data; we describe the life cycle of a persis- tions: The underlying DBMS provides not only persistence tent domain object; and we describe how we use a shared, but also the transactional semantics on which application de- global identity map to keep domain objects in memory and velopers rely for programming business transactions. preserve their identity across transactions and threads. We Unfortunately, this means that developers are limited describe, also, the mechanisms used to allow the simultane- to the isolation levels provided by the underlying DBMS, ous existence of more than one application server accessing which often does not provide serializability—a correctness the same data, while still ensuring strict-serializable consis- property for concurrent transactions that is crucial to ensure tency guarantees for all the transactions running across all of the integrity of the applications’ data. the application servers. Historically, DBMSs weakened the isolation level of Third, and finally, we present statistical data about the transactions as a trade-off between correctness and perfor- workload patterns of two real-world enterprise applications. mance, which resulted in the generally accepted idea that These
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages19 Page
-
File Size-