File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes performance issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "performance issue" Watch "performance issue" New topic

performance issue

jone wiilum
Ranch Hand

Joined: Mar 24, 2007
Posts: 49
i am developing a web application
i have 3 diffrent mysql database
one is local and other 2 are place on a another machine.
my problem is when i try to insert or get data to or from
that 2 databases(which is place on diffrent machine) it will take
lots of time.
some cases i am using PreparedStatement more then one
because of PreparedStatement my performance down?
please help me to inhance performance.
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

PreparedStatements normally only have positive effects on performance*.

No sense in trying to optimize anything without fully understanding what the problem is. So, first step: work out where your bottleneck is. Are the queries run against these three instances identical (or as near to identical as makes no difference)? If they are not then I'd look at the queries first - can you generate execution plans for them or profile them? (not sure MysQL has tools for this, but if it does, use them). If they are, check the data in the three instances - do the slow ones have significantly more data? If they do, consider creating indices. If your data already has indices, check their statistics are up to date (if they are not, it could be your indices are not being used). And most simple of all, check your database servers are comparable - perhaps the remote ones are running on slow systems, or running out of resources?

If you have the same (or simmilar) queries running against the same (or simmilar) data, on the same (or simmilar) physical hardware, with all indices etc. up to date, then it sounds like it may be the network. See if you can prove this. Write a test case that runs the same SQL against the same database and run them locally and remotely (ideally using the same SQL that demonstrates the performance problem in you application). Is there a huge performance difference? If there is, speak to your network administrator about bandwidth.

(* there are exceptions to this rule, but they are not very common)

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
steve souza
Ranch Hand

Joined: Jun 26, 2002
Posts: 862
You can track your jdbc and query performance using the jamon jdbc proxy driver: - a fast, free open source performance tuning api.
JavaRanch Performance FAQ
I agree. Here's the link:
subject: performance issue
It's not a secret anymore!