There are some necessary pre-requisites when using socket caching:
- Set EF_UL_EPOLL
=3
and set EF_FDS_MT_SAFE=1
- Socket caching is not supported after
fork()
- Sockets that have been
dup()
ed will not be cached - Sockets that use the
O_ASYNC
orO_APPEND
modes will not be cached - Caching offers no benefit if a single socket accepts connections on multiple local addresses (applicable to passive caching only).
- Set
O_NONBLOCK
orO_CLOEXEC
if required on the socket, when creating the socket.From Onload 201805 onwards,
O_CLOEXEC
cannot be used when a listening socket is used simultaneously by multiple processes.
When socket caching cannot be enabled, sockets will be processed as normal Onload sockets.
Users should refer to details of the following environment variables:
- EF_SOCKET_CACHE_MAX
- EF_PER_SOCKET_CACHE_MAX
- EF_SOCKET_CACHE_PORTS
Note: Allowing more sockets to be cached than there are file descriptors available can result in drastically reduced performance and users should consider that the socket cache limit, EF_SOCKET_CACHE_MAX, applies per stack, unlike the per-process EF_SOCKET_CACHE_PORTS limits.
Refer to Parameter Reference for details of Onload environment variables.