jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Schlicker <andreas.schlic...@mpi-inf.mpg.de>
Subject Re: JCS too slow?
Date Thu, 12 Jul 2007 15:45:31 GMT
Hi Aaron,

thanks for your help.

Regarding the logging, I add the commons-logging.jar to the class path and 
that's it. Otherwise JCS logs whatever it logs, but it seems that no log file is 
created, so I would assume that nothing is logged.

Right, I forgot to put the setFinished call into the finally block.

Here is my config file if that helps:
# DEFAULT CACHE REGION

# sets the default aux value for any non configured caches
jcs.default=
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=2000000
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
jcs.default.elementattributes.IsEternal=false
jcs.default.elementattributes.MaxLifeSeconds=3600
jcs.default.elementattributes.IdleTime=1800
jcs.default.elementattributes.IsSpool=true
jcs.default.elementattributes.IsRemote=true
jcs.default.elementattributes.IsLateral=true

Kind regards,
Andreas

Smuts, Aaron wrote:
> What's the default level?  This depends on the logging system, not JCS.
> 
> 
> I'm not sure what you are trying to do with the JCS worker, but it
> doesn't look safe as coded.  You'd at least have to mark it finished in
> a finally block.  An unchecked exception could lock up your application.
> . . . 
> 
> I need to look at the worker code too.  I've never used it and it's been
> a long time since it was added. . . .
> 
> Aaron
> 
>> -----Original Message-----
>> From: Andreas Schlicker [mailto:andreas.schlicker@mpi-inf.mpg.de]
>> Sent: Thursday, July 12, 2007 5:37 AM
>> To: Smuts, Aaron
>> Cc: JCS Users List
>> Subject: Re: JCS too slow?
>>
>> 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:andreas.schlicker@mpi-inf.mpg.de]
>>>> 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: jcs-users-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: jcs-users-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jcs-users-help@jakarta.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Mime
View raw message