TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Absinthe – GraphQL implementation for Elixir

177 点作者 BafS超过 7 年前

8 条评论

benwilson-512超过 7 年前
The Github page may not be of much interest unless you&#x27;re trying to get started, so let me say a couple words about our subscription implementation that&#x27;s in the 1.4 release candidate.<p>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:<p><pre><code> subscription { orderPlaced { id customer { id tableNumber } } } </code></pre> When an order is placed you can publish an event to this subscription field either manually, or setup pubsub relationships in the schema itself.<p>Here&#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&#x27;re going to end up with 100 individual database lookups for the same customer.<p>De-duping documents can help; if the documents are identical and the context you&#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&#x27;t really do that, each document needs to be executed individually within the context of whoever submitted it.<p>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.<p>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&#x27;s really been a fantastic platform to build this on.
pcmonk超过 7 年前
We&#x27;re in the final stretch of migrating our old node&#x2F;mongo&#x2F;REST stack to elixir&#x2F;postgres&#x2F;graphql (with Absinthe), and I&#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&#x2F;experimental features like absinthe_phoenix and absinthe_ecto have been virtually flawless.<p>I guess the real test will be when we deploy it to production on Tuesday!
评论 #15573955 未加载
ShaneWilton超过 7 年前
DailyDrip has a really great, free episode on using Absinthe to make GraphQL servers: <a href="https:&#x2F;&#x2F;www.dailydrip.com&#x2F;topics&#x2F;elixirsips&#x2F;drips&#x2F;graphql-with-absinthe" rel="nofollow">https:&#x2F;&#x2F;www.dailydrip.com&#x2F;topics&#x2F;elixirsips&#x2F;drips&#x2F;graphql-wi...</a><p>In general, DailyDrip has some of the highest quality educational material I&#x27;ve found for Elixir (and a few other technologies).
benwilson-512超过 7 年前
Hey folks! I’m one of the Absinthe co authors, happy to answer any questions!<p>We’re hoping to get the 1.4 release out soon, it’s was delayed a bit to make sure some features were in place for the book. For now though the 1.4.0–rc is available and we’ve been using it in production.
评论 #15573909 未加载
评论 #15573559 未加载
评论 #15574858 未加载
Arubis超过 7 年前
I&#x27;m super excited to dig into <a href="https:&#x2F;&#x2F;pragprog.com&#x2F;book&#x2F;wwgraphql&#x2F;craft-graphql-apis-in-elixir-with-absinthe" rel="nofollow">https:&#x2F;&#x2F;pragprog.com&#x2F;book&#x2F;wwgraphql&#x2F;craft-graphql-apis-in-el...</a> once I get through my current book queue!
mrskitch超过 7 年前
Congrats brwcodes and team. I’d love to host you at GraphQLPDX again and do deeper dive into the library. We’ve missed you!
评论 #15576200 未加载
AzzieElbab超过 7 年前
Subscriptions?
评论 #15573540 未加载
评论 #15573495 未加载
senatorobama超过 7 年前
Why is the name of this project so obnoxious
评论 #15575024 未加载