https://github.com/netease/pomelo-scale-plugin
scale up service for pomelo
https://github.com/netease/pomelo-scale-plugin
Last synced: about 1 year ago
JSON representation
scale up service for pomelo
- Host: GitHub
- URL: https://github.com/netease/pomelo-scale-plugin
- Owner: NetEase
- License: mit
- Created: 2014-05-16T02:50:14.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2023-07-15T09:38:56.000Z (almost 3 years ago)
- Last Synced: 2025-04-14T17:08:02.118Z (about 1 year ago)
- Language: JavaScript
- Size: 141 KB
- Stars: 7
- Watchers: 15
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
pomelo-scale-plugin
====================
pomelo-scale-plugin is a plugin for pomelo, it can be used in pomelo(>=0.6).
pomelo-scale-plugin provides auto scale up service for cluster. Developers can configure corresponding parameters for different types of servers, and the system would monitor the servers and scale up automatically with parameters.
##Installation
```
npm install pomelo-scale-plugin
```
##Usage
```
var scale = require('pomelo-scale-plugin');
app.configure('production|development', 'master', function() {
app.use(scale, {
scale: {
cpu: {
chat: 10,
interval: 10 * 1000,
increasement: 1
},
memory: {
connector: 25,
interval: 15 * 1000,
increasement: 1
},
backup: 'config/development/backupServers.json'
}
});
});
```
```
//backupServers.json
{
"connector":[
{"id":"connector-server-1", "host":"127.0.0.1", "port":4050, "clientPort": 3050, "frontend": true},
{"id":"connector-server-2", "host":"127.0.0.1", "port":4051, "clientPort": 3051, "frontend": true},
{"id":"connector-server-3", "host":"127.0.0.1", "port":4052, "clientPort": 3052, "frontend": true}
],
"chat":[
{"id":"chat-server-1", "host":"127.0.0.1", "port":6050}
],
"gate":[
{"id": "gate-server-1", "host": "127.0.0.1", "clientPort": 3014, "frontend": true}
]
}
```
##Configuration Explanation
The plugin now has two kinds of monitoring index, including cpu and memory. Developers can add types of servers that need to monitor, for example in above configuration chat: 10, this means if the average cpu of chat servers is over 10%, the system would automatically scale up, and the servers which will be added are according to the configuration backup: 'config/development/backupServers.json'. And the account of servers that will be added determines by the increasement field. The interval field means the period of checking of each index.