call PL/SQL  SP  vs.  call directly(without PL/SQL SP)?

Posted on 2002-03-21
Last Modified: 2008-03-06
I wrote a rmi application to test the performance of calling PL/SQL SP using java. at the rmi server side, I called a PL/SQL SP. I found the speed was 10 times  slower than directly call by JDBC. anybody knows the reason? thanks.
Question by:lisayan

Expert Comment

ID: 6886518
There is a lot of overhead with RMI. There are a number of layer including

stub skeleton layer,remote reference layer
and the transport layer.

These layers perform marshalling, holding remote references

RMI was primarly designed for development of distributed object which JDBC was designed for database access.

Expert Comment

ID: 6887603
Let me understand the questions;

Trial 1: JDBC remote client direct to a db server
Trial 2: RMI client to a RMI Server (located on the same system as the DB Server). and then RMI Server to the db server using JDBC

Am I right?

When you use RMI, I guess it works like this:

1. Your client app makes a call to the RMI server
2. The RMI server, then executes the stored procedure
3. The RMI server returns the values to the client by serializing the objects into byte stream (which is a costly operation)

Also every rmi call from the client to the server has an overhead

You can try timing it:

Does the RMI server use jdbc to communicate to the db server? Is the rmi server ON the database server?

Try to print times in the rmi server, just before it makes the stored proc call and just after it returns. You will most likely find that the time taken is more due to the extra overhead of rmi client and rmi server passing objects back and forth by serializing them


Author Comment

ID: 6887910
sorry for my english. the fact is that:
  (note: rmi server is on the db server)
  TRIAL 1: rmi server call db server by PL/SQL SP(such as {call getModuleName(?,?)})
  TRIAL 2: rmi server call db server by JDBC directly(such as "SELECT MODULE_NAME FROM RPMODULE")

(at rmi server side, those two trials got a simple same result by calling db server, and they should have same cost passing this result from rmi server to rmi client.So we don't care about the rmi overhead)

  at TRAIL 1,rmi server returns a result(such as a string) to rmi client cost 100ms.
  at TRAIL 2,rmi server returns same result to rmi client cost 10ms.
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.


Expert Comment

ID: 6887927
If the objects being passed and their sizes are the same for both the trials, then there should not be any difference in timings. Since in both cases you are using RMI to pass results to client, right?

Is this always consistent? or could be due to network latency etc?


Expert Comment

ID: 6888005
Hi there,
I could not get to grips with RMI when I
wanted to do the same as it is such a pain
every time you add a new method and keeping
the rmi registrys running, hence I went to
In 5 minutes you can replace your RMI stuff
with it (just for the experiment), I would
be really interested if your results improve
(only if you have the time to try this)



Author Comment

ID: 6888711
I mean the different is on the server side(rmi server call db server using different approach).it is none of the business of passing result to client.

Accepted Solution

abhay_djs earned 50 total points
ID: 6898298
Hi lisayan,
THe time difference you have noted is not because of the RMI only. But is it because of the execution of SP rather than single query.
Database stores the SP in the compiled format. SO it gets executed fast.
U can try out executing the same thing on database only without using any java. What u can do is... execute simple query and note the timing. ANd then put the same query in the SP and execute that Sp and note the timing.
You can see the difference in the execution timing.


Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
groupSumClump challenge 9 115
oracle 11g 23 73
hibernate example issues from command prompt 10 40
Android development question 2 34
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now