Data science blogs

Data science blogs. O CEO da Neuromath, Deividi Pansera, disponibilizou uma curadoria com mais de 250 blogs focados em Data Science. Aproveitem..

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Efficient GraphQL resolvers for FaunaDB

GraphQL is an API specification that standardizes how clients request data from servers, It is rapidly becoming a popular way to specify the data that backend services should provide to front end clients. It is independent of any underlying data model, and is routinely used to query relational, document, and graph databases, as well as other backend microservices such as search and analytics. This article covers a GraphQL performance technique for FaunaDB, and the lessons might be useful no matter which database you use.

A GraphQL-based system decouples backend data layout from client requirements. This allows clients to specify the shape of data they are looking for, simplifying the process of creating new features. Instead of requesting a backend API change each time the front-end requires a new piece of data, the front end engineers can simply add the new field to the GraphQL query specification. If that field is already supported by the GraphQL resolver, then no changes are needed on the backend. Front end developers can add features and optimize the data they request, without making cumbersome change requests of backend API developers.

One consequence of this architecture is that the backend server must resolve the GraphQL query, converting it to requests for backend microservices. For instance an app client might request a blog post, it’s comments, and it’s commenter’s avatars. If the posts, comments, and avatars are all in different systems, GraphQL will issue requests in parallel when possible, and stitch the results back together. This hides the complexity of microservices from API users.

After the resolvers have parsed and combined it, a single query is issued to FaunaDB. It’s a little long to show here, but logically it is doing things like paginating over indexes of nodes and edges, and selecting the fields needed by GraphQL.

FaunaDB’s query language makes combining fragments easy, so GraphQL resolvers can compose queries programmatically. It’s only once the query reaches the top of the GraphQL tree that it needs to be sent to the database for processing. One query round trip is faster and easier to deal with.

Add a comment

Related posts:

Promoting Crypto Trading

A South Korean lawmaker has reportedly introduced a bill to promote cryptocurrency trading and the development of crypto exchanges. In addition to requirements such as capital, manpower, and internal…

Suka atau Duka Belajar di Binar Academy?

Perkenalkan nama saya Alam. Saya adalah mahasiswa semester 5 jurusan Teknik Informatika. Selama hampir 2 tahun saya belajar di bangku pendidikan tinggi saya sama sekali belum menemukan jawaban dari…

Install MySQL 8 in MacOS

Then you also need to remove / backup your my.cnf, since there’s few thing that the configuration is not used anymore, I received the following error. If you are using Sequel Pro as your MySQL…