Tuesday, 27 August 2013

no matter what the query is, sometimes it delayed so much

no matter what the query is, sometimes it delayed so much

i programmed at centos(6.2final), mysql 5.1.66 and java jdk 1.6.
this code get me server's result.
public ArrayList confirm(String key, String string){
ArrayList tmp= null;
try{
PreparedStatement prep = null;
try{
prep = Local.prepareStatement("select distinct tags from tagDB
where key=? and string!=?;");
}catch (Exception e) {
}if(prep!=null){
prep.setString(1,key);
prep.setString(2,string);
int count = getRowCount(prep.executeQuery());
if(count>0){
tmp= new ArrayList();
ResultSet rs = prep.executeQuery();
while(rs.next()){
tmp.add(rs.getString("tags"));
}
return tmp;
}
}
}catch(Exception e){
e.printStackTrace();
}
return tmp;
}
and db of server is good. i think so.
if you want to see mysql. i can get it to you.
my log from java is below.
16:2:46:450, turnaround time :26
16:2:46:484, turnaround time :23
16:2:46:514, turnaround time :24
16:2:46:769, turnaround time :23
16:2:46:819, turnaround time :24
16:2:46:845, turnaround time :23
16:2:46:874, turnaround time :23
16:2:47:259, turnaround time :82
16:2:47:290, turnaround time :23
16:2:47:327, turnaround time :24
16:2:47:369, turnaround time :25
16:2:47:665, turnaround time :23
16:2:47:707, turnaround time :24
16:2:47:739, turnaround time :23
16:2:47:776, turnaround time :25
16:2:47:803, turnaround time :25
16:2:49:492, turnaround time :23
16:2:49:524, turnaround time :23
16:2:50:7, turnaround time :24
16:2:50:51, turnaround time :27
16:2:50:136, turnaround time :71
16:2:50:246, turnaround time :106
16:2:50:761, turnaround time :47
16:2:51:848, turnaround time :23
16:2:51:875, turnaround time :25
16:2:51:912, turnaround time :31
16:2:51:965, turnaround time :23
16:2:52:13, turnaround time :45
16:2:52:545, turnaround time :22
16:2:52:573, turnaround time :24
16:2:52:601, turnaround time :22
16:2:52:626, turnaround time :23
16:2:52:963, turnaround time :108
16:2:53:22, turnaround time :54
16:2:58:131, turnaround time :5098
16:2:58:157, turnaround time :22
16:2:58:241, turnaround time :23
16:2:58:271, turnaround time :22
16:2:58:296, turnaround time :23
16:2:58:325, turnaround time :23
**16:3:3:358, turnaround time :5028
16:3:8:423, turnaround time :5027**
16:3:9:525, turnaround time :22
16:3:9:573, turnaround time :46
16:3:9:623, turnaround time :42
16:3:9:656, turnaround time :23
16:3:9:713, turnaround time :51
16:3:9:752, turnaround time :24
16:3:9:799, turnaround time :31
16:3:9:941, turnaround time :23
16:3:9:965, turnaround time :22
16:3:9:993, turnaround time :22
16:3:10:25, turnaround time :23
16:3:10:51, turnaround time :23
16:3:10:97, turnaround time :41
16:3:10:248, turnaround time :64
16:3:15:288, turnaround time :5032
sometimes it delayed 5000ms exactly.
so i think it happend cause of server's mem or buffer setting, like gc of
java.
so i edit my.cnf(config file of mysql). about size of maxconnection,
max_heap_table_size, max_tmp_table_size, thread_cache_size and so on. (i
failed to adjust value of thread_cache_size and some table thing. my.cnf
file doesn't adjust above two value....)
than nothing happened.
mysql's slow query log can't get anything.
... anything i can't do more. so please.. and appreciate so much to read
all....
so much. have a good day you all.
ps. my english is not good.. i know. sorry about that too.^^;

No comments:

Post a Comment