Skip to main content
Log in

Consistency anomalies in multi-tier architectures: automatic detection and prevention

  • Regular Paper
  • Published:
The VLDB Journal Aims and scope Submit manuscript

Abstract

Modern transaction systems, consisting of an application server tier and a database tier, offer several levels of isolation providing a trade-off between performance and consistency. While it is fairly well known how to identify qualitatively the anomalies that are possible under a certain isolation level, it is much more difficult to detect and quantify such anomalies during run-time of a given application. In this paper, we present a new approach to detect and quantify consistency anomalies for arbitrary multi-tier application running under any isolation levels ensuring at least read committed. In fact, the application can run even under a mixture of isolation levels. Our detection approach can be online or off-line and for each detected anomaly, we identify exactly the transactions and data items involved. Furthermore, we classify the detected anomalies into patterns showing the business methods involved as well as analyzing the types of cycles that occur. Our approach can help designers to either choose an isolation level where the anomalies do not occur or to change the transaction design to avoid the anomalies. Furthermore, we provide an option in which the occurrence of anomalies can be automatically reduced during run-time. To test the effectiveness and efficiency of our approach, we have conducted a set of experiments using a wide range of benchmarks.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13

Similar content being viewed by others

Notes

  1. http://www.hibernate.org/.

  2. http://www.jboss.org/.

  3. http://glassfish.dev.java.net/.

  4. http://www.jboss.org/.

  5. http://www.hibernate.org/.

  6. http://www.oracle.com/technology/products/ias/toplink/.

  7. The property of no blind writes holds for many middle-tier based applications. It includes that we do not support blind-updates caused by triggers.

  8. http://www.ebay.com/.

  9. As we do not compare the actual performance nor compare the benchmarks with each other, we believe that having different machine configurations is not a problem.

References

  1. Adya, A.: Weak Consistency: A Generalized Theory and Optimistic Implementations for Distributed Transactions. PhD thesis, MIT (1999)

  2. Adya, A., Liskov, B., O’Neil, P.E.: Generalized isolation level definitions. In IEEE International Conference on Data Engineering (ICDE), pp. 67–78 (2000)

  3. Amza, C., Chanda, A., Cox, A.L., Elnikety, S., Gil, R., Rajamani, K., Zwaenepoel, W.: Specification and implementation of dynamic web site benchmarks. In Workshop on Workload Characterization (WWC), pp. 3–13 (2002)

  4. Berenson, H., Bernstein, P.A., Gray, J., Melton, J., O’Neil E.J., O’Neil, P.E.: A critique of ANSI SQL isolation levels. In ACM SIGMOD International Conference on Management of Data, pp. 1–10 (1995)

  5. Bernstein, A., Lewis, P., Lu, S.: Semantic conditions for correctness at different isolation levels. In IEEE International Conference on Data Engineering (ICDE), pp. 57–66. IEEE (2000)

  6. Bernstein, P.A., Fekete, A., Guo, H., Ramakrishnan, R., Tamma, P.: Relaxed-currency serializability for middle-tier caching and replication. In ACM SIGMOD International Conference on Management of Data, pp. 599–610 (2006)

  7. Bernstein, P.A., Hadzilacos, V., Goodman, N.: Concurrency Control and Recovery in Database Systems. Addison Wesley, Reading (1987)

    Google Scholar 

  8. Cahill, M.J., Röhm, U., Fekete, A.D.: Serializable isolation for snapshot databases. ACM Trans. Database Syst. (TODS), 34(4), 20:1–20:42 (2009)

    Google Scholar 

  9. Casanova, M.A.: The Concurrency Control Problem for Database Systems, Lecture Notes in Computer Science, vol. 116. Springer, Berlin (1981)

    Book  Google Scholar 

  10. Daudjee, K., Salem K.: Inferring a serialization order for distributed transactions. In IEEE International Conference on Data Engineering (ICDE), p. 154 (2006)

  11. Elnikety, S., Dropsho, S.G., Pedone, F. (2006) Tashkent: uniting durability with transaction ordering for high-performance scalable database replication. In EuroSys Conference, pp. 117–130

  12. Eswaran, K.P., Gray, J.N., Lorie, R.A., Traiger, I.L.: The notions of consistency and predicate locks in a database system. Communications of the ACM 19(11), 624–633 (1976)

    Google Scholar 

  13. Fekete, A.: Serialisability and snapshot isolation. In The Australian Database Conference (ADC), pp. 201–210 (1999)

  14. Fekete, A., Goldrei, S., Asenjo, J.P.: Quantifying isolation anomalies. Int. Conf. Very Large Data Bases (VLDB) 2(1), 467–478 (2009)

    Google Scholar 

  15. Fekete, A., Liarokapis, D., O’Neil, E.J., O’Neil, P.E., Shasha, D.: Making snapshot isolation serializable. ACM Trans. Database Syst. (TODS) 30(2), 492–528 (2005)

    Article  Google Scholar 

  16. Georgakopoulos, D., Rusinkiewicz, M., Sheth, A.P.: On serializability of multidatabase transactions through forced local conflicts. In IEEE International Conference on Data Engineering (ICDE), pp. 314–323 (1991)

  17. Jorwekar, S., Fekete, A., Ramamritham, K., Sudarshan, S.: Automating the detection of snapshot isolation anomalies. In International Conference on Very Large Data Bases (VLDB), pp. 1263–1274 (2007)

  18. JPA. The Java Persistence API, Sun Microsystems, JSR 220. http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html

  19. Kraska, T., Hentschel, M., Alonso, G., Kossmann, D.: Consistency rationing in the cloud: Pay only when it matters. Int. Conf. Very Large Data Bases (VLDB) 2(1), 253–264 (2009)

    Google Scholar 

  20. Kung, H.T., Robinson, J.T.: On optimistic methods for concurrency control. ACM Trans. Database Syst. (TODS) 6(2), 213–226 (1981)

    Article  Google Scholar 

  21. Paulley, G.: The second deadly sin part un. PowerBuilder Developer’s Journal, July 2012, 19(7), pp. 6–9, A similar version appeared as blog at http://iablog.sybase.com/paulley/2012/05/the-second-deadly-sin-part-un/

  22. Ports, D.R.K., Grittner, K.: Serializable snapshot isolation in postgresql. In International Conference on Very Large Data Bases (VLDB) (2012)

  23. Revilak, S., O’Neil, P.E., O’Neil, E.J.: Precisely serializable snapshot isolation (pssi). In IEEE International Conference on Data Engineering (ICDE), pp. 482–493 (2011)

  24. Röhm, U., Böhm, K., Schek, H.-J., Schuldt, H.: Fas - a freshness-sensitive coordination middleware for a cluster of olap components. In International Conference on Very Large Data Bases (VLDB), pp. 754–765 (2002)

  25. Röhm, U., Schmidt, S.: Freshness-aware caching in a cluster of J2EE application servers. In International Conference on Web Information Systems Engineering (WISE), pp. 74–86 (2007)

  26. SPECjEnterprise2010. A performance benchmark for Java Enterprise Edition (JavaEE) 5 or later application servers. http://www.spec.org/jEnterprise2010/

  27. Tarjan, R.E.: Depth-first search and linear graph algorithms. SIAM J. Comput. (SICOMP) 1(2), 146–160 (1972)

    Article  MATH  MathSciNet  Google Scholar 

  28. TPC-C.: An on-line transaction processing benchmark. http://www.tpc.org/tpcc/

  29. Yabandeh, M., Ferro, D.G.: A critique of snapshot isolation. In EuroSys Conference, pp. 155–168 (2012)

  30. Zellag, K.: On the Detection and Prevention of Consistency Anomalies in Multi-tier and Cloud Applications. PhD thesis, McGill University (2012)

  31. Zellag, K., Kemme, B.: Real-time quantification and classification of consistency anomalies in multi-tier architectures. In IEEE International Conference on Data Engineering (ICDE), pp. 613–624 (2011)

  32. Zellag, K., Kemme, B.: Consad: a real-time consistency anomalies detector. In ACM SIGMOD International Conference on Management of Data, pp. 641–644 (2012)

  33. Zellag, K., Kemme, B.: How consistent is your cloud application? In ACM Symposium on Cloud Computing (SoCC), pp. 6:1–6:14 (2012)

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Kamal Zellag.

