Structure caching and load balancing/clustering

User dfeb81947d

02-09-2010 13:04:40

Dear Support,


I have a question about load balancing and structure caching.


According to the documentation about structure cache on http://www.chemaxon.com/jchem/doc/dev/dbconcepts/, I have a question. It said that "The structure cache is stored in a static pool, therefore
a structure table is only cached once within the same Java Virtual Machine
(JVM)", so It means that If I have many instance of tomcat server, I will have several JVM corresponding to each server. It means one cache per tomcat server (however the number of application under those tomcat), if I understand clearly the meaning.


But If I have many instance of tomcar to run applications, how behave the structure caching? Does a new structure cache is created? And what if clustering is used between two tomcat server?


Has jvm on jdk1.5 under 32bits OS is limited to 1.5 Gb, if someone whould want more memory he has to use multiple Tomcat instance and use load balancing. In that case I guess there is one structure caching per Tomcat. But if using clustering for example (sharing resources and object between many Tomcat instance) are there each structure caching per tomcat?


If I have 5 applications under on Tomcat Server, can you confirm that those 5 applications use the same structure cache? But iif those 5 applications are installed all alone under a single tomcat (it means 5 Tomcat), there will be 5 structure cache in each tomcat JVM. Is there a way that those 5 tomcat (i.e. 5 applications) share the same cache? Without using JChem Cartridge? (Perhaps using Socket? RMI? CORBA? To set a communication between the JVM?)


Thank you in advance for your answers. I apologize if these are dumb questions and it waste your time.


Best Regards


Jacques

ChemAxon aa7c50abf8

03-09-2010 16:09:26

Dear Jacques,


But If I have many instance of tomcar to run applications, how behave the structure caching? Does a new structure cache is created?

One structure cache is created for each Java class loader used to load jchem.jar. Multiple Tomcat instances -> multiple structure caches. Multiple WEB applications in the same Tomcat instance AND jchem.jar is in the WEB-INF/lib of each application -> multiple structure caches. Multiple WEB applications in the same Tomcat instance AND jchem.jar is in shared/lib (or in an other directory catered for by a class loader shared by all applications) -> one structure cache.


And what if clustering is used between two tomcat server?

I don't have experience with Tomcat clustering, but based on the little I know (for example from this document: http://www.datadisk.co.uk/html_docs/java_app/tomcat6/tomcat6_clustering.htm), Tomcat replicates only HTTP session state between the nodes. Application state is not replicated -- applications run separately on the nodes as if they were running alone in isolated Tomcat instances, I understand.


Has jvm on jdk1.5 under 32bits OS is limited to 1.5 Gb,

The limit depends on the operating system. With linux, you can go a bit above 2GB.


if someone whould want more memory he has to use multiple Tomcat instance and use load balancing.

This requires to partition the structure cache between Tomcat instances AND have the load balancing mechanism "know" of this mechanism. While this is certainly not impossible to implement, in practice I think it is much simpler to upgrade to a 64-bit version of the operating system, if your only purpose is to increase memory. (64-bit has become a real commodity. Nowadays, even inexpensive consumer systems often come with 64-bit Windows pre-loaded. On the linux/unix market, 64-bit has been ubiquitous for quite a few years now.)


But if using clustering for example (sharing resources and object between many Tomcat instance) are there each structure caching per tomcat?

This appears to be the same question as above. Let me know, if I misunderstand.


If I have 5 applications under on Tomcat Server, can you confirm that those 5 applications use the same structure cache? 

If the same single jchem.jar file is shared by the five applications (as mentined above), yes.


But iif those 5 applications are installed all alone under a single tomcat (it means 5 Tomcat), there will be 5 structure cache in each tomcat JVM. Is there a way that those 5 tomcat (i.e. 5 applications) share the same cache?

I am not sure I can follow you here... Do you mean five Tomcats in a cluster?


Without using JChem Cartridge? (Perhaps using Socket? RMI? CORBA? To set a communication between the JVM?)

If the question is how to make multiple Tomcat instances share the same structure cache, here is one possible approach: implement your WEB application so that it is able to run searches either locally (directly using JChemSearch) or through a Web Service depending on the configuration. You can find a WS implementation here which covers most of the basic needs: https://www.chemaxon.com/products/jchem-web-services/ .


Talking about the even brighter future, we have a clustering mechanism at the JChem Base level in the pipe line (with the eventual ability of partitioning the structure cache between JCB nodes), but this project is at an early stage and (being a low priority project) is progressing slowly.


I hope this helps,


Peter

User dfeb81947d

06-09-2010 08:17:22

Thank you very much Peter, it's clear to me and answers all my questions. I will try all the solutions you gave me to see what suit the best for my purpose.


Thank you again


Best Regards,


Jacques