We have some services utilizing SunRPC on Linux (RHEL 4/5) that we'd like to speed up.
Our RPC call require no return value, though by the nature of RPC, an ack is always sent anyway. This introduces latency that's recently become a problem - when run over a reliable transport (TCP), we'd hope to avoid the latency introduced by the RPC reply.
Docs here indicates Solaris has the "oneway" keyword enabling just that, though Linux/glibc does not seem to support this.
Is there any way we can enable "streaming" or one-way messaging with SunRPC on Linux ?
There are two changes that must be made to the standard clnt_call()
invocation in order to obtain an asynchronous (or "batched") RPC call: the argument that's the pointer to the XDR function for the reply data-structure must be NULL
and the timeout argument must be zero, i.e.,
static struct timeval ZERO_TIMEOUT = { 0, 0 };
static char clnt_res;
memset((char*)&clnt_res, 0, sizeof(clnt_res);
if (clnt_call(clnt, messageType, (xdrproc_t)xdr_messageType_t, (caddr_t)argp,
(xdrproc_t)NULL, (caddr_t)&clnt_res, ZERO_TIMEOUT) != RPC_SUCCESS) {
...
}