Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
RailsConf 2019 - New HotN+1ness -Hard lessons migrating from REST to GraphQL by Eric Allen _______________________________________________________________________________________________ Cloud 66 - Pain Free Rails Deployments Cloud 66 for Rails acts like your in-house DevOps team to build, deploy and maintain your Rails applications on any cloud or server. Get $100 Cloud 66 Free Credits with the code: RailsConf-19 ($100 Cloud 66 Free Credits, for the new user only, valid till 31st December 2019) Link to the website: https://cloud66.com/rails?utm_source=-&utm_medium=-&utm_campaign=RailsConf19 Link to sign up: https://app.cloud66.com/users/sign_in?utm_source=-&utm_medium=-&utm_campaign=RailsConf19 _______________________________________________________________________________________________ Our desire to use new tools and learn new technologies backfires when we don't take the time to fully understand them. In 2018, we migrated from a REST API to GraphQL. Patterns were introduced, copied, pasted, and one day we woke up with queries taking 6s and page load times less than 10s. Customers were complaining. How did we get here? In this talk, we will discuss why we chose GraphQL, show practical examples of the mistakes we made in our implementation, and demonstrate how we eliminated all N+1 queries. I'll answer the question, "if I knew then what I know now... Would I stick with a REST API?"
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 Eric Allen's talk at RailsConf 2019 titled "New HotN+1ness - Hard Lessons Migrating from REST to GraphQL," he delves into the complex journey of migrating an application from a REST API to GraphQL. Throughout the discussion, he highlights the challenges faced by developers when adopting new technologies without fully understanding their implications. Key points discussed include: - **Experience with Migration:** Allen shares his team’s experience of rebuilding the front-end with React while simultaneously transitioning to GraphQL, which resulted in significant performance issues such as a 0.82 Apdex score and response times of up to 10 seconds. - **Understanding N+1 Queries:** He explains the concept of N+1 queries, where querying a collection of records creates additional queries for related data, causing inefficiencies. - **Initial Mistakes:** Significant mistakes included assuming eager loading would work similarly in GraphQL as it did in REST, leading to performance degradation. - **Solutions Implemented:** Allen presents steps to resolve issues, such as removing eager loading for resolvers, using batch loaders from Shopify’s GraphQL batch to combine queries, and being cautious about delegation to avoid hidden queries. - **Lessons Learned:** - Eager loading and method delegation often do not behave as expected in GraphQL. - Service objects and decorators need to explicitly preload data to prevent additional queries. - **Comparative Analysis of APIs:** He discusses the advantages of GraphQL in terms of flexibility and automatic documentation versus the challenges faced, such as losing confidence temporarily and managing error responses since GraphQL only returns 200 HTTP status codes. - **Reflections on Decisions:** Allen summarizes that while GraphQL provides flexibility and reduces API maintenance burdens, it also requires careful consideration of decisions made amidst uncertainty, emphasizing the importance of embracing mistakes and fostering a supportive team culture. In conclusion, Allen reflects positively on their decision to adopt GraphQL, stating that while they would approach some things differently in hindsight, the overall benefits align with their application's needs, especially for multiple clients demanding diverse data requirements.
Suggest modifications
Cancel