This discussion is archived
4 Replies Latest reply: Nov 5, 2012 6:35 PM by kmensah RSS

Oracle JVM performance

AlbertoFaenza Expert
Currently Being Moderated
Hi everybody,

I hope this is the correct forum for this question. I'm working on an Oracle database version 9.2.0.8.

There were some requirements to implement a connection to a web service over SSL using client-certificate authentication.
Due to the fact that this was not available in Oracle 9i, I have decided to check if it was possible to implement it using Java in Oracle.

I have investigated a bit, and found an interesting paper from Oracle: Java in the Oracle Database @Work – Customer Case Studies which was useful and helped me making my tests.

After loadind JSSE in database (Java version coming with Oracle 9i did not have this jar included), I have:
- created my Java source
- publish the Java class to a stored procedure

Everything is fine and working as expected and according to the requirement, however there is a small issue which I wanted to know if it could be improved.

The first time the Java stored procedure is called within a session, it takes about 10 seconds. All following calls within the same session are taking about 1 second which is the time expected considering the connection to SOAP endpoint, etc..
Opening another session and running again the procedure will take again 10 seconds for the first call only.

Reading the documents I understood that Oracle is performing a JIT (just in time) compilation.
Would it be possible that the first call is taking 10 seconds to compile the Java bytecode to native machine code?

I've also read about ahead of time compilation of Java. Unfortunately I'm not the DBA and before asking this task I would like to know some details.

How can I check if the compilation is causing this 10 seconds delay on first procedure call?
Is there any tuning I can ask to do on database by the DBA for Oracle JVM?

Please inform me if I have to provide additional information for this question.

Regards.
Al
  • 1. Re: Oracle JVM performance
    946222 Explorer
    Currently Being Moderated
    I'm not sure if this 10 second delay is related to compiling the java bytecode, but for sure it's not the just-in time compiler (JIT) because this is a feature that was only implemented in Oracle 11g. What you had in Oracle 9i was java native compilation, which maybe can help improving your response times. Take a check on the following links and make some tests, maybe that is what you are looking for:

    http://docs.oracle.com/cd/B10501_01/java.920/a96656/perf.htm#1001963

    http://www.oracle-base.com/articles/9i/java-native-compilation-9i.php
  • 2. Re: Oracle JVM performance
    AlbertoFaenza Expert
    Currently Being Moderated
    Hi Paulo,

    thank you for your links. I have already considered native compilation and the links you provided are giving some additional details which I haven't found before.
    However I was more interested in understanding if the delay was really due to Java bytecode and if there was another way to solve it.

    Going to native compilation might be a bit difficult. I have to involve DBAs and I'm sure they don't know too much about this.
    And they have already said to me that the small delay on the first calll is acceptable.

    Regards.
    Al
  • 3. Re: Oracle JVM performance
    AlbertoFaenza Expert
    Currently Being Moderated
    Closing the issue as it has minor importance
  • 4. Re: Oracle JVM performance
    kmensah Newbie
    Currently Being Moderated
    Hi,

    Better late than never.

    I confirm that JIT is only available in 11g and later.

    What you are observing is because the very first invocation of Java in the life of a database session initializes Java in that session (then the application) i.e., private session metadata and states -- even though system and application Java classes are shared across all sessions of a database instance.

    A dumb call to any dbms_java function (see hereafter) will initialize the JVM in the session; this should reduce the overhead of the first call (not eliminate because you will still initialize the application metadata and private states in the sesssion).
    SQL>select dbms_java.longname('foo') from dual;

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points