Slash GraphQL support in dgraph-js

Hi there!.

We recently deployed a demo of our platform, using Slash as the Dgraph host. We managed to successfully connect our server to the remote DB hosted in Slash.

We use Typescript and dgraph-js to manage all our backend operations. However, we didn’t find any release available to support Slash connections in dgraph-js, since the last release was made in April:

This forced us to dig a little bit more and find out that a very recent commit in the “quickstart example of using dgraph-js simple”:

Had changes that enable the support of the Slash connection using typescript in dgraph-js. Since there is not yet a release for this feature, we only implemented the code in our backend, and it worked.

Until we started having some occasional glitches:

  • “Transaction has been aborted. Please retry.”
  • Error while dialing dial tcp: lookup dgraph-alpha-service on 172.20.0.10:53: no such host.

We would love to know if this is something to do with our Slash connection implementation, or it is something else rather than the Slash connection, maybe some bad previous implementation that might be affecting our performance.

Thanks a lot in advance for the feedback.

EDIT:

Also, I would like to say that requests take longer than expected, if we compare the times taken by a request done with Slash and a request done in a local environment, there is a lot of difference in the performance.

1 Like

@gja, @paulftw ^

Thanks for the report. We’ll take a look. Does the

Does these things happen after a long period of inactivity? We do have some warmup when your backend was not used for > 4 hours (though it should ideally never fail).

And where are you hitting the endpoint from? The latency could be high if there is a large distance between you and the backend.

Also, could you DM me your endpoint? I’ll do a quick check to see if you’ve been ratelimited due to being out of credits or something.

This was released on npm about 10 days ago: dgraph-js - npm.

Hi @gja. We migrated from Lambda to an Amazon EC2, things seem to go better and without errors. But we are still testing. And thanks a lot for the clarification about the release.

Sure thing, I’ll DM you our endpoint.

1 Like

Great!

Yeah, you’ll have to treat gRPC on AWS lambda with a lot of caution, and I’m surprised it even worked at times.

Since AWS lambda functions are not guaranteed to resume on the same machine, persistent connections like gRPC connections will keep getting dropped between function invocations. It should work if you create the dgraph client within the body of the main function, and not share it across functions.

Tejas

1 Like