# "Too many open files" exception occurs

**URL:** <https://discuss.elastic.co/t/too-many-open-files-exception-occurs/10986>\
**Category:** Elasticsearch\
**Created:** [March 4, 2013, 8:26am UTC](https://discuss.elastic.co/t/too-many-open-files-exception-occurs/10986 "2013-03-04T08:26:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hoony](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@Hoony](https://discuss.elastic.co/u/Hoony)\
**Post date:** [March 4, 2013, 8:26am UTC](https://discuss.elastic.co/t/too-many-open-files-exception-occurs/10986/1 "2013-03-04T08:26:41Z")

</div>

Hi all,  
When indexing approximately 400 GB, "Too many open files" exception  
occurred.

```
 My elasticsearch(version 20.5) is running on the computer whose memory 

```

is 16 GB, heap size is 8 GB.  
I used one node cluster with two shard for indexing.

```
 There are two shards folder, one of them I found 270,000 files in.

  I doubt that merge operation is invalidation , or .. may be the 

```

indexing rate is much higher than merge rate, but I am not sure...

```
  Are there some case or some opinion about it? 

```

Waiting for your answer.. 🙂

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![simonw\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simonw_2/32/1130_2.png) [@simonw\_2](https://discuss.elastic.co/u/simonw_2)\
**Post date:** [March 4, 2013, 9:09am UTC](https://discuss.elastic.co/t/too-many-open-files-exception-occurs/10986/2 "2013-03-04T09:09:24Z")

</div>

While 270k is a lot it can happen obviously. Yet, I still wonder if you are  
searching on that cluster while indexing or if you have any merge  
throtteling in place or if you prevented any merges by setting merge policy  
paramters?

On Monday, March 4, 2013 9:26:41 AM UTC+1, Hoony wrote:

> Hi all,  
> When indexing approximately 400 GB, "Too many open files" exception  
> occurred.
> 
> ```
> My elasticsearch(version 20.5) is running on the computer whose 
> 
> ```
> 
> memory is 16 GB, heap size is 8 GB.  
> I used one node cluster with two shard for indexing.
> 
> ```
> There are two shards folder, one of them I found 270,000 files in.
> 
> I doubt that merge operation is invalidation , or .. may be the 
> 
> ```
> 
> indexing rate is much higher than merge rate, but I am not sure...
> 
> ```
> Are there some case or some opinion about it? 
> 
> ```
> 
> Waiting for your answer.. 🙂

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Hoony](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@Hoony](https://discuss.elastic.co/u/Hoony)\
**Post date:** [March 4, 2013, 3:21pm UTC](https://discuss.elastic.co/t/too-many-open-files-exception-occurs/10986/3 "2013-03-04T15:21:17Z")

</div>

Hi simonw,  
I used default merge and I just indexing without searching.

在 2013年3月4日星期一UTC+9下午6时09分24秒，simonw写道：

> While 270k is a lot it can happen obviously. Yet, I still wonder if you  
> are searching on that cluster while indexing or if you have any merge  
> throtteling in place or if you prevented any merges by setting merge policy  
> paramters?
> 
> On Monday, March 4, 2013 9:26:41 AM UTC+1, Hoony wrote:
> 
> > Hi all,  
> > When indexing approximately 400 GB, "Too many open files" exception  
> > occurred.
> > 
> > ```
> > My elasticsearch(version 20.5) is running on the computer whose 
> > 
> > ```
> > 
> > memory is 16 GB, heap size is 8 GB.  
> > I used one node cluster with two shard for indexing.
> > 
> > ```
> > There are two shards folder, one of them I found 270,000 files in.
> > 
> > I doubt that merge operation is invalidation , or .. may be the 
> > 
> > ```
> > 
> > indexing rate is much higher than merge rate, but I am not sure...
> > 
> > ```
> > Are there some case or some opinion about it? 
> > 
> > ```
> > 
> > Waiting for your answer.. 🙂

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Hoony](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@Hoony](https://discuss.elastic.co/u/Hoony)\
**Post date:** [March 5, 2013, 5:49am UTC](https://discuss.elastic.co/t/too-many-open-files-exception-occurs/10986/4 "2013-03-05T05:49:47Z")

</div>

Hi, simon  
Since the error message is "Too many _open files_", I doubt that the  
number of open files while indexing is over the limit which set by Linux  
OS.  
I checked the Linux setting, and what I checked is here:

[https://lh3.googleusercontent.com/-ILxAq5yH2Cw/UTWF89LqnjI/AAAAAAAAABE/7wWZ7vToV8Y/s1600/ulimit-a.PNG](https://lh3.googleusercontent.com/-ILxAq5yH2Cw/UTWF89LqnjI/AAAAAAAAABE/7wWZ7vToV8Y/s1600/ulimit-a.PNG)  
How can I check the number of the open files which done by elasticsearch?

在 2013年3月4日星期一UTC+9下午6时09分24秒，simonw写道：

> While 270k is a lot it can happen obviously. Yet, I still wonder if you  
> are searching on that cluster while indexing or if you have any merge  
> throtteling in place or if you prevented any merges by setting merge policy  
> paramters?
> 
> On Monday, March 4, 2013 9:26:41 AM UTC+1, Hoony wrote:
> 
> > Hi all,  
> > When indexing approximately 400 GB, "Too many open files" exception  
> > occurred.
> > 
> > ```
> > My elasticsearch(version 20.5) is running on the computer whose 
> > 
> > ```
> > 
> > memory is 16 GB, heap size is 8 GB.  
> > I used one node cluster with two shard for indexing.
> > 
> > ```
> > There are two shards folder, one of them I found 270,000 files in.
> > 
> > I doubt that merge operation is invalidation , or .. may be the 
> > 
> > ```
> > 
> > indexing rate is much higher than merge rate, but I am not sure...
> > 
> > ```
> > Are there some case or some opinion about it? 
> > 
> > ```
> > 
> > Waiting for your answer.. 🙂

[https://lh6.googleusercontent.com/-1esKX4XnO0I/UTWDoR1jB1I/AAAAAAAAAAw/iGQ9Ch1NYYk/s1600/ulimit-a.PNG](https://lh6.googleusercontent.com/-1esKX4XnO0I/UTWDoR1jB1I/AAAAAAAAAAw/iGQ9Ch1NYYk/s1600/ulimit-a.PNG)

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![otisg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/otisg/32/492_2.png) [@otisg](https://discuss.elastic.co/u/otisg)\
**Post date:** [March 5, 2013, 2:58pm UTC](https://discuss.elastic.co/t/too-many-open-files-exception-occurs/10986/5 "2013-03-05T14:58:34Z")

</div>

Hi,

That shows 1024 open files max. That's very low. Don't be afraid setting  
this to 100K even 🙂

But that 270K files is crazy high indeed. Are you sure some of them are  
not very, very old and are not really a part of the active index? If they  
are indeed old, you could remove them.

SPM for ES can show you network connection stats. I believe open sockets  
count as open files because they consume file descriptors, so this metric  
is good to keep an eye on. See attached screenshot or look at  
[elasticsearch spm performance monitoring | otis | Flickr](http://www.flickr.com/photos/otis/8530498059/) -- I circled what I mentioned  
here.

## Otis

ELASTICSEARCH Performance Monitoring - [Sematext Monitoring | Infrastructure Monitoring Service](http://sematext.com/spm/index.html)

On Tuesday, March 5, 2013 12:49:47 AM UTC-5, Hoony wrote:

> Hi, simon  
> Since the error message is "Too many _open files_", I doubt that the  
> number of open files while indexing is over the limit which set by Linux  
> OS.  
> I checked the Linux setting, and what I checked is here:
> 
> [https://lh3.googleusercontent.com/-ILxAq5yH2Cw/UTWF89LqnjI/AAAAAAAAABE/7wWZ7vToV8Y/s1600/ulimit-a.PNG](https://lh3.googleusercontent.com/-ILxAq5yH2Cw/UTWF89LqnjI/AAAAAAAAABE/7wWZ7vToV8Y/s1600/ulimit-a.PNG)  
> How can I check the number of the open files which done by  
> elasticsearch?
> 
> 在 2013年3月4日星期一UTC+9下午6时09分24秒，simonw写道：
> 
> > While 270k is a lot it can happen obviously. Yet, I still wonder if you  
> > are searching on that cluster while indexing or if you have any merge  
> > throtteling in place or if you prevented any merges by setting merge policy  
> > paramters?
> > 
> > On Monday, March 4, 2013 9:26:41 AM UTC+1, Hoony wrote:
> > 
> > > Hi all,  
> > > When indexing approximately 400 GB, "Too many open files" exception  
> > > occurred.
> > > 
> > > ```
> > > My elasticsearch(version 20.5) is running on the computer whose 
> > > 
> > > ```
> > > 
> > > memory is 16 GB, heap size is 8 GB.  
> > > I used one node cluster with two shard for indexing.
> > > 
> > > ```
> > > There are two shards folder, one of them I found 270,000 files in.
> > > 
> > > I doubt that merge operation is invalidation , or .. may be the 
> > > 
> > > ```
> > > 
> > > indexing rate is much higher than merge rate, but I am not sure...
> > > 
> > > ```
> > > Are there some case or some opinion about it? 
> > > 
> > > ```
> > > 
> > > Waiting for your answer.. 🙂
> 
> [https://lh6.googleusercontent.com/-1esKX4XnO0I/UTWDoR1jB1I/AAAAAAAAAAw/iGQ9Ch1NYYk/s1600/ulimit-a.PNG](https://lh6.googleusercontent.com/-1esKX4XnO0I/UTWDoR1jB1I/AAAAAAAAAAw/iGQ9Ch1NYYk/s1600/ulimit-a.PNG)

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![otisg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/otisg/32/492_2.png) [@otisg](https://discuss.elastic.co/u/otisg)\
**Post date:** [March 6, 2013, 4:00am UTC](https://discuss.elastic.co/t/too-many-open-files-exception-occurs/10986/6 "2013-03-06T04:00:42Z")

</div>

Oh, and is it possible that you changed the merge factor to some high value?

## Otis

ELASTICSEARCH Performance Monitoring - [Sematext Monitoring | Infrastructure Monitoring Service](http://sematext.com/spm/index.html)

On Monday, March 4, 2013 3:26:41 AM UTC-5, Hoony wrote:

> Hi all,  
> When indexing approximately 400 GB, "Too many open files" exception  
> occurred.
> 
> ```
> My elasticsearch(version 20.5) is running on the computer whose 
> 
> ```
> 
> memory is 16 GB, heap size is 8 GB.  
> I used one node cluster with two shard for indexing.
> 
> ```
> There are two shards folder, one of them I found 270,000 files in.
> 
> I doubt that merge operation is invalidation , or .. may be the 
> 
> ```
> 
> indexing rate is much higher than merge rate, but I am not sure...
> 
> ```
> Are there some case or some opinion about it? 
> 
> ```
> 
> Waiting for your answer.. 🙂

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:48am UTC](https://discuss.elastic.co/t/too-many-open-files-exception-occurs/10986/7 "2017-07-06T02:48:09Z")

</div>


