1 Reply Latest reply on Jul 17, 2009 2:02 PM by Ron Sigal

    ServerInvocationHandler Performance problem

    AASD sdjkflsdf Newbie

      Hi

      I have a master/worker architecture. Workers get data and then pass the data to servers using Callbacks

      The worker registers a callback and the master invoques them based on a scheduling algorithm we have.

      We have found that a big number of incomming connections decreases the performance at the master side. What we do is we have a threadpool that is processing the data sent by workers. Also we keep a queue of data sent equals to the number of threads in the pool (we run a number of threads which is Ncpu * 1.5 )

      For the communications berween master and server we use also JBossRemoting (TransporterServer).

      We are trying to control the number of incomming connections. I can control more or less based with the number or callbacks called and then as soon I receive the data I decrease the counter of pending connections.

      The problem with this approach is that is asynchronous so if master sends the callback to the worker and this crashes before sending the data. Then the server thinks he is pending so we have a +1 pending connection which will never happen. This cannot be used because if I set a limit of incomming connections and all of them are crashed workers, then no one would be able to send data anymore.


      Is it there any way to know how many incomming calls we have? asking the transporter server?


      Thanks in advance
      Alfonso

        • 1. Re: ServerInvocationHandler Performance problem
          Ron Sigal Master

          Hi Alfonso,

          Sorry to be dense, but I'm just not following you. Are you asking how to determine how many connections are coming into a Remoting server?

          If so, and assuming you are using the socket transport, then I can tell you that each connection to the server is represented by an org.jboss.remoting.transport.socket.ServerThread. The ServerThread manages invocations coming in over a single socket. It sits in a loop like this:

           while (socket is open)
           read invocation
           process invocation
           return result
          


          So the ServerThread could be sitting in SocketInputStream.read() waiting for the next invocation, but I guess you could still consider it an active connection. To get the number of currently active ServerThreads, you can do something like:

           ((SocketServerInvoker) serverInvoker).getCurrentClientPoolSize()
          


          assuming you have access to the ServerInvoker. For example, if you're trying to make the call from an implementation of org.jboss.remoting.ServerInvocationHandler, you can implement ServerInvocationHandler.setInvoker() to store a reference to the ServerInvoker.

          If I've misunderstood your question, please try again.

          -Ron