From 156cab2c873524cf2d45013d98679b32910b40b0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 13 Oct 2022 23:11:43 +0200 Subject: [PATCH] Update to poolifier 2.3.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit And default to FAIR_SHARE tasks scheduling strategy Signed-off-by: Jérôme Benoit --- README.md | 32 ++++++++++++++++---------------- package-lock.json | 14 +++++++------- package.json | 2 +- src/utils/Configuration.ts | 4 +++- 4 files changed, 27 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index e7b8a4b4..a515a6c9 100644 --- a/README.md +++ b/README.md @@ -90,22 +90,22 @@ But the modifications to test have to be done to the files in the build target d **src/assets/config.json**: -| Key | Value(s) | Default Value | Value type | Description | -| -------------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| supervisionUrls | | [] | string \| string[] | string or array of global connection URIs to OCPP-J servers | -| supervisionUrlDistribution | round-robin/random/charging-station-affinity | charging-station-affinity | boolean | supervision urls distribution policy to simulated charging stations | -| logStatisticsInterval | | 60 | integer | seconds between charging stations statistics output in the logs | -| logConsole | true/false | false | boolean | output logs on the console | -| logFormat | | simple | string | winston log format | -| logRotate | true/false | true | boolean | enable daily log files rotation | -| logMaxFiles | | 7 | integer | maximum number of log files to keep | -| logLevel | emerg/alert/crit/error/warning/notice/info/debug | info | string | winston logging level | -| logFile | | combined.log | string | log file relative path | -| logErrorFile | | error.log | string | error log file relative path | -| worker | | {
"processType": "workerSet",
"startDelay": 500,
"elementStartDelay": 0,
"elementsPerWorker": 1,
"poolMinSize": 4,
"poolMaxSize": 16,
"poolStrategy": "ROUND_ROBIN"
} | {
processType: WorkerProcessType;
startDelay: number;
elementStartDelay: number;
elementsPerWorker: number;
poolMinSize: number;
poolMaxSize: number;
poolStrategy: WorkerChoiceStrategy;
} | Worker configuration section:
- processType: worker threads process type (workerSet/staticPool/dynamicPool)
- startDelay: milliseconds to wait at worker threads startup (only for workerSet threads process type)
- elementStartDelay: milliseconds to wait at charging station startup
- elementsPerWorker: number of charging stations per worker threads for the `workerSet` process type
- poolMinSize: worker threads pool minimum number of threads
- poolMaxSize: worker threads pool maximum number of threads
- poolStrategy: worker threads pool [poolifier](https://github.com/poolifier/poolifier) worker choice strategy | -| uiServer | | {
"enabled": true,
"type": "ws",
"options": {
"host": "localhost",
"port": 8080
}
} | {
enabled: boolean;
type: ApplicationProtocol;
options: ServerOptions;
authentication: {
enabled: boolean;
type: AuthenticationType;
username: string;
password: string;
}
} | UI server configuration section | -| performanceStorage | | {
"enabled": false,
"type": "jsonfile",
"file:///performanceRecords.json"
} | {
enabled: boolean;
type: string;
URI: string;
}
where type can be 'jsonfile' or 'mongodb' | performance storage configuration section | -| stationTemplateUrls | | {}[] | {
file: string;
numberOfStations: number;
}[] | array of charging station configuration templates URIs configuration section (charging station configuration template file name and number of stations) | +| Key | Value(s) | Default Value | Value type | Description | +| -------------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| supervisionUrls | | [] | string \| string[] | string or array of global connection URIs to OCPP-J servers | +| supervisionUrlDistribution | round-robin/random/charging-station-affinity | charging-station-affinity | boolean | supervision urls distribution policy to simulated charging stations | +| logStatisticsInterval | | 60 | integer | seconds between charging stations statistics output in the logs | +| logConsole | true/false | false | boolean | output logs on the console | +| logFormat | | simple | string | winston log format | +| logRotate | true/false | true | boolean | enable daily log files rotation | +| logMaxFiles | | 7 | integer | maximum number of log files to keep | +| logLevel | emerg/alert/crit/error/warning/notice/info/debug | info | string | winston logging level | +| logFile | | combined.log | string | log file relative path | +| logErrorFile | | error.log | string | error log file relative path | +| worker | | {
"processType": "workerSet",
"startDelay": 500,
"elementStartDelay": 0,
"elementsPerWorker": 1,
"poolMinSize": 4,
"poolMaxSize": 16,
"poolStrategy": "FAIR_SHARE"
} | {
processType: WorkerProcessType;
startDelay: number;
elementStartDelay: number;
elementsPerWorker: number;
poolMinSize: number;
poolMaxSize: number;
poolStrategy: WorkerChoiceStrategy;
} | Worker configuration section:
- processType: worker threads process type (workerSet/staticPool/dynamicPool)
- startDelay: milliseconds to wait at worker threads startup (only for workerSet threads process type)
- elementStartDelay: milliseconds to wait at charging station startup
- elementsPerWorker: number of charging stations per worker threads for the `workerSet` process type
- poolMinSize: worker threads pool minimum number of threads
- poolMaxSize: worker threads pool maximum number of threads
- poolStrategy: worker threads pool [poolifier](https://github.com/poolifier/poolifier) worker choice strategy | +| uiServer | | {
"enabled": true,
"type": "ws",
"options": {
"host": "localhost",
"port": 8080
}
} | {
enabled: boolean;
type: ApplicationProtocol;
options: ServerOptions;
authentication: {
enabled: boolean;
type: AuthenticationType;
username: string;
password: string;
}
} | UI server configuration section | +| performanceStorage | | {
"enabled": false,
"type": "jsonfile",
"file:///performanceRecords.json"
} | {
enabled: boolean;
type: string;
URI: string;
}
where type can be 'jsonfile' or 'mongodb' | performance storage configuration section | +| stationTemplateUrls | | {}[] | {
file: string;
numberOfStations: number;
}[] | array of charging station configuration templates URIs configuration section (charging station configuration template file name and number of stations) | #### Worker process model diff --git a/package-lock.json b/package-lock.json index ccd030c9..e3a2c403 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,7 @@ "mnemonist": "^0.39.3", "moment": "^2.29.4", "mongodb": "^4.10.0", - "poolifier": "^2.2.2", + "poolifier": "^2.3.1", "proper-lockfile": "^4.1.2", "source-map-support": "^0.5.21", "tar": "^6.1.11", @@ -12257,9 +12257,9 @@ } }, "node_modules/poolifier": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/poolifier/-/poolifier-2.2.2.tgz", - "integrity": "sha512-P/HEDFP9vvmLUnAoydBJL77jzZ1orw4NJBb20H7JagYlAdZTMG4UHSUF62fusdiLR3rHYXgLo6/tjH7D6ix2gQ==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/poolifier/-/poolifier-2.3.1.tgz", + "integrity": "sha512-ZIOWItMx1LNzpbx7BvLRTGIrhP7qlyCYjc7KpOnCUL28z40CyF7TF1icPE38k1r/zk4tdeDttR5AO332B2lS0A==", "engines": { "node": ">=16.0.0", "npm": ">=8.0.0" @@ -26828,9 +26828,9 @@ } }, "poolifier": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/poolifier/-/poolifier-2.2.2.tgz", - "integrity": "sha512-P/HEDFP9vvmLUnAoydBJL77jzZ1orw4NJBb20H7JagYlAdZTMG4UHSUF62fusdiLR3rHYXgLo6/tjH7D6ix2gQ==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/poolifier/-/poolifier-2.3.1.tgz", + "integrity": "sha512-ZIOWItMx1LNzpbx7BvLRTGIrhP7qlyCYjc7KpOnCUL28z40CyF7TF1icPE38k1r/zk4tdeDttR5AO332B2lS0A==" }, "postcss": { "version": "8.4.16", diff --git a/package.json b/package.json index b4a67b29..7d06de1f 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "mnemonist": "^0.39.3", "moment": "^2.29.4", "mongodb": "^4.10.0", - "poolifier": "^2.2.2", + "poolifier": "^2.3.1", "proper-lockfile": "^4.1.2", "source-map-support": "^0.5.21", "tar": "^6.1.11", diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index 4fc46b05..db0eebb7 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -3,6 +3,7 @@ import path from 'path'; import { fileURLToPath } from 'url'; import chalk from 'chalk'; +import { WorkerChoiceStrategies } from 'poolifier'; import { type ConfigurationData, @@ -217,7 +218,8 @@ export default class Configuration { ) ? Configuration.getConfig().workerPoolMaxSize : WorkerConstants.DEFAULT_POOL_MAX_SIZE, - poolStrategy: Configuration.getConfig().workerPoolStrategy, + poolStrategy: + Configuration.getConfig().workerPoolStrategy ?? WorkerChoiceStrategies.FAIR_SHARE, }; if (Configuration.objectHasOwnProperty(Configuration.getConfig(), 'worker')) { workerConfiguration = { ...workerConfiguration, ...Configuration.getConfig().worker }; -- 2.34.1