skip to main content
10.1145/2491411.2491412acmconferencesArticle/Chapter ViewAbstractPublication PagesfseConference Proceedingsconference-collections
research-article

Preventing database deadlocks in applications

Published:18 August 2013Publication History

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.

References

  1. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  5. 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 ScholarGoogle Scholar
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. E. G. Coffman, M. Elphick, and A. Shoshani. System deadlocks. ACM Comput. Surv., 3(2):67–78, 1971. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. M. A. Dimmler and A. K. Schmig. Using discrete-time analysis in the performance evaluation of manufacturing systems. In IN SMOMS’99, 1999.Google ScholarGoogle Scholar
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. 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 ScholarGoogle Scholar
  12. J. Gray and A. Reuter. Transaction Processing: Concepts and Techniques. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA, 1st edition, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. J. Griggs. Database deadlock avoidance patterns. http://c2.com/cgi/wiki?DatabaseDeadlockAvoidancePatterns, Sept. 2003.Google ScholarGoogle Scholar
  15. J. M. Hellerstein, M. Stonebraker, and J. Hamilton. Architecture of a database system. Found. Trends databases, 1(2):141–259, Feb. 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. M. Hofri. On timeout for global deadlock detection in decentralized database systems. Inf. Process. Lett., 51:295–302, September 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  18. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  19. J. Kehayias and T. Krueger. Troubleshooting SQL Server: A Guide for the Accidental DBA. Red gate books, Cambridge, CB4 0WZ, UK, Sept. 2011.Google ScholarGoogle Scholar
  20. D. B. Lomet. Subsystems of processes with deadlock avoidance. IEEE Trans. Software Eng., 6(3):297–304, 1980. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  22. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  23. M. Nonemacher. Deadlocks in j2ee. Java Dev. Journal, Apr. 2006.Google ScholarGoogle Scholar
  24. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  25. H. K. Pyla and S. Varadarajan. Avoiding deadlock avoidance. PACT ’10, pages 75–86, New York, NY, USA, 2010. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  27. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  28. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  29. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  30. D. R. Slutz. Massive stochastic testing of SQL. In Proc. 24rd VLDB, pages 618–622. Morgan Kaufmann, Aug. 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. D. S. Team. Java Server Programming J2Ee 1.4 Ed. Black Book. Wiley Publications, 2007.Google ScholarGoogle Scholar
  32. 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 ScholarGoogle Scholar
  33. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  34. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  35. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  36. N. Yuhanna, M. Gilpin, and D. D’Silva. Tpc benchmarks don’t matter anymore. Forrester Research, 2009.Google ScholarGoogle Scholar

Index Terms

  1. Preventing database deadlocks in applications

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in
      • Published in

        cover image ACM Conferences
        ESEC/FSE 2013: Proceedings of the 2013 9th Joint Meeting on Foundations of Software Engineering
        August 2013
        738 pages
        ISBN:9781450322379
        DOI:10.1145/2491411

        Copyright © 2013 ACM

        Permission to make digital or hard copies of all or part of this work for personal or 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 on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 18 August 2013

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article

        Acceptance Rates

        Overall Acceptance Rate112of543submissions,21%

        Upcoming Conference

        FSE '24

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader