Hi Aaron,
I didn't change the log level, I used the default. Here is the function I use to
access JCS with the code that gets the value from the database. The jcs variable
is a JCSWorker. Several threads are concurrently calling the getSim() function.
/**
* Get the semantic similarity values for the given GO terms.
* @param term1 GO accession number for term 1
* @param term2 GO accession number for term 2
* @return the similarity value
*/
public int getSim(final String term) throws Exception {
JCSWorkerHelper helper = new JCSWorkerHelper() {
private boolean finished = false;
public Object doWork() throws Exception {
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
int id = 0;
try {
// Get the database connection and query for the scores
con =
ConnectionManager.getConnection(PropertiesManager.getProperties());
stmt = con.createStatement();
rs = stmt.executeQuery("SELECT id FROM gt_genes.term WHERE
acc='" + term + "'");
if (rs.next())
id = rs.getInt(1);
} catch (SQLException e) {
e.printStackTrace(System.err);
} finally {
try { con.close(); } catch (Exception e) {}
try { stmt.close(); } catch (Exception e) {}
try { rs.close(); } catch (Exception e) {}
}
// Tell the JCSWorker that I have finished.
this.setFinished(true);
// Return the id
return id;
}
public boolean isFinished() {
return finished;
}
public void setFinished(boolean b) {
finished = b;
}
};
return (Integer) jcs.getResult(term, helper);
}
Smuts, Aaron wrote:
Sure sounds like you did something wrong. What's your log level at?
JCS cannot be run at DEBUG. I must be at INFO or higher. If that's not
it, I'd need to see more details. JCS is less than 2times the speed of
a hashtable for reads and writes.
-----Original Message-----
From: Andreas Schlicker [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 11, 2007 4:16 AM
To: jcs-users@jakarta.apache.org
Subject: JCS too slow?
Hi all,
here's my situation:
My application retrieves values (say v) from a database, calculates
another
values (say w), and writes this back to the database. I use threads,
that
work
concurrently. I implemented a very simple caching with a HashMap that
is
used by
all threads for caching v. Using this simple caching my application
runs
approximately 2.5 hours.
Then, I stumbled upon JCS. I use JCSWorker and JCSWorkerHelper. Now,
using
this
implementation for caching the v values, the application runs more
than 20
hours
for the same work.
Am I doing something badly wrong?
Kind regards,
Andreas
--
Andreas Schlicker, M.Sc.
Max-Planck-Institute for Informatics
Department 3: Computational Biology and Applied Algorithmics
Stuhlsatzenhausweg 85
66123 Saarbruecken
Germany
Phone: +49 681 9325 321
Fax: +49 681 9325 399
Homepage: http://www.mpi-inf.mpg.de/~schlandi
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]