Appendices

Correctness of algorithm 1

In this section, we show that for any type of dependency between two transactions \(T_i\) and \(T_j\), processTx adds the corresponding dependency edge to the dependency graph at the time the second of the two transactions is processed. Assume without loss of generality that there is an edge from \(T_i\) to \(T_j\) due to entity \(x\). We consider several cases:

  1. 1

    \(T_i\) is processed before \(T_j\)

    1. a

      If \(T_i - wr \rightarrow T_j\), then the edge is added when processReadEntity, line 3, is executed for \(T_j\).

    2. b

      If \(T_i - rw \rightarrow T_j\), processReadEntity for \(T_i\) adds \(T_i\) to the readers of the predecessor of \(T_j\) (in regard to \(x\)) in line 10, and processUpdateEntity for \(T_j\) adds the proper \(rw\)-edge in lines 16–17.

    3. c

      If \(T_i - ww \rightarrow T_j\), processUpdateEntity for \(T_j\) adds the edge in lines 6–7.

  2. 2

    \(T_j\) is processed before \(T_i\)

    1. a

      If \(T_i - wr \rightarrow T_j\), processReadEntity for \(T_j\) adds \(T_j\) to the readers of \(T_i\) (in regard to \(x\)) in line 5, and processUpdateEntity for \(T_i\) adds the proper \(wr\)-edge at lines 18–19.

    2. b

      If \(T_i - rw \rightarrow T_j, \) processUpdateEntity for \(T_j\) adds \([(x.key, T_p\_id), T_j\_id)]\) to \(successors\) in line 15, and processReadEntity for \(T_i\) retrieves \(T_j\_id\) in line 6 and adds the \(rw\)-edge in lines 7–8.

    3. c

      If \(T_i - ww \rightarrow T_j\), processUpdateEntity for \(T_j\) adds \([(x.key, T_i\_id), T_j\_id)]\) to \(successors\) in line 15, and processUpdateEntity for \(T_i\) retrieves this information in line 10, and adds the \(ww\)-edge in lines 11–12.

