Deployment Synchronizer (DepSync) provides capability to synchronize deployment artifacts across the nodes of a product cluster.
A product's repository typically contains user-uploaded service archives, modules, service metadata, scheduled tasks etc. These artifacts are typically shared across multiples nodes in a cluster. Therefore, in order to maintain consistency in a clustered environment, the artifact repository (in WSO2 products it is <product-home>/repository/deployment/server by default) should be in-sync between all the cluster nodes.
This synchronization functionality is provided by the following feature in the WSO2 feature repository:
Name: WSO2 Carbon - Deployment Synchronizer Feature
Identifier: org.wso2.carbon.deployment.synchronizer.feature.group
In summary, the WSO2 Deployment Synchronizer addresses the following three main use cases:
- Maintaining an up-to-date backup of the artifact repository.
- Sharing a single artifact repository among multiple servers in a cluster.
- Enforcing artifact updates to be deployed on a server at runtime.
Currently, the WSO2 Deployment Synchronizer (DepSync) uses an SVN-based repository for storing shared deployment artifacts. The Subversion repository is used to sync the contents in the sync directory, which by default is the axis2 repo directory <PRODUCT_HOME>/repository/deployment/server. This method is efficient and high-performant. The synchronization process is as follows:
- When changes to the contents of axis2 repo directory are present, the Read-Write nodes commit those to the Subversion repository.
- Then, this node sends a cluster message to all other (slave) nodes specifying the repo is updated.
- When the slave nodes receive the message, they update their axis2 repo directory with what's in the svn repository.
Ghost Deployment for Better Performance
Ghost deployment is enabled in WSO2 DepSync feature, and it ensues that only ghost artifacts are loaded into memory at the time a tenant starts up. Ghost artifacts are light-weight XML references to the actual artifacts. These XML files are stored in <PRODUCT_HOME>/repository/deployment/server, with metadata references to the actual artifacts.
If DepSync updates all artifacts under its SVN repository when a tenant loads, as the number of artifacts in a repository gradually increases, the initial tenant loading time also gets higher. By loading a reference rather than checking the entire SVN repository, ghost deployment significantly improves performance of the the initial tenant loading time. It is faster, more efficient and prevents first-request timeouts and delays.
WSO2 DepSync is optimized to checkout only the repository with depth=empty when a tenant loads. For example,
svn co https://svn.wso2.org/repos/wso2/scratch/carbon-server-framework/--depth=empty
Once the top-level is checked out, the ghost meta files of the actual artifacts are loaded to it. At the time a request is made for an actual artifact, the GhostDisptcher issues a DepSync update of the required artifacts only. For example, if a request is made for a service, GhostDisptcher intercepts this request and then does the update of that service file only using following operations.
Code Block |
---|
svn update axis2services --depth=empty svn update axis2services/Version.aar |
It resumes serving the request after deploying this service. The same scenario for a webapp request is handled by the GhostWebappDeployerValve
.
Configuring the DepSync
...