New Posts New Posts RSS Feed: slow Remote Procedure Call
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

slow Remote Procedure Call

 Post Reply Post Reply
Author
lars-erik View Drop Down
Newbie
Newbie
Avatar

Joined: 15-Oct-2007
Location: Norway
Posts: 19
Post Options Post Options   Quote lars-erik Quote  Post ReplyReply Direct Link To This Post Topic: slow Remote Procedure Call
    Posted: 03-Sep-2008 at 5:06am

The first time I am running a remote procedure call, it is really slow. It takes about a minute - but it always succeeds. Then subsequent calls are really fast (2 sec).

I notice that if I wait 15-20 minutes, and tries the RPC call again, it is slow again. I guess it has something to do with proxy or firewall, but I am completely clueless.
 
I am using:  InvokeServerMethod.
Maybe I should just use InvokeServerMethodAsync, and just assume that it succeeds.
Can anyone explain how to use the "pUserstate" argument of the method InvokeServerMethodAsync ?
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 03-Sep-2008 at 10:32am
Are you using Remoting or WCF?
 
Are you using a BOS?  If so, are using IIS, Windows Service, or Console Server?
 
Do all RPC calls exhibit this behavior, or is it just one or a few?
 
Here is some documentation on InvokeServerMethodAsync
 
Asynchronous version of RPC call (#467)
 

PersistenceManager now contains an overloaded InvokeServerMethodAsync method which allows for asynchronous invocation of a server-side method.  This method works similarly to the synchronous InvokeServerMethod, except that the method return data is available in the event arguments passed to the InvokeServerMethodCompleted event.  An outstanding request can be canceled using the CancelAsync method.

 

    private void MakeAsyncCall() {

      PersistenceManager pm = PersistenceManager.DefaultManager;

      // Setup completion handler

pm.InvokeServerMethodCompleted +=

new EventHandler<InvokeServerMethodCompletedEventArgs>(InvokeServerMethodCompletedHandler);

      // Make async call

      Guid myToken = Guid.NewGuid();

      pm.InvokeServerMethodAsync(new ServerRpcPersistenceDelegate(Order.GetNumberOfOrdersSlow), myToken,

         new DateTime(1995, 1, 1), new DateTime(1999, 1, 1));

    }

    private void InvokeServerMethodCompletedHandler(object sender, InvokeServerMethodCompletedEventArgs e) {

      Guid token = (Guid)e.UserState;

      if (!e.Cancelled) {

        MessageBox.Show("my async result = " + Convert.ToInt32(e.Result).ToString());

      }

    }

 

 There is also a Tech Tip which you might find relevant:

 

http://www.ideablade.com/techtip_Extract_Maximum_Data_Retrieval_Performance.htm

 



Edited by davidklitzke - 03-Sep-2008 at 10:38am
Back to Top
lars-erik View Drop Down
Newbie
Newbie
Avatar

Joined: 15-Oct-2007
Location: Norway
Posts: 19
Post Options Post Options   Quote lars-erik Quote  Post ReplyReply Direct Link To This Post Posted: 05-Sep-2008 at 12:42am

I found the cause.

My rpc-method "DirectoryExists" is very slow. All it does is to call System.IO.Directory.Exists .
I have now replaced it with a win32 call (findfirstfile) - and it runs fast.
Thanks for the description of Asynchronous version of RPC anyway.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down