English 中文(简体)
• 快速执行MySQL储存在 Java多个地下室内的程序?
原标题:Fast way to execute MySQL stored procedures in Java within multiple threads?

在 Java已翻新的环境中发布储存程序的最快选择是什么? http://dev.mysql.com/doc/refman/5.1/en/jointor-j-usagenotes-basic.html#jointor-j-examples-prepare calls”rel=“nofollow”http://dev.mysql.com/doc/refman/5.1/en/jointor-j-usagenotes-basic.html#jointor-j-examples-prepare calls 连接是一种昂贵的方法。 因此,如果能够同步获得单一可呼吁的声明,那么在每一条条条条条条条路上说话有什么选择?

问题回答

最大的亚行驾驶员只使用一个单列车。 我认为,我的SQL也使用一个单列的袖珍。 在多个深层之间交流一种联系是一种不良的业绩想法。

如果你使用不同校对之间的多重联系,那么,你需要为每一条连接发出一个可呼吁的标准。 你们需要一个连接每一个环节的卡塔巴莱州。 本案中最简单的是总结连接类别,将所有电话都交给原类别。 这可能随着Eclipse而很快产生。 在总结方法中,你可以增加一个简单的人才库。 你们还需要一个充满活力的阶层。 接近的方法将可呼吁的声明归还到集合中。

但是,首先,你应检查这一呼吁是否真正昂贵,因为许多司机已经在内部进行了这种投票。 创建准备和关闭场所,并计算时间。

连接并非安全,因此,你可以把连接起来。

当你准备时,亚洲开发银行的司机(可以)将许多工作储存在服务器上。 你可能在此犯有过早优化罪。

After giving this a little thought it seems that if you are having issues with this infrastructure code then your problems are elsewhere. Most applications do not take an inordinate amount of time doing this stuff.
Make sure you are using a DataSource, most do connection caching and some even do caching of statements.
Also for this to be a performance bottle neck it would imply that you are doing many queries one after the other, or that your pool of connections is too small. Maybe you should do some benchmarking on your code to see how much time the stored proc is taking vs how much time the JDBC code is taking.
Of course I would follow the MySQL recommendation of using CallableStatement, I am sure they have benchmarked this. Most apps do not share anything between Threads and it is rarely an issue.





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签