# Mutation Performance！

**URL:** <https://discuss.dgraph.io/t/mutation-performance/18507>\
**Category:** Dgraph Clients\
**Tags:** dgraph4j, client\
**Created:** [April 18, 2023, 6:19am UTC](https://discuss.dgraph.io/t/mutation-performance/18507 "2023-04-18T06:19:00Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhaojiangkun](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/zhaojiangkun/32/10393_2.png) [@zhaojiangkun](https://discuss.dgraph.io/u/zhaojiangkun)\
**Post date:** [April 18, 2023, 6:19am UTC](https://discuss.dgraph.io/t/mutation-performance/18507/1 "2023-04-18T06:19:01Z")

</div>

I wonder if there is a performance bottleneck about mutation with dgraph4j。  
And in dgraph4j，the batch mutation is different from “dgraph bulk" or “graph live”?

---

<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:** [April 18, 2023, 6:22am UTC](https://discuss.dgraph.io/t/mutation-performance/18507/2 "2023-04-18T06:22:10Z")

</div>

> [@zhaojiangkun](#):
>
> dgraph4j。  
> And in dgraph4j

I think you have a typo there. dgraph4j vs dgraph4j??

> [@zhaojiangkun](#):
>
> the batch mutation is different from “dgraph bulk" or “graph live”?

They use Dgo. They may do some different methods. But in general are are 90% close in terms of approaches.

---

<div class="post-metadata">

**Author:** ![zhaojiangkun](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/zhaojiangkun/32/10393_2.png) [@zhaojiangkun](https://discuss.dgraph.io/u/zhaojiangkun)\
**Post date:** [April 18, 2023, 6:29am UTC](https://discuss.dgraph.io/t/mutation-performance/18507/3 "2023-04-18T06:29:42Z")

</div>

I’m sorry about that. Then is there a size limit about JSON？

```auto
            DgraphProto.Mutation build = DgraphProto.Mutation.newBuilder().setSetJson(ByteString.copyFromUtf8(json.toString())).build();

```

---

<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:** [April 18, 2023, 10:54pm UTC](https://discuss.dgraph.io/t/mutation-performance/18507/4 "2023-04-18T22:54:30Z")

</div>

Hum, I’m not sure about the case. In general(I’m not a Java Dev) JSON’s limit in Java should be the available memory. The best to do in any language is to break any data into chunks and manage the insertion.

Liveloader and Bulkloader has their own algo to do this. Bulk is faster cuz it is converting the data into RAW badger data. And liveloader breaks the data into small chunks and send them in small batches on each transaction.

You should never try to push big chunks of data into a server without knowing if any parts can handle the load. Test first and later check what you can do.

1. Check if your client can handle big JSON.
2. Check if your cluster has enough resources available.
3. Using compression to send the data can help.

---

<div class="post-metadata">

**Author:** ![zhaojiangkun](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/zhaojiangkun/32/10393_2.png) [@zhaojiangkun](https://discuss.dgraph.io/u/zhaojiangkun)\
**Post date:** [April 19, 2023, 2:10am UTC](https://discuss.dgraph.io/t/mutation-performance/18507/5 "2023-04-19T02:10:10Z")

</div>

Thanks！

---

<div class="post-metadata">

**Author:** ![zhaojiangkun](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/zhaojiangkun/32/10393_2.png) [@zhaojiangkun](https://discuss.dgraph.io/u/zhaojiangkun)\
**Post date:** [April 19, 2023, 2:17am UTC](https://discuss.dgraph.io/t/mutation-performance/18507/6 "2023-04-19T02:17:38Z")

</div>

Graph live loader only supports file（\*rdf.gz or \*.json.gz) ? About json string?

---

<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:** [April 19, 2023, 2:48pm UTC](https://discuss.dgraph.io/t/mutation-performance/18507/7 "2023-04-19T14:48:51Z")

</div>

Not sure what you mean by JSON String.  
Live or bulk accepts JSON. You can send RDF, JSON Gzipped or not.

---

<div class="post-metadata">

**Author:** ![zhaojiangkun](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/zhaojiangkun/32/10393_2.png) [@zhaojiangkun](https://discuss.dgraph.io/u/zhaojiangkun)\
**Post date:** [April 20, 2023, 3:29am UTC](https://discuss.dgraph.io/t/mutation-performance/18507/8 "2023-04-20T03:29:54Z")

</div>

I am performing mutations through dgraph4j，I wonder know how many the performance threshold of JSON。How many predicates can I use in json string？

 ![截屏2023-04-20 11.24.31](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/7/7c2f113401162e09d302318d3c57f675af1dea4a.png)

```auto
[
    {},
	{},
    .
    . "how many?"
    .
	{}
]

```

---

<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:** [April 21, 2023, 2:01am UTC](https://discuss.dgraph.io/t/mutation-performance/18507/9 "2023-04-21T02:01:19Z")

</div>

Sorry, but I can’t help you with that and currently we don’t have Java devs to do some profiling with this.

For sure Java has some IDE or tool that can profile the RAM usage.

---

<div class="post-metadata">

**Author:** ![zhaojiangkun](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/zhaojiangkun/32/10393_2.png) [@zhaojiangkun](https://discuss.dgraph.io/u/zhaojiangkun)\
**Post date:** [April 21, 2023, 2:06am UTC](https://discuss.dgraph.io/t/mutation-performance/18507/10 "2023-04-21T02:06:00Z")

</div>

Ok, thanks!
