discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [OT, Q] Fast RPC library?


From: Richard Frith-Macdonald
Subject: Re: [OT, Q] Fast RPC library?
Date: Sun, 23 Oct 2005 07:20:44 +0100

On 2005-10-23 03:11:33 +0100 Sungjin Chun <chunsj@embian.com> wrote:


On Oct 23, 2005, at 12:25 AM, Richard Frith-Macdonald wrote:

Using XML-RPC (GSXMLRPC from the GNustep base library) I have done high speed stuff on a P4. Not sure what you mean by 10K/sec though ... is that data throughput or number of RPCs? If it's number of RPCs, you need to say how many parameters etc you are passing and how big they are etc.

It's number of RPCs. I did not tested my server on P4(which will be faster than my iBook G4). # of Request parameter is under 3 (mostly) and response data size is under 512K (mostly also :-).

It seems to me that a 10K RPC/sec target is high for any machine.

As far as I know GSXMLRPC does not support server, right? And I found that GSXMLRPC client code is one of the fastest client library. (For my test server it's faster than xmlrpc-c).

GSXMLRPC is fine as a server (ie to parse RPCs and generate responses). It doesn't act as a web-server in itsself....but you can use any other web server to run a GSXMLRPC service. The GNUstep SQLClient library (in the dev-libs directory) contains the WebServer class, which can be used to act as a standalone web server, with the xmlrpc handling done by its delegate ...

- (BOOL) processRequest: (GSMimeDocument*)request
               response: (GSMimeDocument*)response
                    for: (WebServer*)http
{
  static GSXMLRPC       *xmlrpc = nil;
  NSString              *error = nil;
  NSString              *method = nil;
  NSMutableArray    *params;
  id                            out;

  if (xmlrpc == nil)
    {
      xmlrpc = [GSXMLRPC new];
    }

  NS_DURING
    {
      data = [request convertToData];
      method = [xmlrpc parseMethod: data params: params];
    }
  NS_HANDLER
    {
      error = [NSString stringWithFormat: @"Bad XMLRPC data - %@",
        [localException description]];
    }
  NS_ENDHANDLER

  // Handle RPC here

  if (errror == nil)
    {
      out = [xmlrpc buildResponseWithParams: objectToReturn];
    }
  else
    {
      out = [xmlrpc buildResponseWithFaultCode: errorCode andString: error];
    }
  out = [out dataUsingEncoding: NSASCIIStringEncoding];

  [response setContent: out type: @"text/xml"];
  [response setHeader: @"http"
                value: @"HTTP/1.1 200 Success"
           parameters: nil];
  return YES;
}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]