# Node capacity sizing for 100+M vertices

**URL:** <https://discuss.dgraph.io/t/node-capacity-sizing-for-100-m-vertices/6105>\
**Category:** Dgraph\
**Created:** [March 9, 2020, 7:34pm UTC](https://discuss.dgraph.io/t/node-capacity-sizing-for-100-m-vertices/6105 "2020-03-09T19:34:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vitorhirota](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/vitorhirota/32/2525_2.png) [@vitorhirota](https://discuss.dgraph.io/u/vitorhirota)\
**Post date:** [March 9, 2020, 7:34pm UTC](https://discuss.dgraph.io/t/node-capacity-sizing-for-100-m-vertices/6105/1 "2020-03-09T19:34:31Z")

</div>

I’m playing around a cluster of two 8 core 32Gb RAM machines with 1 zero in machine A and 2 alphas (one in each machine with 9GB LRU). This is over version 1.2.1.

Prepared 1B edges on bulk loader with shard=2 with a schema fragment like this:

```auto
type A {
   a: string @index(hash) .
   link: [uid] @reverse
}

type B {
   b: string @index(hash) .
}

```

Where A has 55M nodes, and B has 60M nodes.

When issuing a simple query to count nodes per type, everything goes swell.

The query below takes 10min, issuing through a HTTP client (such as Postman) with a `timeout=600s` querystring argument:

```auto
{
  var(func: type(A)) {
    cnt as count(link)
  }
  
  a(func: type(A), orderdesc: val(cnt), first: 5) {
    uid
  }
}

```

If I add `val(cnt)`, it fails with an empty response, even increasing the timeout argument.  
As far as I can see in the logs, the alpha with the link predicate, looses connection to zero and immediately reconnects.

What can I do to get this query working? Is this lack of hardware, or just a configuration I’m missing?

---

<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:** [March 9, 2020, 8:34pm UTC](https://discuss.dgraph.io/t/node-capacity-sizing-for-100-m-vertices/6105/2 "2020-03-09T20:34:12Z")

</div>

Try to “bind” the query blocks. e.g.

```auto
{
  Ca as var(func: type(A)) {
    cnt as count(link)
  }
  
  a(func: uid(Ca), orderdesc: val(cnt), first: 5) {
    uid
  }
}

```

Example using the movie dataset we have in [play dgraph](https://play.dgraph.io/)

```auto
{
  # A as var(func: has(<director.film>)) {
  # C as count(director.film)
  # }
    
 A as var(func: gt(count(director.film), 1)) {
   C as count(director.film)
 }
  
  q(func: uid(A), orderdesc: val(C) , first:10) {
    uid
    name@.
     count(director.film)
  }
}

```

---

<div class="post-metadata">

**Author:** ![vitorhirota](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/vitorhirota/32/2525_2.png) [@vitorhirota](https://discuss.dgraph.io/u/vitorhirota)\
**Post date:** [March 11, 2020, 9:23pm UTC](https://discuss.dgraph.io/t/node-capacity-sizing-for-100-m-vertices/6105/3 "2020-03-11T21:23:35Z")

</div>

Great tip @MichelDiz, thank you very much. My error was missing the count index. Now query runs in under 2min.
