Monday, February 18, 2019



What is GraphQL

It is a specification laid out by Facebook which proposed an alternative way to query and modify data. Think of it is an as a complimentary of REST/RPC.

Now head here and read the original graphQL documentation. It will take 2-3 hours tops but is a worthy read. This will help you build some impressions on it and help contrast against mine below:

Why use GraphQL

Core advantage

  • Instead of defining custom backend rpc/rest endpoints for every data-shape, graphql allows you to build a more general endpoint which give frontend/mobile engineers freedom and query and play with the data. It might be less efficient, add a bit more complexity (need for things like data-loader), harder to standardize and control client-contracts for. What it looses in complexity and control, it gains in flexibility and freedom - provided your data model is worth of a graphql-ish query
  •  How to tell if my data-model graphql-ish?
    • Are there complex relationships between your models? Is there a need for client to traverse multiple relationships in a single call?

      For eg, if you are yelp, think about the following queries you might need:
      • get the reviews left by all the folks who live in my town
      • get the top 3 rated reviewers from the places that I've reviewed recently
    • In a traditional world, these would need 2 separate backend endpoints. With GraphQL on the server side, you can implement a schema that abstract your business-domain and allows the client to interact (query/write) directly.
Other Advantages
  • The GraphIQL (ide for graphql) enables callers to play around, explore and just request what they need. The shape of the response matches the shape of the calls. This removes building special endpoints per use case.
  • Might be a natural way to query data models which resemble a graph
  • No versioning or anything (I feel this is also a con)

Now the downsides:
  • FB released just the GraphQL spec. The implementations are community driven. Reading reddits, seems like the docs may not be of the highest standards. 
    • Again, this might improve over time.
  • Opening up backends to unhealthy query patterns that might increase load on the system. Generally, if a feature requires an an bad-query (say multiple joins, costly queries, etc.) that gets factored into the cost  of the feature. But with GraphQL abstracting all this, it might be hard to capture this in planning stages. 
    • An opposing thought is that APIs should be client driven and clients know best what they want. Backends can monitor call patterns and optimize those expensive calls.
My overall impressions is that GraphQL is not a magic pill for all scenarios. It fits some use cases very well: if your model is heavy AND involves complex relationships AND clients are dynamic and want flexibility in how the query this data - then GraphQL might be worth giving a try.


  • Hello-World GraphQL Client/Server in Go - link

Backend - Tech refresher 2019

Hello there

As a software engineer, it is important to keep updating your skillsets by learning the latest programming-elements (includes paradigms, patterns, languages, tools and frameworks). This becomes a bit easy if you already working on the cutting edge of something. Even then, it is possible to go too deep and loose breadth.

I've taken upon myself to do a tech refresher every year. The intent is to read, experiment and understand these elements by spending anywhere between 4 days to 4 weeks. The ultimate goal is: "do I know most that I need to know to build a planet-scale backend tech-stack ground up"

I'll write up my learnings in posts to help myself (and maybe others) refer it.

Here is the initial list I'm thinking about:

  • Redis
  • MySQL, GraphQL
  • Aurora, Mesos, Kubernetes
  • Cadence, SWS
  • Cassandra, MangoDB, NoSQL, MySQL, Spanner, S<, DynDB
  • ELK
  • Flink, Storm, Samza, Spark
  • Hadoop HDFS, Yarn, MapReduce
  • Hive, HBase
  • Kafka, Zookeeper
  • NW: http, Tcp, thrift, grpc, yarpc, 
  • Terraform, uCapacity
  • Vertica
  • Linux kernal

They are no particular order although there might be some meaning in their grouping.
I'll keep expanding / contracting this as we go ahead.


GraphQL What is GraphQL It is a specification laid out by Facebook which proposed an alternative way to query and modify data. Think o...