Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: noalx on November 23, 2016, 09:13:46 PM



Title: BitCoin Node - maxconnections 873
Post by: noalx on November 23, 2016, 09:13:46 PM
Hi

I just wanted to increase the maxconnections of my Bitcoin Core Node (v0.13.1) to about 1000 to 2000 connections.

If i set maxconnections to 1000 i get the following error:
Quote
Reducing -maxconnections from %d to %d, because of system limitations.

Maxconnections is reduced to 873 connections. Why?
I also checked "RLIMIT_NOFILE" and it is far above 873 connections.

Is there another reason, why it is set to 873 connections?

Thank you for your help


Title: Re: BitCoin Node - maxconnections 873
Post by: achow101 on November 23, 2016, 09:25:15 PM
RLIMIT_NOFILE is not related to this.

The limitation is defined here: https://github.com/bitcoin/bitcoin/blob/40022fe5f2b576d023fa260eb176bde6d0779330/src/init.cpp#L855

FD_SETSIZE is default 1024 (set by system). That is the absolute maximum number of file descriptors. MIN_CORE_FILEDESCRIPTORS is 150, and nBind is default 1. Thus you can only have 1024-1-150=873 connections.


Title: Re: BitCoin Node - maxconnections 873
Post by: noalx on November 23, 2016, 09:54:04 PM
RLIMIT_NOFILE is not related to this.

The limitation is defined here: https://github.com/bitcoin/bitcoin/blob/40022fe5f2b576d023fa260eb176bde6d0779330/src/init.cpp#L855

FD_SETSIZE is default 1024 (set by system). That is the absolute maximum number of file descriptors. MIN_CORE_FILEDESCRIPTORS is 150, and nBind is default 1. Thus you can only have 1024-1-150=873 connections.

Thank you.

Is there any reason, why FD_SETSIZE is set to 1024? Do i break something if i increase this?


Title: Re: BitCoin Node - maxconnections 873
Post by: achow101 on November 23, 2016, 10:24:26 PM
Thank you.

Is there any reason, why FD_SETSIZE is set to 1024? Do i break something if i increase this?
FD_SETSIZE is set by the system. IIRC you can't change it.


Title: Re: BitCoin Node - maxconnections 873
Post by: cr1776 on November 23, 2016, 11:56:43 PM
RLIMIT_NOFILE is not related to this.

The limitation is defined here: https://github.com/bitcoin/bitcoin/blob/40022fe5f2b576d023fa260eb176bde6d0779330/src/init.cpp#L855

FD_SETSIZE is default 1024 (set by system). That is the absolute maximum number of file descriptors. MIN_CORE_FILEDESCRIPTORS is 150, and nBind is default 1. Thus you can only have 1024-1-150=873 connections.

Thank you.

Is there any reason, why FD_SETSIZE is set to 1024? Do i break something if i increase this?

Depending on the system you are using, you may be able to increase it.  E.g. In some versions of Linux, you could probably recompile the kernel etc with different parameters.  It has been 10+ years since I've looked at this, so I don't have specifics.