<story><title>Absinthe – GraphQL implementation for Elixir</title><url>https://github.com/absinthe-graphql/absinthe</url></story><parent_chain></parent_chain><comment><author>benwilson-512</author><text>The Github page may not be of much interest unless you&amp;#x27;re trying to get started, so let me say a couple words about our subscription implementation that&amp;#x27;s in the 1.4 release candidate.&lt;p&gt;The idea with GraphQL subscriptions is that a client can submit a document that is run in response to an event on the server, which pushes the result of that document to the client. So if you had a UI showing new orders, you might have a subscription that looked like:&lt;p&gt;&lt;pre&gt;&lt;code&gt;  subscription {
    orderPlaced {
      id
      customer { id tableNumber }
    }
  }
&lt;/code&gt;&lt;/pre&gt;
When an order is placed you can publish an event to this subscription field either manually, or setup pubsub relationships in the schema itself.&lt;p&gt;Here&amp;#x27;s the challenge: Suppose loading the customer of an order requires a DB lookup. If you have 100 people who all submit that subscription, and you run each of those subscriptions independently, you&amp;#x27;re going to end up with 100 individual database lookups for the same customer.&lt;p&gt;De-duping documents can help; if the documents are identical and the context you&amp;#x27;re executing them in is identical, you can just execute it once and push the values out. The problem is if you have authentication or authorization rules in the document then you can&amp;#x27;t really do that, each document needs to be executed individually within the context of whoever submitted it.&lt;p&gt;One of the main features of our subscription implementation however is that the batch dataloading mechanisms we have to avoid N+1 queries within a single document can also work with sets of documents. When an order is placed we take the full set of documents triggered by that event and run them as a batch, so any redundant DB lookups can get coalesced into a single query.&lt;p&gt;Elixir itself has been a huge help here. We can achieve this batched document storage and execution without any external dependencies like Redis and, because we integrate easily with Phoenix PubSub (other backends possible) we get cluster support for free also without any external dependencies. Add in linear scaling with the number of CPUs and it&amp;#x27;s really been a fantastic platform to build this on.</text></comment>
<story><title>Absinthe – GraphQL implementation for Elixir</title><url>https://github.com/absinthe-graphql/absinthe</url></story><parent_chain></parent_chain><comment><author>pcmonk</author><text>We&amp;#x27;re in the final stretch of migrating our old node&amp;#x2F;mongo&amp;#x2F;REST stack to elixir&amp;#x2F;postgres&amp;#x2F;graphql (with Absinthe), and I&amp;#x27;m absolutely loving it so far. Elixir is a great language, and Absinthe is very easy to use, even for a graphql noob like me. Even new&amp;#x2F;experimental features like absinthe_phoenix and absinthe_ecto have been virtually flawless.&lt;p&gt;I guess the real test will be when we deploy it to production on Tuesday!</text></comment>