# Queries are slow using the javaAPI

**URL:** <https://discuss.dgraph.io/t/queries-are-slow-using-the-javaapi/3223>\
**Category:** Users\
**Created:** [September 14, 2018, 2:52am UTC](https://discuss.dgraph.io/t/queries-are-slow-using-the-javaapi/3223 "2018-09-14T02:52:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lvzhihong](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/lvzhihong/32/1239_2.png) [@lvzhihong](https://discuss.dgraph.io/u/lvzhihong)\
**Post date:** [September 14, 2018, 2:52am UTC](https://discuss.dgraph.io/t/queries-are-slow-using-the-javaapi/3223/1 "2018-09-14T02:52:55Z")

</div>

The javaAPI query is slow, but the visual page query is quick。 It takes more than 1w milliseconds to use the API。 Only 15ms is required on the page。Anybody know why? thank you

---

<div class="post-metadata">

**Author:** ![avi.jain7143](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/avi.jain7143/32/1227_2.png) [@avi.jain7143](https://discuss.dgraph.io/u/avi.jain7143)\
**Post date:** [September 14, 2018, 6:33am UTC](https://discuss.dgraph.io/t/queries-are-slow-using-the-javaapi/3223/2 "2018-09-14T06:33:41Z")

</div>

Similar problem i am facing.

> [@Poor performance of Dgraph for Sample case ? Check if implementation is wrong?](http://discuss.hypermode.com/t/poor-performance-of-dgraph-for-sample-case-check-if-implementation-is-wrong/3210):
>
> Looks Like getting and creating 50k nodes, not achievable in 1 sec with latest dgraph java. Windows 16 GB RAM and Dgraph version v1.0.8 Server config Sample JAVA code to reproduce Results Writes :- 50k nodes in batch Took 15.16 mins 50k nodes one by one Took 72sec Reads :- Getting 1 lac nodes one by one Took 2.17 mins Help me with JAVA implementation to crack this in mili seconds, i may be implementing in wrong way.

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [September 14, 2018, 3:34pm UTC](https://discuss.dgraph.io/t/queries-are-slow-using-the-javaapi/3223/3 "2018-09-14T15:34:56Z")

</div>

@deepak can you check this?

---

<div class="post-metadata">

**Author:** ![deepak](https://avatars.discourse-cdn.com/v4/letter/d/7bcc69/32.png) [@deepak](https://discuss.dgraph.io/u/deepak)\
**Post date:** [September 24, 2018, 1:02pm UTC](https://discuss.dgraph.io/t/queries-are-slow-using-the-javaapi/3223/4 "2018-09-24T13:02:56Z")

</div>

Ratel (the visual UI) is written using the Go client. dgraph4j (the java client) uses some external libraries to handle client server interaction using grpc. It is possible that there is some bottleneck there, that might be alleviated by tweaking some settings.

I will try and write some code similar to the example that @avi.jain7143 posted using the Go client and run some comparisions, and then debug further.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/2/2b38fdece2abe5814f2e51bee69d1e67fc304b0a.png) [@system](https://discuss.dgraph.io/u/system)\
**Post date:** [October 24, 2018, 1:03pm UTC](https://discuss.dgraph.io/t/queries-are-slow-using-the-javaapi/3223/5 "2018-10-24T13:03:00Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
