Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
ActiveRecord provides a great deal of flexibility and speed of implementation for developers making new apps. As our teams and codebase grow and our services need to continue to scale, some of the patterns we use can start to get in our way. We've seen a bit of that at GitHub, and as a result have been experimenting with some new ways to work with ActiveRecord queries, reduce N+1s, and isolate model details. In this talk, I'll go over some the problems we've been facing, cover how we've been addressing them so far, and show some new experiments & patterns I've been working through.
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
In this talk presented at RailsConf 2022, John Crepezzi discusses the challenges GitHub faces with their monolithic Rails application, particularly in relation to ActiveRecord. He begins by recognizing the flexibility and speed ActiveRecord provides developers but highlights how its design can lead to issues as applications scale, specifically regarding common patterns that might introduce inefficiencies like N+1 queries. The key points covered in his presentation include: - **Batch Loading and N+1 Queries**: Crepezzi emphasizes the common pitfall of N+1 queries, where initial queries lead to multiple subsequent queries for related data. He discusses solutions like using `includes` to pre-fill associations, which can prevent N+1 problems. - **Limitations of Includes**: Despite their utility, `includes` can lead to over-fetching data and can be hard to maintain as the application evolves or when dealing with GraphQL API requests that require dynamically nested queries. - **Introduction of the GraphQL Batch Library**: Crepezzi introduces a library from Shopify that facilitates batch loading for GraphQL, allowing developers to resolve N+1 issues efficiently without explicitly managing includes. - **Experiments Using Prelude**: At GitHub, they've been experimenting with a library named Prelude to redefine the batch method signature, creating a more streamlined interaction model that inherently handles batch loading. - **Code Ownership Concerns**: The discussion transitions to the challenges of code ownership in large applications. Crepezzi suggests that as applications grow, they often become challenging to navigate when different teams work on overlapping domains. He presents issues around API exposure between models owned by different teams, promoting the use of tools like Packwerk and the adoption of private methods to enforce stricter separation of concerns. In his conclusion, Crepezzi advocates for evolving the ActiveRecord framework and patterns to better suit the needs of modern development. He emphasizes that these challenges are amplified in larger codebases and suggests that by making changes to the APIs within ActiveRecord, developers can be guided towards best practices. The talk inspires thought on how the community can mold ActiveRecord to enhance its functionality for future Rails developers.
Suggest modifications
Cancel