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个类似于此的线程。这将每秒开始新的
答案 0 :(得分:0)
我的应用程序是用java编写的。因为我的应用程序运行非常缓慢
我害怕,它比Java更重要。在Java中每秒运行数百个SQL查询绝对没什么大不了的。
您遗失的一件重要事情是a connection pool。另一个是prepared statement。相信我,还有更多需要学习的东西。
很可能,DB是瓶颈。您的查询可能是问题,然后优化Java部分不会有帮助。衡量并更新您的问题。