Are there any tips or rules for increasing performance of RMI calls?

Maxim Senin

So far I discovered only one rule of thumb: avoid passing objects as parameters or return values - primitive types serialize much faster than objects because Java objects are so flat. The only object I was unable to avoid passing as a parameter in most applications is String.

I'd define an API that uses object IDs, so that clients operate with IDs only, and the server performs all the work of finding reference to object by ID.

Suppose you write a chat application with RMI. Instead of coding

    ChatRoom remoteChatRoom;
    // ... somehow get reference to chat room
    remoteChatRoom.postMessage (message);
I'd use
    // when connecting to chat room, get room ID
    int CHAT_ROOM_ID = chatServer.getRoomID();
    // chat server will take care 
    // about finding local reference to room
    // by object id and somehow post message in it
    chatServer.postMessage (CHAT_ROOM_ID, message);
Any better ideas?
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact