Results 1 to 9 of 9

Thread: Java Object Output Stream and Ice

  1. #1
    brian is offline Registered User
    Name: brian whitney
    Organization: boulder research and development
    Project: MarketBank
    Join Date
    Oct 2003
    Posts
    119

    Java Object Output Stream and Ice

    Hello again,

    We have been using Ice, IcePack, IceStorm, IceBox, and Freeze successfully now for over 2 years in a heterogenous (Java/C++, Unix/Windows), distributed environment and we love it! Thanks again for all the great work.

    We just noticed a performance issue in legacy non-Ice Java code that uses ObjectOutputStream and ObjectInputStream objects to read and write across processes. It appears as though the consumer is not keeping up with the producer and conquently the producer process is blocking a lot. Classic problem. We had a similar problem in Ice using two-way proxies, but once we changed to one-way proxies, performance got a *lot* better.

    I have been trying to find out the underlying protocol that Java Object Streams at javasoft.com, but to no avail. I assume its TCP/IP two-way protocol, but cannot confirm.

    We are considering re-engineering this communication link using Ice one-way proxies, but want to make sure it is worth it. Do you know if Java Object Streams use, in fact, a two-way protocol? Are there any recommendations you would have -- e.g. UDP vs. TCP -- for this problem?

    Thanks a bunch for your help.

    Brian
    Brian Whitney
    Boulder Research and Development
    www.robotrade.com

  2. #2
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Hi Brian,

    The ObjectInputStream and ObjectOutputStream classes only perform "marshaling", i.e., they translate Java primitive and object types into a binary format, and vice versa. They can be wrapped around another stream, such as one you might get from a network connection, but they don't perform any networking tasks themselves. You'll need to examine the legacy application in more detail to discover the origin of the underlying stream.

    Hope that helps,
    - Mark

  3. #3
    brian is offline Registered User
    Name: brian whitney
    Organization: boulder research and development
    Project: MarketBank
    Join Date
    Oct 2003
    Posts
    119
    Good point. the ObjectOutputStream is constructed this way:

    ServerSocket serverSocket = new ServerSocket( somePort );
    Socket socket = serverSocket.accept();
    ObjectOutputStream oos = new ObjectOutputStream( socket.getOutputStream() );

    .....
    while(...)
    oos.writeObject(...)

    The ObjectInputStream construction:

    Socket socket = RMISocketFactory.getDefaultSocketFactory().createS ocket( InetAddress.getLocalHost().getHostName, port );
    ...
    ObjectInputStream ois = new ObjectInputStream( socket.getInputStream() );
    ...

    while( ... )
    ois.readObject();

    I suppose we can experiment with setting socket buffer sizes, but wanted your opinion if you thought Ice might be better is this situation for some reason. This connection will always be Java<->Java.

    THanks again,

    Brian
    Brian Whitney
    Boulder Research and Development
    www.robotrade.com

  4. #4
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860
    Since this is a general Java question, let me suggest that you post this question in some Java support forum.

  5. #5
    brian is offline Registered User
    Name: brian whitney
    Organization: boulder research and development
    Project: MarketBank
    Join Date
    Oct 2003
    Posts
    119
    Marc,

    I was only trying to give some background to the basic questions which I stated which is:

    Do you think can Ice achieve better performance than this current implementation of Object streams using sockets from Java server and client. Perhaps using one-way proxies. Please read the entire thread.

    Your thoughts would be very much appreciated.

    Thanks,

    Brian
    Brian Whitney
    Boulder Research and Development
    www.robotrade.com

  6. #6
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860
    I'm sorry, but we do not have any performance data for your current implementation, therefore we cannot give any advice. If you would like us to investigate, please contact us at info@zeroc.com for commercial consulting services.

  7. #7
    rdilipk is offline Registered User
    Name: Dilip Ranganathan
    Organization: 3M
    Project: None
    Join Date
    Jul 2003
    Location
    Minnesota, USA
    Posts
    35
    I not 100% sure if this is relevant but it appears that java.io.ObjectInputStream and java.io.ObjectOutputStream does appear to have some performance related issues. So much so that the JBoss gang have come up with thier own version of Java serialization (although I **think** it works only with JDK 1.5). This is probably old news, but pls take a look at this:
    http://labs.jboss.com/portal/?ctrl:i...=serialization

  8. #8
    michi's Avatar
    michi is offline Registered User
    Name: Michi Henning
    Organization: Triodia Technologies
    Project: I have a passing interest in Ice :-)
    Join Date
    Feb 2003
    Location
    Brisbane, Australia
    Posts
    1,055
    OutputStream would have to be implemented using introspection. At a hunch, I'd say that it's the introspection that causes the loss of performance, not the socket or the serialization as such. (Ice doesn't use introspection to marshal Slice types in Java.)

    Cheers,

    Michi.

  9. #9
    brian is offline Registered User
    Name: brian whitney
    Organization: boulder research and development
    Project: MarketBank
    Join Date
    Oct 2003
    Posts
    119

    Smile

    Michi & rdilipk,

    Thank you both for you comments/suggestions. This is the kind of information I was seeking in the first place.

    Brian
    Brian Whitney
    Boulder Research and Development
    www.robotrade.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 10-20-2008, 08:49 AM
  2. Slice mapping for java.lang.Object
    By sattursa in forum Help Center
    Replies: 5
    Last Post: 06-02-2008, 04:15 PM
  3. Ice 3.2.1: Java stream helper functions
    By kwaclaw in forum Bug Reports
    Replies: 3
    Last Post: 11-15-2007, 09:35 PM
  4. Object Factories: Java vs C#
    By kwaclaw in forum Comments
    Replies: 15
    Last Post: 09-28-2007, 01:04 PM
  5. Replies: 8
    Last Post: 08-08-2005, 09:24 AM

Posting Permissions

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