twitter + graphql-java #2591
Replies: 9 comments 11 replies
-
@jbellenger |
Beta Was this translation helpful? Give feedback.
-
hey @jbellenger ... thanks a lot for this public and very positive feedback. very happy to have Twitter onboard 😄 |
Beta Was this translation helpful? Give feedback.
-
I would love to get more insight on the business case for 50,000 bits of data being needed in one call. graphql systems often do best when you ask for what you need and no more - and hence avoid under fetching and over fetching. Can you explain why 50K bits of data is useful? (not saying its not useful - just trying to get insight into this) |
Beta Was this translation helpful? Give feedback.
-
@jbellenger Does your team use persisted queries? |
Beta Was this translation helpful? Give feedback.
-
Hey @jbellenger, Thank you for the insight! With those complex queries I was just wondering what latencies are you guys experiencing on average and worst cases (p99.+). Can you share those details? Mostly curiosity since they're somewhat subjetive due to a number of factors. |
Beta Was this translation helpful? Give feedback.
-
Hi @jbellenger Thanks for the intro and cool to read some of the Twitter insights. What was the reason to choosing for this setup over a federated setup? It sounds like you created a unique system on top of graphql-java, do you have any plans to open source this? E.g. graphql schema generator and execution system. |
Beta Was this translation helpful? Give feedback.
-
Hi @jbellenger Thank you for a very interesting discussion(っ^▿^)<3 How do you store persisted queries? Do you have only pre-registered queries or do allow clients to register new queries if queries are unknown to the server? |
Beta Was this translation helpful? Give feedback.
-
@jbellenger as far as I know Twitter is developing using scala, does it means you have developed a thin scala wrapper around of graphql-java? If yes, do you think it would be possible to open source this? |
Beta Was this translation helpful? Give feedback.
-
A little data point on how Twitter has already helped the graphql-java community We just did some HotSpot analysis of our Atlassian Graphql Gateway and we found that for certain large queries the RulesVisior code was a hotspot of object allocation and also time spent.
and the we remembered ... didn't Twiitter fix that? We upgraded internally to a daily version and... hey presto... this fell out of our hotspots! Thanks Twitter |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi team! Twitter is wrapping up its migration to graphql-java and I wanted to share some info about how we use graphql and why we chose to migrate our system to graphql-java.
Some background on how we use graphql: we use one unified schema to serve data to first-party twitter clients and to power our rest api. The schema defines the entirety of our api data model and includes roughly 1000 object types, 100 input types, and 300 mutation fields. The schema itself grows daily as several hundred developers across the company add fields and types to the schema to support their projects.
Our graphql api serves around 500k requests per second, and the nature of our api is that some of our largest and most complex queries have the highest request rate. For example, one of our most frequently-executed queries is 2500 lines long and returns 50k fields per request. That's a lot of fields!
While we've been operating this graphql system for a couple of years, we encountered some performance issues last spring when we regularly started serving requests that returned 20k+ fields. We found that our graphql implementation was instantiating a large number of intermediate objects during execution, creating significant memory pressure and destabilizing our service when under heavy load.
For comparison we ran some execution benchmarks against other graphql implementations and were surprised at graphql-java's performance properties. For some of our most complex queries, graphql-java had 3x the throughput of our current graphql implementation, as well as predictable memory performance that made it stable under high load, allowing us to make more efficient use of our hardware.
It took 8 engineers 6 months to port our graphql schema generator and execution system to graphql-java. As of last week, we're serving all of twitter's graphql query operations on graphql-java and we're already seeing great results, including a 35% reduction in overall cpu utiization and a 25% reduction in GC time. And these gains are within a totally untuned system; we expect to realize more gains after we finish our migration and can focus on fine tuning.
Our team is excited about the performance improvements, but we are even more excited about participating in the healthy developer community that surrounds this project. We look forward to contributing patches back to graphql-java and finding other ways to be useful.
Much love,
The Twitter Core API Platform team
@arshij @chriswr95 @folone @haggaikaunda @jbellenger @schenkman
Beta Was this translation helpful? Give feedback.
All reactions