# unbound warning increased limit open files from 1024 to 4152

## jeffk

On all three of my ~amd64 machines, I see the following warning on boot and when I restart the unbound service:

```
# /etc/init.d/unbound restart

 * Stopping unbound ...                                                   [ ok ]

 * Starting unbound ...

[1281378120] unbound[14028:0] warning: increased limit(open files) from 1024 to 4152
```

What is the recommended configuration unbound's limit of open files on Gentoo? The large config file doesn't show an obvious setting:

```
# grep limit /etc/unbound/unbound.conf 

# grep files /etc/unbound/unbound.conf 

   # for extra security, but make sure all files are in that directory.

   # key files) can be specified in several ways:

   # the working directory. The relative files in this config are 

   # result in interesting log files and possibly the AD bit in

# grep 1024 /etc/unbound/unbound.conf 

   # num-queries-per-thread: 1024

   # val-nsec3-keysize-iterations: "1024 150 2048 500 4096 2500"
```

The default /etc/conf.d/unbound only includes the above conf, no settings there.

Thanks.

----------

## BradN

Probably what it's increasing it to is fine, ~4000 files, even if each open file consumes 256 bytes, that's only a megabyte, and I'm guessing the overhead is much less than that.  That said, I don't know what unbound does, so I'm just talking out my butt here.

----------

## 046

 *jeffk wrote:*   

> What is the recommended configuration unbound's limit of open files on Gentoo? The large config file doesn't show an obvious setting.

 

decrease outgoing-range

In correct configuration, file limit must be less than treads*outgoing-range + tcp connections  + ~10 misc file descriptors.

----------

## jeffk

 *046 wrote:*   

> decrease outgoing-range
> 
> In correct configuration, file limit must be less than treads*outgoing-range + tcp connections  + ~10 misc file descriptors.

 

I did notice an interesting item about libevent in this documentation:

http://www.unbound.net/documentation/howto_optimise.html

 *Quote:*   

> it is better to compile with libevent (see the section below), so that there is no more 1024 limit on outgoing-range.
> 
> ...
> 
> Most pressing is the number of file descriptors, the default has a limit of 1024. To use more than 1024 file descriptors, use libevent or the forked operation method.
> ...

 

libevent-1.4.14b-r1 is installed on my servers and laptop, in fact the only package depending on it is unbound itself, so it appears to be using it.

When I set the configuration to the recommended values:

```
# grep -e "outgoing-range\|num-queries-per-thread" /etc/unbound/unbound.conf 

        # num-queries-per-thread, or, use as many as the OS will allow you.

        # outgoing-range: 4096

        outgoing-range: 8192

        # num-queries-per-thread: 1024

        num-queries-per-thread: 4096
```

The numbers look good, but the warning is still issued:

```
# /etc/init.d/unbound restart

 * Caching service dependencies ... [ ok ]

 * Stopping unbound ...             [ ok ]

 * Starting unbound ...

[1292694404] unbound[6856:0] warning: increased limit(open files) from 1024 to 8248 [ ok ]
```

I'd sure like to get rid of the warning if possible.

Thanks.

----------

