ABSTRACT
Many organizations deploy applications that use databases by sending Structured Query Language (SQL) statements to them and obtaining data that result from the execution of these statements. Since applications often share the same databases concurrently, database deadlocks routinely occur in these databases resulting in major performance degradation in these applications. Database engines do not prevent database deadlocks for the same reason that the schedulers of operating system kernels do not preempt processes in a way to avoid race conditions and deadlocks - it is not feasible to find an optimal context switching schedule quickly for multiple processes (and SQL statements), and the overhead of doing it is prohibitive.
We created a novel approach that combines run-time monitoring, which automatically prevents database deadlocks, with static analysis, which detects hold-and-wait cycles that specify how resources (e.g., database tables) are held in contention during executions of SQL statements. We rigorously evaluated our approach. For a realistic case of over 1,200 SQL statements, our algorithm detects all hold-and-wait cycles in less than two seconds. We built a toolset and experimented with three applications. Our tool prevented all existing database deadlocks in these applications and increased their throughputs by up to three orders of magnitude.
- S. Abdul Khalek and S. Khurshid. Automated SQL query generation for systematic testing of database engines. In Proc. IEEE/ACM ASE, pages 329–332. ACM, Sept. 2010. Google ScholarDigital Library
- R. Agrawal, M. J. Carey, and M. Livny. Concurrency control performance modeling: alternatives and implications. ACM Trans. Database Syst., 12(4):609–654, Nov. 1987. Google ScholarDigital Library
- A. Arcuri and L. C. Briand. A practical guide for using statistical tests to assess randomized algorithms in software engineering. In Proc. 33rd International Conference on Software Engineering (ICSE 2011), pages 1–10, Honolulu, Hawaii, May 2011. Google ScholarDigital Library
- J. Billington, S. Christensen, K. Van Hee, E. Kindler, O. Kummer, L. Petrucci, R. Post, C. Stehno, and M. Weber. The Petri net markup language: concepts, technology, and tools. ICATPN’03, pages 483–505, Berlin, Heidelberg, 2003. Springer-Verlag. Google ScholarDigital Library
- P. Bruni, P. Becker, J. Henderyckx, J. Link, and B. Steegmans. DB2 UDB for z/OS: Design Guidelines for High Performance and Availability. IBM Redbooks, New York, NY, USA, Jan. 2006.Google Scholar
- M. J. Cahill, U. Röhm, and A. D. Fekete. Serializable isolation for snapshot databases. ACM Trans. Database Syst., 34(4):20:1–20:42, Dec. 2009. Google ScholarDigital Library
- Y. Cai and W. K. Chan. Magicfuzzer: scalable deadlock detection for large-scale applications. ICSE 2012, pages 606–616, Piscataway, NJ, USA, 2012. IEEE Press. Google ScholarDigital Library
- E. G. Coffman, M. Elphick, and A. Shoshani. System deadlocks. ACM Comput. Surv., 3(2):67–78, 1971. Google ScholarDigital Library
- M. A. Dimmler and A. K. Schmig. Using discrete-time analysis in the performance evaluation of manufacturing systems. In IN SMOMS’99, 1999.Google Scholar
- D. Engler and K. Ashcraft. Racerx: effective, static detection of race conditions and deadlocks. SOSP ’03, pages 237–252, New York, NY, USA, 2003. ACM. Google ScholarDigital Library
- H. Garcia-Molina. A concurrency control mechanism for distributed databases which use centralized locking controllers. In Proceedings of the Fourth Berkeley Workshop on Distributed Databases and Computer Networks, pages 113–122, Berkeley, CA, USA, Aug. 1979.Google Scholar
- J. Gray and A. Reuter. Transaction Processing: Concepts and Techniques. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA, 1st edition, 1992. Google ScholarDigital Library
- M. Grechanik, B. M. Hossain, and U. Buy. Testing database-centric applications for causes of database deadlocks. In ICST, pages 1–10, Mar. 2013. Google ScholarDigital Library
- J. Griggs. Database deadlock avoidance patterns. http://c2.com/cgi/wiki?DatabaseDeadlockAvoidancePatterns, Sept. 2003.Google Scholar
- J. M. Hellerstein, M. Stonebraker, and J. Hamilton. Architecture of a database system. Found. Trends databases, 1(2):141–259, Feb. 2007. Google ScholarDigital Library
- M. Hofri. On timeout for global deadlock detection in decentralized database systems. Inf. Process. Lett., 51:295–302, September 1994. Google ScholarDigital Library
- H. Jula, D. Tralamazza, C. Zamfir, and G. Candea. Deadlock immunity: enabling systems to defend against deadlocks. OSDI’08, pages 295–308, Berkeley, CA, USA, 2008. USENIX Association. Google ScholarDigital Library
- R. Kallman, H. Kimura, J. Natkins, A. Pavlo, A. Rasin, S. Zdonik, E. P. C. Jones, S. Madden, M. Stonebraker, Y. Zhang, J. Hugg, and D. J. Abadi. H-store: a high-performance, distributed main memory transaction processing system. Proc. VLDB Endow., 1(2):1496–1499, Aug. 2008. Google ScholarDigital Library
- J. Kehayias and T. Krueger. Troubleshooting SQL Server: A Guide for the Accidental DBA. Red gate books, Cambridge, CB4 0WZ, UK, Sept. 2011.Google Scholar
- D. B. Lomet. Subsystems of processes with deadlock avoidance. IEEE Trans. Software Eng., 6(3):297–304, 1980. Google ScholarDigital Library
- S. Lu, S. Park, E. Seo, and Y. Zhou. Learning from mistakes: a comprehensive study on real world concurrency bug characteristics. ASPLOS XIII, pages 329–339, New York, NY, USA, 2008. ACM. Google ScholarDigital Library
- C. Mohan, B. Lindsay, and R. Obermarck. Transaction management in the r* distributed database management system. ACM Trans. Database Syst., 11(4):378–396, Dec. 1986. Google ScholarDigital Library
- M. Nonemacher. Deadlocks in j2ee. Java Dev. Journal, Apr. 2006.Google Scholar
- M. Poess and J. M. Stephens, Jr. Generating thousand benchmark queries in seconds. In Proc. 13th VLDB, pages 1045–1053. Morgan Kaufmann, Aug. 2004. Google ScholarDigital Library
- H. K. Pyla and S. Varadarajan. Avoiding deadlock avoidance. PACT ’10, pages 75–86, New York, NY, USA, 2010. ACM. Google ScholarDigital Library
- F. Qin, J. Tucek, Y. Zhou, and J. Sundaresan. Rx: Treating bugs as allergiesa safe method to survive software failures. ACM Trans. Comput. Syst., 25(3), Aug. 2007. Google ScholarDigital Library
- S. K. Rahimi and F. S. Haug. Distributed Database Management Systems: A Practical Approach. Wiley-IEEE Computer Society Pr, New York, NY, USA, 1st edition, Aug. 2010. Google ScholarDigital Library
- D. J. Rosenkrantz, R. E. Stearns, and P. M. Lewis, II. System level concurrency control for distributed database systems. ACM Trans. Database Syst., 3(2):178–198, June 1978. Google ScholarDigital Library
- D. C. Schmidt, M. Stal, H. Rohnert, and F. Buschmann. Pattern-Oriented Software Architecture: Patterns for Concurrent and Networked Objects. John Wiley & Sons, Inc., New York, NY, USA, 2nd edition, 2000. Google ScholarDigital Library
- D. R. Slutz. Massive stochastic testing of SQL. In Proc. 24rd VLDB, pages 618–622. Morgan Kaufmann, Aug. 1998. Google ScholarDigital Library
- D. S. Team. Java Server Programming J2Ee 1.4 Ed. Black Book. Wiley Publications, 2007.Google Scholar
- F. Tricas, J. Colom, and J. Ezpeleta. A solution to the problem of deadlocks in concurrent systems using Petri nets and integer linear programming. In Proc. of the 11th European Simulation Symposium.Google Scholar
- H. Volos, A. J. Tack, M. M. Swift, and S. Lu. Applying transactional memory to concurrency bugs. ASPLOS ’12, pages 211–222, New York, NY, USA, 2012. ACM. Google ScholarDigital Library
- Y. Wang, S. Lafortune, T. Kelly, M. Kudlur, and S. A. Mahlke. The theory of deadlock avoidance via discrete control. In POPL, pages 252–263, 2009. Google ScholarDigital Library
- A. Williams, W. Thies, and M. D. Ernst. Static deadlock detection for Java libraries. In ECOOP 2005, pages 602–629, Glasgow, Scotland, July 27–29, 2005. Google ScholarDigital Library
- N. Yuhanna, M. Gilpin, and D. D’Silva. Tpc benchmarks don’t matter anymore. Forrester Research, 2009.Google Scholar
Index Terms
- Preventing database deadlocks in applications
Recommendations
REDACT: preventing database deadlocks from application-based transactions
ESEC/FSE 2013: Proceedings of the 2013 9th Joint Meeting on Foundations of Software EngineeringIn this demonstration, we will present a database deadlocks prevention system that visualizes our algorithm for detecting hold-and-wait cycles that specify how resources (e.g., database tables) are locked and waited on to be locked during executions of ...
Testing Database-Centric Applications for Causes of Database Deadlocks
ICST '13: Proceedings of the 2013 IEEE Sixth International Conference on Software Testing, Verification and ValidationMany organizations deploy applications that use databases by sending Structured Query Language (SQL) statements to them and obtaining data that result from executions of these statements. Since applications often share the same databases concurrently, ...
Fixing deadlocks via lock pre-acquisitions
ICSE '16: Proceedings of the 38th International Conference on Software EngineeringManual deadlock fixing is error-prone and time-consuming. Existing generic approach (GA) simply inserts gate locks to fix deadlocks by serializing executions, which could introduce various new deadlocks and incur high runtime overhead. We propose a ...
Comments