SunRPC provides one-way messaging (streaming / packet?)

We have some services using SunRPC on Linux (RHEL 4/5) that we would like to speed up.

Our RPC call does not require a return value, although ack is always sent by the nature of the RPC. This leads to delays that have recently become a problem - when working on reliable transport (TCP), we hope to avoid the latency caused by the RPC response.

The docs here indicate that Solaris has the keyword "oneway" that allows exactly that, although Linux / glibc does not seem to support this.

Is there any way to enable streaming or unidirectional messaging with SunRPC on Linux?

+4
source share
2 answers

For the standard clnt_call() call, you need to make two changes to get an asynchronous (or "batch") RPC call: an argument indicating that the pointer to the XDR function for the response 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) { ... } 
+2
source

If your RPC library does not support the oneway connection, you can always use the pool pool template to emulate the fire and forget in your program. Instead of directly sending a remote call (and thus block until a response is received), you call command , which makes the remote call another thread and allows the main program to continue execution.

+1
source

All Articles