LRU memory in Alpha server by default set to a negative value in MacOS

Moved from GitHub dgraph/4737

Posted by prashant-shahi:

What version of Dgraph are you using?

Dgraph version   : v1.2.0
Dgraph SHA-256   : ff6a20cdd76a03a37f916b039b82bf0120b1d8ffb89edba90cecbac0652cc207
Commit SHA-1     : 24b4b7439
Commit timestamp : 2020-01-27 15:53:31 -0800
Branch           : HEAD
Go version       : go1.13.5

What is the hardware spec (RAM, OS)?

MacOS Catlina version 10.15.2
Memory: 8 GB 1600 MHz DDR3

Steps to reproduce the issue (command/config used to run Dgraph).

curl -sSf | bash
$ /usr/local/bin/dgraph alpha
[Decoder]: Using assembly version of decoder

2020/02/06 02:04:39 LRU memory (--lru_mb) must be at least 1024 MB. Currently set to: -1.000000

For more information on --lru_mb please read

Expected behaviour and actual result.

Expected to bring up the Alpha server by setting LRU memory to 25% of the total memory as it is done in Linux.

MichelDiz commented :

This must be some characteristic of mac OS. As the --lru_mb isn’t defined at all by the binary or anything.

animesh2049 commented :

I think this is expected behavior, does it cause any problem on macOS? @prashant-shahi

prashant-shahi commented :

@animesh2049 It doesn’t work with the default settings on macOS as it does on Linux.
But yeah, it works when I manually set --lru_mb.

I also have a same issue

Something curious is happening. I don’t use Docker natively on my macOS. However, I am not able to reproduce this problem using binaries or a VM. The user (@zhouqiang-cl) reports that it happened to him using Docker with k8s enabled.

I tested using binaries locally, changing Shells. And all tests I managed to run without needing the flag. Apparently this problem was not supposed to be happening. Perhaps it is something related to permission. The docker instance may not have permissions to request values on the OS or machine.

Maybe, Dgraph should have a default value when it is unable to infer the values it needs (such as RAM size).

JFYI - I ran into this on GKE, Master version 1.16, Container-Optimized OS, using the dgraph-single.yaml quickstart. Manfested as crashloop for alpha container.

Setting lru_mb worked around the problem:

dgraph alpha --my=$(hostname -f):7080 --zero dgraph-0.dgraph.${POD_NAMESPACE}.svc.cluster.local:5080 --lru_mb=1024
1 Like

keep in mind that this will change to --cache_mb

1 Like

It looks like the flag is now --cache size-mb=1024 (in v21.03.0, at least). Btw, I think this would be worth adding to the, assuming what I typed is correct.

Thanks. Pinging @docs @hardik

BTW, @dpk even these small things feel free to open an issue. So we can easily add to the Jira’s backlog.

A complete list of the flag-related changes in v21.03 can be found here:

You’ll also find the mapping between the old flags and the new super-flags.