Abstract
Most popular Web applications rely on persistent databases based on languages like SQL for declarative specification of data models and the operations that read and modify them. As applications scale up in user base, they often face challenges responding quickly enough to the high volume of requests. A common aid is caching of database results in the application's memory space, taking advantage of program-specific knowledge of which caching schemes are sound and useful, embodied in handwritten modifications that make the program less maintainable. These modifications also require nontrivial reasoning about the read-write dependencies across operations. In this paper, we present a compiler optimization that automatically adds sound SQL caching to Web applications coded in the Ur/Web domain-specific functional language, with no modifications required to source code. We use a custom cache implementation that supports concurrent operations without compromising the transactional semantics of the database abstraction. Through experiments with microbenchmarks and production Ur/Web applications, we show that our optimization in many cases enables an easy doubling or more of an application's throughput, requiring nothing more than passing an extra command-line flag to the compiler.
- S. Abiteboul, R. Hull, and V. Vianu, editors. Foundations of Databases: The Logical Level. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 1st edition, 1995. ISBN 0201537710. Google Scholar
Digital Library
- U. A. Acar, A. Ahmed, and M. Blume. Imperative self-adjusting computation. In Proc. POPL, pages 309–322. ACM, 2008. Google Scholar
Digital Library
- M. M. Astrahan, M. W. Blasgen, D. D. Chamberlin, K. P. Eswaran, J. N. Gray, P. P. Griffiths, W. F. King, R. A. Lorie, P. R. McJones, J. W. Mehl, G. R. Putzolu, I. L. Traiger, B. W. Wade, and V. Watson. System R: Relational approach to database management. ACM Trans. Database Syst., 1(2):97–137, June 1976. Google Scholar
Digital Library
- E. Benson, A. Marcus, D. Karger, and S. Madden. Sync kit: a persistent clientside database caching toolkit for data intensive websites. In Proceedings of the 19th international conference on World wide web, pages 121–130. ACM, 2010. Google Scholar
Digital Library
- J. A. Blakeley, P.-A. Larson, and F. W. Tompa. Efficiently updating materialized views. In Proc. SIGMOD, pages 61–71. ACM, 1986. Google Scholar
Digital Library
- J. A. Blakeley, N. Coburn, and P.-A. Larson. Updating derived relations: Detecting irrelevant and autonomously computable updates. ACM Trans. Database Syst., 14(3):369–400, Sept. 1989. ISSN 0362-5915. Google Scholar
Digital Library
- Google Scholar
Digital Library
- A. Cheung, S. Madden, O. Arden, and A. C. Myers. Automatic partitioning of database applications. Proc. VLDB Endow., 5(11):1471–1482, July 2012. Google Scholar
Digital Library
- A. Cheung, A. Solar-Lezama, and S. Madden. Optimizing database-backed applications with query synthesis. In Proc. PLDI, pages 3–14. ACM, 2013. Google Scholar
Digital Library
- A. Cheung, S. Madden, and A. Solar-Lezama. Sloth: Being lazy is a virtue (when issuing database queries). In Proc. SIGMOD, pages 931–942. ACM, 2014. Google Scholar
Digital Library
- A. Chlipala. Static checking of dynamically-varying security policies in database-backed applications. In Proc. OSDI, pages 105–118, 2010. Google Scholar
Digital Library
- A. Chlipala. An optimizing compiler for a purely functional Web-application language. In Proc. ICFP, pages 10–21. ACM, 2015a. A. Chlipala. Ur/Web: A simple model for programming the Web. In Proc. POPL, pages 153–165. ACM, 2015b. S. Chong, J. Liu, A. C. Myers, X. Qi, K. Vikram, L. Zheng, and X. Zheng. Secure web applications via automatic partitioning. In Proc. SOSP, pages 31–44. ACM, 2007. Google Scholar
Digital Library
- E. F. Codd. Relational database: A practical foundation for productivity. Commun. ACM, 25(2):109–117, Feb. 1982. Google Scholar
Digital Library
- E. Cooper, S. Lindley, P. Wadler, and J. Yallop. Links: Web programming without tiers. In Proc. FMCO, pages 266–296, 2006. Google Scholar
Digital Library
- B. J. Corcoran, N. Swamy, and M. Hicks. Cross-tier, label-based security enforcement for web applications. In Proc. SIGMOD, pages 931–942. ACM, 2009. Google Scholar
Digital Library
- S. Dar, M. J. Franklin, B. T. J´onsson, D. Srivastava, and M. Tan. Semantic data caching and replacement. In Proc. VLDB, pages 330–341. Morgan Kaufmann Publishers Inc., 1996. Google Scholar
Digital Library
- D. Detlefs, G. Nelson, and J. B. Saxe. Simplify: a theorem prover for program checking. Journal of the ACM, 52(3):365–473, 2005. Google Scholar
Digital Library
- J. Goldstein and P.-A. Larson. Optimizing queries using materialized views: A practical, scalable solution. In Proc. SIGMOD, pages 331–342. ACM, 2001. Google Scholar
Digital Library
- H. Guo, P.-A. Larson, R. Ramakrishnan, and J. Goldstein. Support for relaxed currency and consistency constraints in MTCache. In Proc. SIGMOD, pages 937–938. ACM, 2004. Google Scholar
Digital Library
- M. A. Hammer, U. A. Acar, and Y. Chen. CEAL: A C-based language for self-adjusting computation. In Proc. PLDI, pages 25–37. ACM, 2009. Google Scholar
Digital Library
- Y. Klonatos, C. Koch, T. Rompf, and H. Chafi. Building efficient query engines in a high-level language. Proc. VLDB Endow., 7(10):853–864, June 2014. Google Scholar
Digital Library
- P.-A. Larson and H. Z. Yang. Computing queries from derived relations. In Proc. VLDB, pages 259–269. VLDB Endowment, 1985. Google Scholar
Digital Library
- W.-S. Li, K. S. Candan, W.-P. Hsiung, O. Po, D. Agrawal, Q. Luo, W.-K. W. Huang, Y. Akca, and C. Yilmaz. Cache portal: Technology for accelerating database-driven e-commerce web sites. In VLDB, pages 699–700, 2001. Google Scholar
Digital Library
- E. Meijer, B. Beckman, and G. Bierman. LINQ: Reconciling objects, relations and XML in the .NET framework. In Proc. SIGMOD, pages 706–706. ACM, 2006. Google Scholar
Digital Library
- A. Ohori and K. Ueno. Making Standard ML a practical database programming language. In Proc. ICFP, pages 307–319. ACM, 2011. Google Scholar
Digital Library
- D. R. K. Ports, A. T. Clements, I. Zhang, S. Madden, and B. Liskov. Transactional consistency and automatic management in an application data cache. In Proc. OSDI, pages 1–15. USENIX Association, 2010. Google Scholar
Digital Library
- K. Ramachandra and S. Sudarshan. Holistic optimization by prefetching query results. In Proc. SIGMOD, pages 133–144. ACM, 2012. Google Scholar
Digital Library
- G. Ramalingam and T. Reps. A categorized bibliography on incremental computation. In Proc. POPL, pages 502–510. ACM, 1993. Google Scholar
Digital Library
- T. Rompf and N. Amin. Functional pearl: A SQL to C compiler in 500 lines of code. In Proc. ICFP, pages 2–9. ACM, 2015. Google Scholar
Digital Library
- A. Shankar and R. Bod´ık. DITTO: Automatic incrementalization of data structure invariant checks (in Java). In Proc. PLDI, pages 310–319. ACM, 2007. Google Scholar
Digital Library
- D. Shasha, F. Llirbat, E. Simon, and P. Valduriez. Transaction chopping: Algorithms and performance studies. ACM Trans. Database Syst., 20(3): 325–363, Sept. 1995. Google Scholar
Digital Library
- M. Stonebraker, G. Held, E. Wong, and P. Kreps. The design and implementation of INGRES. ACM Trans. Database Syst., 1(3):189–222, Sept. 1976. Google Scholar
Index Terms
A program optimization for automatic database result caching
Recommendations
A program optimization for automatic database result caching
POPL '17: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming LanguagesMost popular Web applications rely on persistent databases based on languages like SQL for declarative specification of data models and the operations that read and modify them. As applications scale up in user base, they often face challenges ...
(R) Program Analysis for Cache Coherence: Beyond Procedural Boundaries
ICPP '96: Proceedings of the Proceedings of the 1996 International Conference on Parallel Processing - Volume 3Abstract: The presence of procedures and procedure calls introduces side effects, which complicates the analysis of stale reference detection in compiler-directed cache coherence schemes. Previous compiler algorithms use cache invalidation at procedure ...
Making standard ML a practical database programming language
ICFP '11: Proceedings of the 16th ACM SIGPLAN international conference on Functional programmingIntegrating a database query language into a programming language is becoming increasingly important in recently emerging high-level cloud computing and other applications, where efficient and sophisticated data manipulation is required during ...







Comments