Results 1 to 4 of 4
  1. #1
    Raymond is offline Member
    Join Date
    Jan 2010
    Posts
    32
    Rep Power
    0

    Default RMI/TCP/IP Help.

    Hi,

    I heard TCP/IP is faster than running RMI. How do I implement TCP/IP to replace RMI? Here is part of the RMI:

    pastebin - collaborative debugging tool

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,340
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Raymond View Post
    Hi,

    I heard TCP/IP is faster than running RMI. How do I implement TCP/IP to replace RMI? Here is part of the RMI:

    pastebin - collaborative debugging tool
    You are comparing apples with pears: TCP/IP is just a transportation layer that deals with sockets and simple streams while RMI uses a transportation layer for its services: (de)serialization of objects and the management of the RMI connection. You can't just replace one for the other.

    kind regards,

    Jos

  3. #3
    Raymond is offline Member
    Join Date
    Jan 2010
    Posts
    32
    Rep Power
    0

    Default

    No, I want to replace the whole thing not ONE part RMI and the other TCP/IP. :)

  4. #4
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    RMI is a higher level layer built on top of the Socket class, which is in turn built on tcp/ip. RMI is not fundamentally slow, but if your application is 'chatty', then it will be.

    A 'chatty' program is going to be slow using lower level protocols as well, since the slowness is introduced by chattiness over a network, and not the protocol.

    If you require speed, then your program can not pause waiting for a remote client to respond. I did a quick look at your link, and it looks like you're doing some kind of database transactions. You can speed those up by doing bulk transactions, accepted or rolled back as a group, rather than 1 at a time.

    For example, if you have a loop calling a method of a remote object, that's going to be slow since every call has to pause and wait for a response. If instead, you rewrite your interface to call that method one time, passing a command container of some kind, then you only have to wait for a response once.

    If you don't need a response at all, then yes, you can use Sockets directly to fire and forget. This is the fastest approach, but it isn't suitable for all applications.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •