Dgraph GraphQL hits GA with v20.03.1

Dgraph is a distributed, transactional, open source, native graph database. It enables and simplifies the development of scalable cloud applications that continue to thrive even when the data is highly connected and involved. With this release, Dgraph now supports the official GraphQL spec, making it the first database which natively executes GraphQL.

Ever since the first production-ready, major release, v1.0.0 in December 2017, Dgraph development has been driven through feedback from the community and customers. After two years on this incredible journey, Dgraph’s second major release, v20.03.1, is here. This would not have been possible without the constant support and feedback from all of you and, for that, the entire Dgraph team says thank you!

This new release marks the general availability for Dgraph GraphQL, which is our biggest step towards simplifying GraphQL app development with Dgraph.

Instant GraphQL with Dgraph

Dgraph started with GraphQL back in 2015. See a talk by our founder about Dgraph’s journey with GraphQL in recent conference.


With v20.03.1 Dgraph GraphQL, our native support for GraphQL hits general availability. This release makes Dgraph the only database that natively interprets, distributes, stores, and executes GraphQL with no layering. In short, Dgraph is the only native GraphQL database in the market.

All you need to know to get started with Dgraph is GraphQL. This means no need to initiate the database, no schema mapping or layering; just compose your GraphQL schema containing types to represent the data requirements of your application, submit it to Dgraph HTTPS endpoint, and you are ready to build your app.

Dgraph takes those types and prepares graph storage for them and auto-generates a production-ready, scalable, CRUD APIs with GraphQL queries and mutations instantly. All of it in two steps, without having to write any server-side code or having to run your own GraphQL server.

Iterate with GraphQL

As your application data requirements evolve, update the GraphQL schema by modifying the data types, indices, and relationships. Dgraph interprets the changes to the schema and dynamically modifies GraphQL query and mutations.

Scale and Perform with GraphQL

Dgraph is a distributed GraphQL database - add more database servers on the fly to enhance compute, memory, or storage capacity and it scales seamlessly.

Dgraph natively interprets, stores, and executes GraphQL. It’s not an additional layer - it’s built-in. In other words, GraphQL is a first-class citizen for Dgraph.

Dgraph is built from the ground up to serve deep GraphQL queries and mutations efficiently. Don’t let the complexity of your application and query depth stop you from building the next big thing. Dgraph GraphQL gives unhindered read-write performance - no matter how complex your app may be.

Easy Integration: Full Access to the GraphQL Ecosystem

From community feedback, we learned that our users not only want the Dgraph experience and the query power, but also the integration into the GraphQL growing ecosystem, tooling, and development workflows. Dgraph GraphQL makes it happen. Fully compliant with the GraphQL spec, you can now use all your favorite GraphQL tools and libraries, like Apollo GraphQL, GraphiQL, and Postman with Dgraph. All you need to do is plug-in Dgraph with the rest of your GraphQL app development stack, and you’re good to go.

/admin endpoint is now GraphQL compatible

All of Dgraph’s database management operations - like backup, health check, and export - are now accessible as GraphQL. So, these operations can now be done via any GraphQL editor.

Dgraph has really embraced GraphQL ecosystem. And that’s not all. Expect many more exciting features - like auth, remote custom logic, and subscription in the upcoming Dgraph releases.

Configure Badger Compression Level

You can now set the degree of data compression for Badger while running the bulk loader by using the --badger.compression_level flag. A higher value saves you disk space at the cost of higher CPU utilization.

Enterprise features

Perform ACL Operations with GraphQL

ACL operations are now available via GraphQL APIs. This makes it easier to work with ACLs. While Ratel can still be used to operate on them, any GraphQL editor can now do the job of updating ACLs. You can learn more from our documentation here.

Introducing Ludicrous Mode

From community feedback, we realized that not all use cases prioritize the consistency guarantee and users oftentimes prefer more efficient data loading performance. To address this, we created the Ludicrous Mode. And yes, the feature name is inspired by the crazy fast mode from Tesla, because it significantly improves the performance of live data loading - it’s ludicrously fast.

Ludicrous mode is ideal for situations where you may have several GBs of data to load into Dgraph and your use case doesn’t require the strict consistency guarantees provided by default. Expect further enhancements for Ludicrous Mode in the upcoming patch release. Ludicrous mode is available with our v20.03.1 patch release.

Enhancements

Indexing in the Background

Previously, if a user reindexed a certain predicate, it would blocked queries and mutations until the indexing finished. In this release, the client libraries now have an option to instruct Dgraph to run indexing in the background without blocking queries or mutations.

Use the RunInBackground option in the Alter function of the Dgraph client libraries to configure background indexing. When set to true, the Alter function returns immediately and initiates indexing in the background.

Bulk Loader Performance

Bulk loader has been significantly improved to make the reduce phase run concurrently and consume much less memory. This makes the reduce phase significantly faster than before.

Incremental Rollups

Previously, rollups were initiated only during database snapshots. This led to scanning over the entire Badger DB to roll up a large number of keys, adding a lot of stress on the database. This also used to calculate the size of tablets.

With the introduction of incremental rollups, the rollups are triggered on a continuous basis, resulting in a smoother operation of the DB. Moreover, the shard size estimations are now done by using advanced features of Badger. With these changes, Dgraph now does not scan over Badger DB, conserving CPU significantly, particularly as the DB size grows.

If you’re curious about how rollups and snapshots work, read our paper on Dgraph architecture.

Badger Updated

Badger is an embedded key-value store that is responsible for storing all of Dgraph’s data. Updating Badger to a recent version brings in a plethora of enhancements at the storage layer.

  • Run compression and encryption concurrently, resulting in faster table creation.
  • Avoid stalling on levels 2 and beyond, resulting in faster compactions.
  • Bloom filters are now cached via Ristretto, resulting in a bounded memory usage.

Check out the pull request to learn more about the enhancements.

Breaking Changes

We have two breaking changes since the previous release. You should take a quick look to ensure this doesn’t affect your workflow.

Change in ACL schema (Enterprise)

The first breaking change arises from the changes introduced to the ACL schema.

Use the ACL upgrade tool to migrate to Dgraph 20.03.1 from the previous release v1.2.2. Here are the steps:

  1. Use binary backup to export data from the old cluster
  2. Shutdown Dgraph and wait for all writes to complete
  3. Download the Dgraph binary for v20.03.1
  4. Restore from the backups using upgraded Dgraph binary.
  5. Start a new Dgraph cluster using the restored data directories
  6. Upgrade ACL data using the following command: dgraph upgrade --acl -a localhost:9080 -u groot -p password

Lang Index

A bug fix resulted in a data format change that affects using the language index (@lang schema directive). Follow the steps from the documentation link here to upgrade the database to the new release.

Conclusion

This release marks the end of the Dgraph 1.x series and the beginning of Dgraph GraphQL. Starting from this milestone, Dgraph will also follow CalVer versioning as announced earlier.

With the emphasis on GraphQL, this has been the most exciting release of Dgraph. Dgraph community has long asked us to support official GraphQL spec. We are now fully committed to the GraphQL ecosystem. This release is a big step in that direction.

We are working hard to bring greater functionality and new features in the upcoming releases of Dgraph GraphQL. Read the Changelog to find out more about all the changes, bug fixes, and enhancements we packed into this major release.

Dgraph GraphQL is the result of the persistence of our wonderful community for full GraphQL spec compliance. You asked for it, and we delivered!

Give Dgraph GraphQL a try and let us know your thoughts.