Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    overhead of RMI


    Is there significant overhead in using RMI vs a direct request with JDBC? Are there any benchmarks out there?
    <br>
    <br>
    thanks in advance.
  2. #2
  3. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: overhead of RMI


    Chuck,
    <br>
    Given the axiom that "There Ain't No Such Thing As A Free Lunch" (TANSTAAFL), direct JDBC requests from a Servlet is going to be quicker than using RMI, but that isn't the point of using RMI. The main thrust of Richard Yumal's article is one from a "Software Engineering" stand point i.e. using a distributed architecture for partitioning objects into re-usable, maintainable parts. The bottom line is that we humans (from a development stand point) are the bottle necks in the creation and maintenance of any computer system.
    <br>
    <br>
    Cheers!
    <br>
    Gerry Chike
    <br>
    AlienBean Technologies, Inc.
    <br>
  4. #3
  5. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: overhead of RMI


    Of course, there is is significant overhead when using RMI; With an RMI solution, not only do you have the servlet, there is also the RMIRegistry and the rmi service that also needs to be running. Each tier (servlet, rmiregistry, rmi service) can potentially be running in it's own JVM, which I'd image would create significant overhead, especially if all three tiers are hosted on the same machine.
    <br>
    <br>
    If RMI is a candidate to accomplish the task at hand, the overhead that comes with RMI is just something you'll have to evaluate whether or not the benefits out-weigh the overhead.
    <br>
    <br>
    However, if you're just looking at the RMI client tier, I wouldn't expect there to be too much overhead vs directly using JDBC. Unfortunately, I don't have any metrics or any statistics to cite; this is just a quick analysis of the overall architecture. Does anybody else have any metrics/benchmarks on this kind of data?
    <br>
    <br>
    Hope this helps,
    <br>
    Rich
  6. #4
  7. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: overhead of RMI


    If overhead becomes a problem, then it's a great problem to have. It means you have a popular web-site. In this case, you'll be able to justify the decision to purchase an Application Server. I just read through some BEA Weblogic literature and one thing they do is implement their own RMI. The key to BEA's RMI is that it pipes all the RMI call's through one socket, as opposed to regular Java RMI which utilizes multiple sockets. This advantage is in addition to all the built in features which alleviate the RMI overhead problem with techniques such as Connection Pooling, instance pooling, and load balancing.
  8. #5
  9. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: overhead of RMI


    Thanks for all of your feedback. I agree that it would be a good problem to have to much traffic.
    <br>
    <br>
    I was just trying to not get to far down the wrong path. It seems that building ahead for the need of a distributed architecture would probably only help in the long run.
  10. #6
  11. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    EJB



    Isn't this one of the main things that EJB addresses? Wouldn't EJB be a more effective way of creating the second (or third, depending on how you look at it) tier than RMI?

  12. #7
  13. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Problems w/ Example


    Has anybody had any problems with this example? It seems as if the servlet hangs after a single request. It goes through the init() ok, and will serve up one request (search, add, etc.). All consecutive requests hang with no response. (The rest of the web server is still running fine). Any ideas?

  14. #8
  15. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    I really need this forum


    I really like the forum devshed has incorporated under each of their articles. I would like to include this script on one of the sections on my website. Can anyone help how I can do this, a script would help. Really appreciate what you guys at devshed do for me, I learned a lot from this website. Thanks for all the help.
    <br>
    <br>
    Can someone please email me if they can help me.
    <br>
  16. #9
  17. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: Problems w/ Example


    Did you try taking a look at the error log and or the jserv.log file? That's a pretty peculiar behavior.
    <br>
    <br>
    Rich
  18. #10
  19. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: Problems w/ Example


    Thanks for your response. I thought I had checked all the error logs, but I must have missed the apache error_log. Whenever the servlet is first run, I get a java.security.AccessControlException in the log. I assume this has something to do with the java.policy file, but I'm not sure after looking at it where to make an adjustment. Here is the dump of the error:
    <br>
    <br>
    java.security.AccessControlException: access denied (java.io.FilePermission /hom
    <br>
    e/jason/public_servlets read)
    <br>
    at java.security.AccessControlContext.checkPermission(Compiled Code)
    <br>
    at java.security.AccessController.checkPermission(Compiled Code)
    <br>
    at java.lang.SecurityManager.checkPermission(Compiled Code)
    <br>
    at java.lang.SecurityManager.checkRead(Compiled Code)
    <br>
    at java.io.File.isDirectory(Compiled Code)
    <br>
    at org.apache.java.lang.AdaptiveClassLoader.loadClass(Compiled Code)
    <br>
    at java.lang.ClassLoader.loadClass(Compiled Code)
    <br>
    at java.io.ObjectInputStream.loadClass0(Native Method)
    <br>
    at java.io.ObjectInputStream.resolveClass(Compiled Code)
    <br>
    at sun.rmi.server.MarshalInputStream.resolveClass(Compiled Code)
    <br>
    at java.io.ObjectInputStream.inputClassDescriptor(Compiled Code)
    <br>
    at java.io.ObjectInputStream.readObject(Compiled Code)
    <br>
    at java.io.ObjectInputStream.readObject(Compiled Code)
    <br>
    at java.io.ObjectInputStream.inputObject(Compiled Code)
    <br>
    at java.io.ObjectInputStream.readObject(Compiled Code)
    <br>
    at java.io.ObjectInputStream.readObject(Compiled Code)
    <br>
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Compiled Code)
    <br>
    at java.rmi.Naming.lookup(Compiled Code)
    <br>
    at client.Booklet.init(Compiled Code)
    <br>
    at org.apache.jserv.JServServletManager.load_init(Compiled Code)
    <br>
    at org.apache.jserv.JServServletManager.loadServlet(Compiled Code)
    <br>
    at org.apache.jserv.JServConnection.processRequest(Compiled Code)
    <br>
    at org.apache.jserv.JServConnection.run(Compiled Code)
    <br>
    at java.lang.Thread.run(Compiled Code)
    <br>
    java.lang.NullPointerException
    <br>
    at client.Booklet.doGet(Compiled Code)
    <br>
    at javax.servlet.http.HttpServlet.service(Compiled Code)
    <br>
    at javax.servlet.http.HttpServlet.service(Compiled Code)
    <br>
    at org.apache.jserv.JServConnection.processRequest(Compiled Code)
    <br>
    at org.apache.jserv.JServConnection.run(Compiled Code)
    <br>
    at java.lang.Thread.run(Compiled Code)
    <br>
    <br>
    Any help would be greatly appreciated! (note: the /home/jason/public_servlets directory and servlet are accessible by 'nobody' [everything chmod'ed to 755]. root can even su to nobody and do a 'jar -tvf' on the client.jar file)
    <br>
    Thanks,
    <br>
    -Jason
  20. #11
  21. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: Problems w/ Example


    There's two things that you could try;

    1. Add file permissions to your java.policy file. It would look something like this:


    <!-- Code -->
    <p><pre><font color=#008000><xmp>
    grant {
    permission java.net.SocketPermission "*:1024-65535",
    "connect,accept";
    permission java.io.FilePermission
    "/home/jason/public_servlets/-", "read";
    };
    </xmp></font></pre><p>
    <!-- Code -->


    2. If that doesn't work, you also might try adding the
    <!-- Code -->
    <p><pre><font color=#008000><xmp>-Djava.rmi.server.codebase=/path/to/servlet/jars</xmp></font></pre><p>
    <!-- Code -->
    when you start up your server. Try it both with just putting the directory where the jar is as well as the full path, including the filename. I've had mixed results when trying this additional parameter. Sometimes it needs the directory, sometimes it needs the filename.

    <br><br>
    Also, in your jserv.properties file, you could also try to add
    <!-- Code -->
    <p><pre><font color=#008000><xmp>-Djava.compiler=NONE</xmp></font></pre><p>
    <!-- Code -->
    to the <tt>wrapper.bin.parameters</tt> line, so you can get line numbers in those stack traces.
    <br><br><br>
    Hope this helps,<br>
    Rich
  22. #12
  23. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: Problems w/ Example


    Thanks. That was extremely helpful. I have made the changes to the java.policy file, and everything seems to be working great now (and fast!)

    Thanks again,
    Jason
  24. #13
  25. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Another Question


    Is there anyway to run the init() method from within the doGet() or doPost method? For example, in the doGet() event, we could test and see if our connection is up with the server (or, for exmaple, a JDBC connection to a db server), and if not, run the init() method again. I guess an alternative would be to put any connection-oriented initialization into another method and call that from init(), and then from wherever else it is needed. (it just means a little bit more code mgmt). Any ideas?
    <br>
    <br>
  26. #14
  27. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: Another Question


    I don't really see why there's anything preventing you from calling the init() method from your doGet() or doPost() methods. By convention, however, those methods are supposed to be called by the servlet container. Try it and see how it works.

    However, your alternate solution would probably be the most straightforward.

    Rich
  28. #15
  29. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: Problems w/ Example


    I tried to run this example in TOMCAT!
    in window98.
    Everything went fine upto the first page
    of the servlet. But after the first page
    I found some exceptions are being fired
    at the window where tomcat was running.
    After that even ordinay other servlet
    is not working?
    Am i missing any more settings..?
    I copied the client.jar to the
    respected dirctory.(it came once, so I think
    that is right)...
    I added this jar file to the classpath
    for tomcat environment..
    what else more to be done?
    Can any one help me?
    Any kind of sugesstions/help would be
    highly appreciated
    ramasubramanian
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo