2 ms·
This is slightly off-topic but how many 'connections' can an app make over a Unix socket and how would you manage an in-app connection pool like HikariCP or sim
by jarym 6y ago
This is slightly off-topic but how many 'connections' can an app make over a Unix socket and how would you manage an in-app connection pool like HikariCP or similar when using a Unix socket?
- deleted 6y ago[deleted]
- toast0 6y agoYou should be limited only by the number of fds allowed on your system / for your user(s). I believe each connection would be counted as an fd for the server side and the client side; and the listen socket is also a fd on the server side. So max_fds / 2 - 1; assuming you have no other fds open (which is pretty hard to do, but gives you a ceiling). On FreeBSD, you can tune kern.maxfiles up to the number of physical memory pages / 4 [1], despite the nearby comments suggesting a lower limit. You may need to tune some other values as well, and have a pretty tight software stack (or a lot of swap) to average less than 16k of ram per fd. [1] https://github.com/freebsd/freebsd-src/blob/master/sys/kern/subr_param.c#L289 https://github.com/freebsd/freebsd-src/blob/master/sys/kern/...