A stand-alone web system that needs to be replaced when deployed in a cluster requires the following considerations:
1. Cache
When a single machine, usually cache in the local memory, the cluster environment, the cache between the processes can not communicate, you may consider the use of distributed cache, or memory database, distributed cache can consider memcached, or JBoss cache, memory database can consider Redis, Depending on the scenario, different distributed caches are used, and for situations where real-time requirements are high, a replicated distributed cache like JBoss cache can be used, and the JOBSS cache uses network multicast to replicate to other nodes when the cache content of one node is changed. In this way, each application node accesses the local memory while accessing the cache, and when the data consistency requirement is high, it can use similar Redis memory database, the problem is that each access has network overhead;
2. Time synchronization
As the name implies, in the cluster of nodes, to make time synchronization, using NTP service, otherwise there will be a lot of inexplicable problems;
3. File access
To ensure the consistency of the file access of each node, two ideas, one is to use the database storage files, such as MongoDB file access, one is to set up a file sharing system, such as Windows file sharing, or Linux NFS system;
4. Background thread
To control the contention and conflict of resources by the background thread of each node of the cluster, which is related to the specific business, perhaps there is no framework solution, the application should control the contention and conflict, or adopt the node's heartbeat, the surviving node to perform the background task control (a single node to perform background tasks, according to a certain strategy, Take turns to get the execution authority of background tasks);