Each edge is added exactly once. Therefore, all data structures maintained by ProcessReadEntity and ProcessUpdateEntity can be implemented with simple hash functions. Thus, building the dependency graph is linear with the number of operations.

Proofs

For the following proofs, recall that \(s_i < c_j\) if \(T_i\) starts before \(T_j\) commits, and \(c_j \le s_i\) if it starts after \(T_j\) committed. Obviously, any read/write operation of \(T_i\) occurs between its start and its commit, i.e., \(s_i < r_i/w_i < c_i\).

1.1 Proof of Theorem 5.2

Lemma 14.1

For any RC+ history, if there is a \(wr\)- or a \(ww\)-edge from \(T_i\) to \(T_j\), then \(c_i < c_j\).

Proof

For \(T_i - ww \rightarrow T_j\), this is true by definition of this edge type. For \(T_i - wr \rightarrow T_j\), RC+ requires a read operation \(r_j\) to only read a committed value \(x_i\). Thus, \(c_i < r_j\), and hence \(c_i < c_j\) \(\square \)

Lemma 14.2

For any RC+ history, if there is a \(rw\)-edge from \(T_i\) to \(T_j\) then \(s_i < c_j\).

Proof

For \(T_i - rw \rightarrow T_j\), then there is a read operation \(r_i\) that reads a value written by committed transaction \(T_k\) and \(T_j\) is the next transaction to write \(x\) and commit. As RC+ reads the last committed version as of start of operation, this means the read of \(T_i\) must be after the commit of \(T_k\) but before the commit of \(T_j\), i.e., \(c_k < r_i < c_j\). Therefore, \(s_i < c_j\). \(\square \)

Lemma 14.3

Under a RC+ history, if there is an edge (of any type) between \(T_i\) and \(T_j\) then \(s_i < c_j\).

Proof

It is a straightforward conclusion from Lemma 14.1 and Lemma 14.2. \(\square \)

Proof of Theorem 5.2

We denote by \(T_3\) the first committing transaction in a given cycle \(C\), and \(T_2\) the predecessor of \(T_3\) and \(T_1\) the predecessor of \(T_2\).

We first show that \(T_2 \parallel T_3\) and \(T_2 \parallel T_1\). Assume that \(T_2 \not \parallel T_3\) (\(\not \parallel \) means not concurrent), then either (1) \(c_2 < s_3\) or (2) \(c_3 < s_2\). (1) is not possible, since \(c_2 < s_3\) implies \(c_2 < s_3 < c_3\), thus \(c_2 < c_3\) which contradicts that \(T_3\) is the first committer in \(C\). Based on Lemma 14.3, since there is an edge from \(T_2\) to \(T_3\), we have \(s_2 < c_3\) and thus (2) is also not possible. As neither (1) nor (2) is possible, \(T_2\) and \(T_3\) must be concurrent. Now, assume that \(T_2 \not \parallel T_1\), meaning either (3) \(c_2 < s_1\) or (4) \(c_1 < s_2\). (3) is impossible as there is an edge from \(T_1\) to \(T_2\) which requires \(s_1 < c_2\) based on Lemma 14.3. The edge from \(T_2\) to \(T_3\) requires \(s_2 < c_3\). If we assume (4) holds, then we have \(c_1 < s_2 < c_3\) which contradicts the fact that \(T_3\) is the first committer in \(C\). As neither (3) nor (4) are possible, \(T_1\) and \(T_2\) must be concurrent. \(\square \)

Finally, assume that the edge from \(T_2\) to \(T_3\) is not a \(rw\)-edge but a \(wr\)- or \(ww\)-edge. Based on Lemma 14.1, this requires \(c_2 < c_3\). But this contradicts the fact that \(T_3\) is the first committed in \(C\).

1.2 Proof of Lemma 5.1

Given an \(edge\) from a transaction \(T_i\) to a transaction \(T_j\) in a dependency graph generated under RC+, such as \(c_j < c_i\) (\(T_i\) commits after \(T_j\)). Let us assume that the edge from \(T_i\) to \(T_j\) is a \(wr\) ow \(ww\)-edge. Based on Lemma 14.1, we will have \(c_i < c_j\) which contradicts the fact that \(T_i\) commits after \(T_j\) (\(c_j < c_i\)). Therefore, the edge from \(T_i\) to \(T_j\) can only be of type \(rw\). Based on Lemma 14.2, \(T_i - rw \rightarrow T_j\) implies that \(s_i < c_j\). And since \(c_j < c_i\), we get \(s_i < c_j < c_i\) which means \(T_i\) is concurrent to \(T_j\).

Rights and permissions

Reprints and permissions

About this article

Cite this article

Zellag, K., Kemme, B. Consistency anomalies in multi-tier architectures: automatic detection and prevention . The VLDB Journal 23, 147–172 (2014). https://doi.org/10.1007/s00778-013-0318-x

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00778-013-0318-x

Keywords

Navigation