# Why mallocgc wasted a lot of time

**URL:** <https://discuss.dgraph.io/t/why-mallocgc-wasted-a-lot-of-time/9102>\
**Category:** Dgraph\
**Tags:** dgraph\
**Created:** [July 29, 2020, 4:30pm UTC](https://discuss.dgraph.io/t/why-mallocgc-wasted-a-lot-of-time/9102 "2020-07-29T16:30:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xxm404](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/xxm404/32/4182_2.png) [@xxm404](https://discuss.dgraph.io/u/xxm404)\
**Post date:** [July 29, 2020, 4:30pm UTC](https://discuss.dgraph.io/t/why-mallocgc-wasted-a-lot-of-time/9102/1 "2020-07-29T16:30:06Z")

</div>

![image](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/a/ab6b97b7199c006d9be55f3ccd921fa576927a8c.png)  
why mallocgc wasted a lot of time，my alpha deploy at AWS m5.large instance(2vcpu & 8GB)，my alpha config like this

```auto
idx: 1
lru_mb: 2800
my: 172.30.22.204:7087
zero: 172.30.23.193:5086
port_offset: 7
postings: /home/work/dgraph_alpha/data/server/p1
wal: /home/work/dgraph_alpha/data/server/w1

```

---

<div class="post-metadata">

**Author:** ![mrjn](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/mrjn/32/775_2.png) [@mrjn](https://discuss.dgraph.io/u/mrjn)\
**Post date:** [July 30, 2020, 6:52am UTC](https://discuss.dgraph.io/t/why-mallocgc-wasted-a-lot-of-time/9102/2 "2020-07-30T06:52:26Z")

</div>

It is allocating memory for the posting list unmarshal.

---

<div class="post-metadata">

**Author:** ![xxm404](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/xxm404/32/4182_2.png) [@xxm404](https://discuss.dgraph.io/u/xxm404)\
**Post date:** [July 30, 2020, 10:30am UTC](https://discuss.dgraph.io/t/why-mallocgc-wasted-a-lot-of-time/9102/3 "2020-07-30T10:30:26Z")

</div>

Is that correct？I`m doinig a benchmark for Dgraph, my cluster consists of 3_alpha and 3_zero, alpha deploy in AWS m5.large instance, zero deploy in AWS t3.medium instance, my test request include 1 query and 2 mutate. My cluster just have 40qps throughput, benchmark result like this

```auto
1. wrk parameters： wrk2 -t5 -c20 -R40 -d2m

  Thread Stats Avg Stdev Max +/- Stdev
    Latency 363.30ms 196.14ms 1.43s 73.15%
    Req/Sec 19.42 4.29 31.00 77.21%
  Latency Distribution (HdrHistogram - Recorded Latency)
 50.000% 329.73ms
 75.000% 453.38ms
 90.000% 606.21ms
 99.000% 1.06s 
 99.900% 1.24s 
 99.990% 1.44s 
 99.999% 1.44s 
100.000% 1.44s 
#[Mean = 363.302, StdDeviation = 196.141]
#[Max = 1434.624, Total count = 4384]
#[Buckets = 27, SubBuckets = 2048]
----------------------------------------------------------
  4785 requests in 2.00m, 1.38MB read
Requests/sec: 39.86
Transfer/sec: 11.79KB

alpha cpu %48 iops 366
zero cpu %34 iops 244

2. wrk parameters： wrk2 -t5 -c40 -R80 -d2m
50.000% 973.82ms
 75.000% 1.11s 
 90.000% 1.26s 
 99.000% 1.54s 
 99.900% 1.70s 
 99.990% 1.85s 
 99.999% 1.85s 
100.000% 1.85s 
#[Mean = 978.974, StdDeviation = 217.198]
#[Max = 1853.440, Total count = 4508]
#[Buckets = 27, SubBuckets = 2048]
----------------------------------------------------------
  4973 requests in 2.00m, 1.44MB read
Requests/sec: 41.42
Transfer/sec: 12.26KB
alpha cpu 46% iops 277
zero cpu 46% iops 156

```
