iDatamining.org

I am looking for projects to work on
Please contact with me at yiyu.jia@iDataMining.org!

Sunday, February 6, 2011

How to host multiple instances of Sync4J server on one machine

There was one guy told me that he wanted to install multiple instances of sync4j in one Tomcat instance. He hoped that he can increase the performance of synchronization in this way. To increase performance of software, there are many aspects to work on. From the system architecture aspect, we can improve hardware system in vertical way and horizon way. I do not know if he go multi-CPU server and he can achieve better performance by increase number of instances on sync4j. It will be a big topic to discuss. Here, what I want to discuss is that it is impossible to install two sync4j server inside one Tomcat instance. The reasons are,

  1. Sync4j server uses the server.uri in Sync4j.properties as part of its authentication logic when it processing the syncMessage.
  2. Sync4j finds the path of configuration files based on a system properties called "SYNC4J_HOME". This is not a good design because this configuration property will be used JVM wide. Sync4j server, running in Tomcat, is a servlet. So, two sync4j instances will have to share same sync4j.properties. Therefore, I think Funambol should put all configuration related information under a Web App context only. But, they put the "SYNC4J_HOME" as a system property, which is JVM wide.


Based on the above two factors, I suggested him to install multiple tomcat and link each tomcat to a virtual host under Apache. But, please notice the second factor mentioned above, we will not run multiple tomcat instances on ONE virtual machine. So, we need run multiple binary copies of Tomcat. Then, we can set different Sync4j_Home for different Sync4j servers inside different Tomcat instance (different binary instance of Tomcat).

This installation configuration may cause challenge for sync module developers as they have to consider about plan of database instances. Will different sync4j module instances, having identical code base , share one database or different databases? Obviously, earlier designer think about this questions, better result they will have.

Note: the above analysis is based on sync4j server version 2.3 only. 

No comments:

Post a Comment