# Memory allocation strategies using ray.init

**URL:** <https://discuss.ray.io/t/memory-allocation-strategies-using-ray-init/306>\
**Category:** Ray Core\
**Created:** [December 21, 2020, 12:25pm UTC](https://discuss.ray.io/t/memory-allocation-strategies-using-ray-init/306 "2020-12-21T12:25:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![satishdash](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/satishdash/32/189_2.png) [@satishdash](https://discuss.ray.io/u/satishdash)\
**Post date:** [December 21, 2020, 12:25pm UTC](https://discuss.ray.io/t/memory-allocation-strategies-using-ray-init/306/1 "2020-12-21T12:25:41Z")

</div>

Hi,  
Just wanted recommendations on the memory related parameters in `ray.init` api. The service we’re building is an event based listener where the listener is spawned with indefinitely running workers using `ray.remote`.  
My question is:  
Given the service container running with 5GB of RAM. what are the considerations one would use for the memory related parameters like **\_memory, object\_store\_memory and redis\_max\_memory.**??  
The service is less CPU intensive but more IO intensive in terms of its functionality.

---

<div class="post-metadata">

**Author:** ![Alex](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/alex/32/341_2.png) [@Alex](https://discuss.ray.io/u/Alex)\
**Post date:** [December 22, 2020, 12:05am UTC](https://discuss.ray.io/t/memory-allocation-strategies-using-ray-init/306/2 "2020-12-22T00:05:45Z")

</div>

Ray automatically sets those parameters based on the amount of available RAM, though you’re free to change those parameters (it’s no clear that you need to though).

I think the only reason you would need to change any of the defaults is if you are running into OOM errors, or you know you’re trying to do some advanced out of core processing.

---

<div class="post-metadata">

**Author:** ![satishdash](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/satishdash/32/189_2.png) [@satishdash](https://discuss.ray.io/u/satishdash)\
**Post date:** [December 31, 2020, 7:19am UTC](https://discuss.ray.io/t/memory-allocation-strategies-using-ray-init/306/3 "2020-12-31T07:19:02Z")

</div>

Thanks @Alex for answering my query. Leaving everything to Ray figure out memory related values didn’t work well as `ray.init` continuously failed while running `pytests` in local macbook. hence, was wanting considerate values to set for proper initialization.

---

<div class="post-metadata">

**Author:** ![sangcho](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sangcho/32/425_2.png) [@sangcho](https://discuss.ray.io/u/sangcho)\
**Post date:** [January 4, 2021, 5:42pm UTC](https://discuss.ray.io/t/memory-allocation-strategies-using-ray-init/306/4 "2021-01-04T17:42:32Z")

</div>

^ Can you elaborate why it happens?

---

<div class="post-metadata">

**Author:** ![Alex](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/alex/32/341_2.png) [@Alex](https://discuss.ray.io/u/Alex)\
**Post date:** [January 4, 2021, 6:52pm UTC](https://discuss.ray.io/t/memory-allocation-strategies-using-ray-init/306/5 "2021-01-04T18:52:22Z")

</div>

btw @satishdash, it may also help to look at how Ray’s high level unit tests are configured [here](https://github.com/ray-project/ray/blob/master/python/ray/tests/conftest.py). Or look into using our [cluster utils](https://github.com/ray-project/ray/blob/master/python/ray/cluster_utils.py) for multi node unit tests.
