【发布时间】:2016-12-22 07:30:44
【问题描述】:
In my Task Manager i found that Mysqld.exe takes till 130kb of RAM size and once it reaches this size my application size(javaw.exe) in RAM is gradually increasing which causes the system to hang. Why this takes place? Anyone Please Help. My application is written in java. becaus of this my application is running very slowly
这就是我建立联系的方式。该线程将每秒调用一次
thread_sample_s1 = new Thread(new Runnable() {
public void run() {
try {
ResultSet ress1 = null;
Statement state_men = null;
Connection conn_sample_s1 = null;
try {
conn_sample_s1= (Connection)DriverManager.getConnection(url_s1+db_s1,user_s1,pwd_s1);
} catch (SQLException e3) {
// TODO Auto-generated catch block e3.printStackTrace();
}
conn_sample_s1.setAutoCommit(false);
state_men = conn_sample_s1.createStatement();
//--->> Queries
state_men.close();
ress1.close();
conn_sample_s1.commit();
conn_sample_s1.close();
} catch (SQLException e) {
e.printStackTrace();
}
} }); thread_sample_s1.start();
有100多个类似的线程。每秒都会重新启动
【问题讨论】:
-
除非你发布一些示例代码来展示你如何使用你的数据库连接,否则没有人能做的只是随机猜测,这是浪费时间。
-
你有多少内存?您是否更改了 my.cnf 中的任何默认值? Java 的内存限制是多少?
-
jvm 的 2Gb RAM 和 512mb 限制
-
我已经发布了上面的连接示例
标签: java mysql performance deployment