Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch...
by jarym on Friday February 05, 2021 @08:39AM
(#26036146)
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?
[ Parent
| on HN ]
Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch...
by toast0 on Friday February 05, 2021 @02:40PM
(#26040340)
You 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/...