GraphQL subscriptions not triggering accordingly

Hello everyone,
I got an issue related to the graphQL subscriptions, the issue occurs whenever I’m updating single/multiple nodes multiple times in a second (100 updates/second). The problem is that subscription doesn’t catch all updates/events related to the node that it is subscribed to.

I’ve deployed dGraph cluster on my laptop, the cluster is consisted of a single alpha & zero instance. Additionally, I’ve created two Python scripts, one is used to update the nodes, and the other one is used to subscribe to the dGraph and print out the changes.

For example, I’ve tried to update a value of a single node with range of values [1,2,3,…100] in a single second, and subscribe script catches approximately every 15-20 event, like [1, 17, 35, 50…]. When the time interval is increased to 1 update per second, subscription catches all the events.

Here is the schema:

type Sensor @withSubscription {
    id: ID!
    name: String! @id @search(by: [exact, regexp])
    value: Float @search
    timestamp: DateTime

Subscribe script:

from graphql_client import GraphQLClient

ws = GraphQLClient('ws://localhost:8080/graphql')
def callback(_id, data):
  print("got new data..")
  print(f"msg id: {_id}. data: {data}")

query = """
  subscription {
    getSensor(name: "temperatureSensor") {
sub_id = ws.subscribe(query, callback=callback)

What causes this kind of behavior? Is there some kind of limitation regarding the subscriptions related with node updates? According to this topic (Performance of GraphQL Subscriptions), subscription should preform as they are based on queries.

Is there any other approach to “catch event” whenever something gets updated in dGraph.

Thanks in advance!

Have you tried to reduce the poll interval?
–graphql_poll_interval duration

It is 1 second by default.

"graphql_poll_interval", time.Second, 
"polling interval for graphql subscription."


--graphql_poll_interval "0.10"

Thank you, @MichelDiz, for that valuable advice! I suggest that you add it to the documentation regarding subscriptions (

So just to clarify, does this flag instruct the Alpha instance to check for changes regarding the subscriptions every n seconds, or is it more like an “event trigger that listens continuously” and sends notifications when something happens?

Subscriptions are like “push notification”. And it checks the diff every 1 second by default and you can decrease the time. It’s not a trigger. It’s a routine and whoever has the websocket open will receive the package.

In theory it can acts like a trigger but what really triggers is your application. Dgraph only sends you the state change. e.g. Your application subscribes to a subscription. And wait for any change to do a chain shot/triggering.