Re: Is perl better? :(((
From: Tom Dyess (tdyess_at_dysr.com)
Date: 01/31/05
- Previous message: Tom Dyess: "Re: Is perl better? :((("
- In reply to: Tom Dyess: "Re: Is perl better? :((("
- Next in thread: kjc: "Re: Is perl better? :((("
- Reply: kjc: "Re: Is perl better? :((("
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 30 Jan 2005 18:19:24 -0500
"Tom Dyess" <tdyess@dysr.com> wrote in message
news:wBdLd.4055$qJ3.3276@bignews1.bellsouth.net...
> <akizub@yahoo.com> wrote in message
> news:1107124096.035600.248010@z14g2000cwz.googlegroups.com...
>> Tom:
>> Thanks for sharing you experience. I really appreciate it.
>> Especially these are question which I would ask too.
>> As you already read I have big experience too.
>>
>>> Wasthe original PERL script hitting an Oracle database?
>> Exactly the same.
>>
>>> Why are you calling thousands of SQL statements that just return a
>> pairs?
>> I hate such design too. Let say in another query from different
>> database (and different time) we have these pairs.
>>
>>>Is there any way to call several of these statements in a single call?
>> No. pairs are different.
>>
>>> PERL is great for text manipulation, but I don't think this fact
>> would cover the gammut of ~2.5x
>> difference in speed.
>>
>> That was my impression too. Just before yetaerday's night.
>>
>>> Did you run an explain plan on your Oracle SQL?
>> I know I can improve this query. But that's not the point. It will be
>> improved in both languages and it still will be no difference. SQLs are
>> exactly the same.
>> Stupid, impractical but the same.
>>
>>
>>> Is your Oracle box the same DB that the perl scripts are calling? (Ie
>> perl hitting
>> production, java hitting some crappy 90mhz oracle box someone threw
>> together).
>>
>> Oracle on one box, Java and perl on another. Both production.
>>
>>> Are you using SQL hints when tuning your SQL?
>> Yes and no. The same result. See previous answer about SQL.
>>
>>> When you step through a debug, are the SQL calls taking the most
>> time?
>> Don't use debug only start and end time. Code is simple. See my another
>> answer in the thread.
>>
>>>Are you using the same Oracle client software on both test scenarios?
>> Yes.
>>
>>> Are you using a persistant connection? (ie not dropping and
>> reconnecting every script).
>> Yes. One connection and it's alive for hours. No bad connections or
>> another exceptions.
>> Results are the same in perl and Java. But perl runs 2.5 faster.
>> I run two windows on the same Solaris box. In one I run java. In
>> another in the same time (it's about one hour) I can run perl program
>> twice for the same result and have another 10-15 minutes for third run.
>>
>>> Are you creating a Java application for every script, or are you
>> creating a
>> large single Java app that calls all scripts?
>> All SQLs are in one thread and in one cycle. One by one. Just like
>> perl.
>> Of course creating of thousand of threads could be more useful. But
>> what about poor Oracle? To be honest, our DBAs already called me and
>> asked to stop my SQL and run in the middle of the night. It was first
>> call from them in 5 years.
>>
>>>I don't want the answers to all these, just suggesting some things to
>> try.
>> I tried these and a lot of others.
>> BECAUSE I DON"t WANT TO USE PERL!
>> I like it too, but support of hundreds of scripts is a nightmare!
>> And what arguments do I have to switch to Java?
>> 20 minutes vs. hour!
>>
>>>I know you said you were using the same Oracle, but if all you are
>> doing is
>> sending a SQL statement to Oracle, Java is done until you get the
>> result. It
>> doesn't sound the same. By same I mean you are connecting to the same
>> server, same instance with the same client on the same workstation,
>> just two different languages.
>>
>> Don't use threads. As well as perl. See previous answer.
>>
>>>Does your workstation have enough free memory to be running Java?
>> This is Solaris with 8Gb. Sure enough to store 1000 keys Hashtable.
>>
>>
>>>On OraclePower.com (ya ya, shameless plug, but I *do* have a point) I
>> run 17 queries on the home page, and it comes back instantly. Oracle
>> hauls-ass with Java.
>>
>> Sorry, don't understand. A lot of resources. Don't know how they can
>> help me. Mostly I know all this and always was sure that Oracale loves
>> Java as well as me. But it doesn't help me to prove my point for
>> managers.
>> Actually what point? Fact is fact. I can't deny it even I don't like
>> it.
>>
>> Maybe it's OCI. But I can't install it on produstion server. I should
>> use what already exists. So, perl has OCI, JDBC doesn't and perl
>> forever?
>> Very sad Certified and with huge experience Java programmer
>> Alex Kizub.
>>
>
> The point with the Oraclepower comment was that it is written in Java and
> runs very fast with Oracle. It was also a shameless plug, so you can
> ignore it. Lol. I'm using oraclejdbc14.jar and connect using this string:
>
> jdbc:oracle:thin:" + username + "/" + password + "@" + server + ":" + port
> + ":" + sid;
>
> using this driver:
>
> oracle.jdbc.driver.OracleDriver
>
> I would suggest stepping through your code and see if there is any
> distinguishable pause between the line before the execution and after.
> This may help to determine if its the connection or the post-processing
> that is making the difference. I would guess the latter, but it's better
> to not guess at this point.
>
> I'm gonna see if I can optimize the code a little, but I'm relatively new
> to Java compared to Delphi, so I don't know that I will be able to do
> much.
>
> Tom Dyess
> OraclePower.com
>
Ok, after looking at the code, I see some mistakes, so would you send the
exact code including the SQL statement? For example
for (int i=0; i<2000; i++)
ps.setInt(1, i);
rs = ps.executeQuery();
I think you mean to put the rs = ps.executeQuery() in a block when it
currently isn't:
for (int i=0; i<2000; i++) {
ps.setInt(1, i);
rs = ps.executeQuery();
}
Please send the exact code so we can run it and establish a time baseline
before tuning. Also,
connection.getPreparedStatement("select 'key', sysdate+? from dual");
If you are using java.sql.Connection, it's prepareStatement(String), but I
don't know if you have the java.sql.Connection wrapped in an aggregating
object or not (I do).
-- Tom Dyess OraclePower.com
- Previous message: Tom Dyess: "Re: Is perl better? :((("
- In reply to: Tom Dyess: "Re: Is perl better? :((("
- Next in thread: kjc: "Re: Is perl better? :((("
- Reply: kjc: "Re: Is perl better? :((("
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|