# Wrong cpu count in lxd environment

**URL:** <https://travis-ci.community/t/wrong-cpu-count-in-lxd-environment/11668>\
**Category:** Multi CPU Architecture\
**Tags:** build-env\
**Created:** [June 2, 2021, 5:27am UTC](https://travis-ci.community/t/wrong-cpu-count-in-lxd-environment/11668 "2021-06-02T05:27:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Siddhesh-Ghadi](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/siddhesh-ghadi/32/7962_2.png) [@Siddhesh-Ghadi](https://travis-ci.community/u/Siddhesh-Ghadi)\
**Post date:** [June 2, 2021, 5:27am UTC](https://travis-ci.community/t/wrong-cpu-count-in-lxd-environment/11668/1 "2021-06-02T05:27:08Z")

</div>

According to [reference docs](https://docs.travis-ci.com/user/reference/overview/#lxd-container), each container is provided with `2 vCpus`. However when we run `nproc` or any other command to get cpu count, it is greater than 2.

Below are cpu counts displayed by `nproc`:

> [Travis CI - Test and Deploy with Confidence](https://travis-ci.com/github/Siddhesh-Ghadi/travis-cpu/builds/227695094)

```auto
s390x: 4
ppc64le: 8
arm64: 32

```

This leads to `OOM kill` for nodejs build & test tools which by default depend on cpu counts for parallel threads.

Example:

> [Travis CI - Test and Deploy with Confidence](https://travis-ci.com/github/Siddhesh-Ghadi/che-theia/builds/227695406)

`che-thiea` builds: here `arm` & `ppc` builds fail with `OOM kill`. The build uses `lerna` & `jest` tools which by default creates concurrent threads equal to number of `cpus` and there is no easy way to limit it.

**Note:** Most of nodejs build & test tools depend upon nodejs’s `os` library to get cpu counts which internally reads this information from `procfs`.

> [Not correct os.cpus().length inside the docker container with cpus limited. · Issue #28762 · nodejs/node · GitHub](https://github.com/nodejs/node/issues/28762)
