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
這是我如何進行連接。這個線程將每秒調用一次隨着mysqld.exe和我的應用程序RAM大小增加
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個線程與此類似。這將開始新的每一秒
除非你發佈了一些示例代碼,說明你如何使用你的數據庫連接,否則沒有人可以隨機猜測,這是浪費時間。 – MarsAtomic
你有多少內存?你有沒有改變my.cnf中的任何默認值? Java的內存有什麼限制? –
2Gb RAM和512mb限制jvm –