So say there are 5 nodes, with 8gb of RAM each. Do we have 40GB of RAM to store the key space in, or is it 8gb?
The answer isn't exactly either of the above options. I highly recommend you read the following documentation which will help you with your planning: http://docs.basho.com/riak/latest/ops/building/planning/bitcask/
In brief what this says is that you need to calculate your total estimated key size, multiply that by 3 (or you n val if it isn't 3) and then divide that by the total number of nodes in your cluster and multiply by 2. That is the recommended amount of RAM per node for the key space. Ideally your machines won't exceed 50 to 75% memory utilization because you need to account for the possibility of node failure and hand off.