Linux RPC调用很慢

时间:2016-01-19 10:16:25

标签: linux c

以下RPC程序在fedora上执行速度非常慢。如果我将名称缓冲区更改为llist.x文件中的名称[512],那么它的工作速度很快。我不知道为什么。任何人都知道原因请告诉我。

注意:请编译以下程序并执行它。 30个循环需要3秒钟。

llist.c

BLOB

}

llist_svc_proc.c

DECLARE
  buf BLOB; 
BEGIN
  dbms_lob.createtemporary(buf, FALSE);
  dbms_lob.append(buf, HEXTORAW('0EC1D7FA6B411DA58149'));
  --...lots of hex data...
  dbms_lob.append(buf, HEXTORAW('0EC1D7FA6B411DA58149'));
  UPDATE MyTable
     SET blobData = buf
   WHERE ID = 123;
END;

llist.x

#include "llist.h"
#define PRINT_TIME  (!gettimeofday(&tv, NULL) && printf(" %lf",tv.tv_sec+(tv.tv_usec/1000000.0)))

struct timeval tv;

int main(int argc, char *argv[])
{
CLIENT *cl;
int *result,i=0;

cl = clnt_create("localhost", PRINTER, PRINTER_V1, "tcp");
if (cl == NULL) {
            clnt_pcreateerror("Cant Create Client Handle");
    printf("error: could not connect to server.\n");
    return 1;
}

    ST1 key[1];
    ST1_stuff  key_x;

    /*key_x.ST1_stuff_val = key;
    key_x.ST1_stuff_len = 1;
*/
    while(i<30)
    {
            printf("\n %d -> start - ",i);
            PRINT_TIME;
            result = sei_conf_test_keys2_1(&key_x,cl);
            if (result == NULL) {
    printf("error: RPC failed!\n");
    return 1;
    }
            printf("\nresult = %d ",*result);
            i++;
            printf("\n end - ");
            PRINT_TIME;
            printf("\n -------------------------------------");
    }

return 0;

生成文件

#include <stdlib.h>
#include "llist.h"

int result;

int *sei_conf_test_keys2_1_svc(ST1 *lst, struct svc_req *req)
{
   result = 0;
   return &result;
}

0 个答案:

没有答案