# Suggested configuration to prevent OutOfMemoryError errors

**URL:** https://discuss.elastic.co/t/suggested-configuration-to-prevent-outofmemoryerror-errors/3249
**Category:** Elasticsearch
**Created:** [August 24, 2010, 4:04pm UTC](https://discuss.elastic.co/t/suggested-configuration-to-prevent-outofmemoryerror-errors/3249 "2010-08-24T16:04:03Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Richard\_Livsey](https://avatars.discourse-cdn.com/v4/letter/r/dc4da7/32.png) [@Richard\_Livsey](https://discuss.elastic.co/u/Richard_Livsey)
#### Post date: [August 24, 2010, 4:04pm UTC](https://discuss.elastic.co/t/suggested-configuration-to-prevent-outofmemoryerror-errors/3249/1 "2010-08-24T16:04:03Z")

</div>

Hi, I'm evaluating using ElasticSearch and just trying to get it up  
and running on my laptop (MacBook Pro running Snow Leopard) but keep  
running into java.lang.OutOfMemoryError errors.

I don't have much free RAM on this machine, what's the best way to  
configure ES to run in a low memory environment without dying?

I've set ES\_MAX\_MEM as 512m, and set the threadpool to "scaling" with  
the following settings:

"threadpool": {  
"type": "scaling",  
"scaling": {  
"min": 1,  
"max": 5,  
"scheduled\_size": 5  
}  
}

I'm only indexing a few hundred documents, some with files upto 20Mb  
to be indexed as attachments.

Prior to lowering ES\_MAX\_MEM, it wouldn't throw the exception but  
would freeze up as it GC'd:

[16:19:59,281][WARN][monitor.jvm] [Slapstick] Long GC  
collection occurred, took [16.1s], breached threshold [10s]  
[16:20:18,901][WARN][monitor.jvm] [Slapstick] Long GC  
collection occurred, took [17.6s], breached threshold [10s]  
[16:20:30,653][WARN][monitor.jvm] [Slapstick] Long GC  
collection occurred, took [10.9s], breached threshold [10s]

Thanks.

--  
Richard Livsey  
Minutebase - Online Meeting Minutes  
[http://minutebase.com](http://minutebase.com)  
[http://livsey.org](http://livsey.org)

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [August 24, 2010, 5:14pm UTC](https://discuss.elastic.co/t/suggested-configuration-to-prevent-outofmemoryerror-errors/3249/2 "2010-08-24T17:14:32Z")

</div>

How do you index the data? If you push perform indexing in an async manner,  
you should throttle it on the client side. In upcoming 0.10 I have improved  
the blocking thread pool which is the one that you would want to use in this  
case, but you might run into timeouts in this case.

-shay.banon

On Tue, Aug 24, 2010 at 7:04 PM, Richard Livsey [livsey@gmail.com](mailto:livsey@gmail.com) wrote:

> Hi, I'm evaluating using Elasticsearch and just trying to get it up  
> and running on my laptop (MacBook Pro running Snow Leopard) but keep  
> running into java.lang.OutOfMemoryError errors.
> 
> I don't have much free RAM on this machine, what's the best way to  
> configure ES to run in a low memory environment without dying?
> 
> I've set ES\_MAX\_MEM as 512m, and set the threadpool to "scaling" with  
> the following settings:
> 
> "threadpool": {  
> "type": "scaling",  
> "scaling": {  
> "min": 1,  
> "max": 5,  
> "scheduled\_size": 5  
> }  
> }
> 
> I'm only indexing a few hundred documents, some with files upto 20Mb  
> to be indexed as attachments.
> 
> Prior to lowering ES\_MAX\_MEM, it wouldn't throw the exception but  
> would freeze up as it GC'd:
> 
> [16:19:59,281][WARN][monitor.jvm] [Slapstick] Long GC  
> collection occurred, took [16.1s], breached threshold [10s]  
> [16:20:18,901][WARN][monitor.jvm] [Slapstick] Long GC  
> collection occurred, took [17.6s], breached threshold [10s]  
> [16:20:30,653][WARN][monitor.jvm] [Slapstick] Long GC  
> collection occurred, took [10.9s], breached threshold [10s]
> 
> Thanks.
> 
> --  
> Richard Livsey  
> Minutebase - Online Meeting Minutes  
> [http://minutebase.com](http://minutebase.com)  
> [http://livsey.org](http://livsey.org)

---

<div class="post-metadata">

### Author: ![Richard\_Livsey\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/richard_livsey_2/32/3241_2.png) [@Richard\_Livsey\_2](https://discuss.elastic.co/u/Richard_Livsey_2)
#### Post date: [August 24, 2010, 5:21pm UTC](https://discuss.elastic.co/t/suggested-configuration-to-prevent-outofmemoryerror-errors/3249/3 "2010-08-24T17:21:19Z")

</div>

At the moment it's just looping through and indexing via the REST API,  
which isn't async as it waits for timeouts (as far as I can tell).  
But makes sense that it might be overloading it, so I'll add some  
throttling and see how that goes.

Thanks.

On Tue, Aug 24, 2010 at 6:14 PM, Shay Banon  
[shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:

> How do you index the data? If you push perform indexing in an async manner,  
> you should throttle it on the client side. In upcoming 0.10 I have improved  
> the blocking thread pool which is the one that you would want to use in this  
> case, but you might run into timeouts in this case.  
> -shay.banon
> 
> On Tue, Aug 24, 2010 at 7:04 PM, Richard Livsey [livsey@gmail.com](mailto:livsey@gmail.com) wrote:
> 
> > Hi, I'm evaluating using Elasticsearch and just trying to get it up  
> > and running on my laptop (MacBook Pro running Snow Leopard) but keep  
> > running into java.lang.OutOfMemoryError errors.
> > 
> > I don't have much free RAM on this machine, what's the best way to  
> > configure ES to run in a low memory environment without dying?
> > 
> > I've set ES\_MAX\_MEM as 512m, and set the threadpool to "scaling" with  
> > the following settings:
> > 
> > "threadpool": {  
> > "type": "scaling",  
> > "scaling": {  
> > "min": 1,  
> > "max": 5,  
> > "scheduled\_size": 5  
> > }  
> > }
> > 
> > I'm only indexing a few hundred documents, some with files upto 20Mb  
> > to be indexed as attachments.
> > 
> > Prior to lowering ES\_MAX\_MEM, it wouldn't throw the exception but  
> > would freeze up as it GC'd:
> > 
> > [16:19:59,281][WARN][monitor.jvm] [Slapstick] Long GC  
> > collection occurred, took [16.1s], breached threshold [10s]  
> > [16:20:18,901][WARN][monitor.jvm] [Slapstick] Long GC  
> > collection occurred, took [17.6s], breached threshold [10s]  
> > [16:20:30,653][WARN][monitor.jvm] [Slapstick] Long GC  
> > collection occurred, took [10.9s], breached threshold [10s]
> > 
> > Thanks.

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [August 24, 2010, 5:45pm UTC](https://discuss.elastic.co/t/suggested-configuration-to-prevent-outofmemoryerror-errors/3249/4 "2010-08-24T17:45:16Z")

</div>

You are looping with a single thread and waiting for each index request? It  
should not require much memory in this case... . What do you use to index  
the data (I have a test with a single thread that indexed 1M docs with 128mb  
allocated and it works like a charm).

-shay.banon

On Tue, Aug 24, 2010 at 8:21 PM, Richard Livsey [richard@livsey.org](mailto:richard@livsey.org) wrote:

> At the moment it's just looping through and indexing via the REST API,  
> which isn't async as it waits for timeouts (as far as I can tell).  
> But makes sense that it might be overloading it, so I'll add some  
> throttling and see how that goes.
> 
> Thanks.
> 
> On Tue, Aug 24, 2010 at 6:14 PM, Shay Banon  
> [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> 
> > How do you index the data? If you push perform indexing in an async  
> > manner,  
> > you should throttle it on the client side. In upcoming 0.10 I have  
> > improved  
> > the blocking thread pool which is the one that you would want to use in  
> > this  
> > case, but you might run into timeouts in this case.  
> > -shay.banon
> > 
> > On Tue, Aug 24, 2010 at 7:04 PM, Richard Livsey [livsey@gmail.com](mailto:livsey@gmail.com)  
> > wrote:
> > 
> > > Hi, I'm evaluating using Elasticsearch and just trying to get it up  
> > > and running on my laptop (MacBook Pro running Snow Leopard) but keep  
> > > running into java.lang.OutOfMemoryError errors.
> > > 
> > > I don't have much free RAM on this machine, what's the best way to  
> > > configure ES to run in a low memory environment without dying?
> > > 
> > > I've set ES\_MAX\_MEM as 512m, and set the threadpool to "scaling" with  
> > > the following settings:
> > > 
> > > "threadpool": {  
> > > "type": "scaling",  
> > > "scaling": {  
> > > "min": 1,  
> > > "max": 5,  
> > > "scheduled\_size": 5  
> > > }  
> > > }
> > > 
> > > I'm only indexing a few hundred documents, some with files upto 20Mb  
> > > to be indexed as attachments.
> > > 
> > > Prior to lowering ES\_MAX\_MEM, it wouldn't throw the exception but  
> > > would freeze up as it GC'd:
> > > 
> > > [16:19:59,281][WARN][monitor.jvm] [Slapstick] Long GC  
> > > collection occurred, took [16.1s], breached threshold [10s]  
> > > [16:20:18,901][WARN][monitor.jvm] [Slapstick] Long GC  
> > > collection occurred, took [17.6s], breached threshold [10s]  
> > > [16:20:30,653][WARN][monitor.jvm] [Slapstick] Long GC  
> > > collection occurred, took [10.9s], breached threshold [10s]
> > > 
> > > Thanks.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 4:20am UTC](https://discuss.elastic.co/t/suggested-configuration-to-prevent-outofmemoryerror-errors/3249/5 "2017-07-06T04:20:23Z")

</div>


