Update to poolifier 2.3.1
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 13 Oct 2022 21:11:43 +0000 (23:11 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 13 Oct 2022 21:11:43 +0000 (23:11 +0200)
And default to FAIR_SHARE tasks scheduling strategy

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
README.md
package-lock.json
package.json
src/utils/Configuration.ts

index e7b8a4b4c4a29a8c56ff00ccdaff4813f99097ea..a515a6c9256625cba48843a2a9684c4725fa7ff4 100644 (file)
--- 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                     |                                                  | {<br />"processType": "workerSet",<br />"startDelay": 500,<br />"elementStartDelay": 0,<br />"elementsPerWorker": 1,<br />"poolMinSize": 4,<br />"poolMaxSize": 16,<br />"poolStrategy": "ROUND_ROBIN"<br />} | {<br />processType: WorkerProcessType;<br />startDelay: number;<br />elementStartDelay: number;<br />elementsPerWorker: number;<br />poolMinSize: number;<br />poolMaxSize: number;<br />poolStrategy: WorkerChoiceStrategy;<br />} | Worker configuration section:<br />- processType: worker threads process type (workerSet/staticPool/dynamicPool)<br />- startDelay: milliseconds to wait at worker threads startup (only for workerSet threads process type)<br />- elementStartDelay: milliseconds to wait at charging station startup<br />- elementsPerWorker: number of charging stations per worker threads for the `workerSet` process type<br />- poolMinSize: worker threads pool minimum number of threads</br >- poolMaxSize: worker threads pool maximum number of threads<br />- poolStrategy: worker threads pool [poolifier](https://github.com/poolifier/poolifier) worker choice strategy |
-| uiServer                   |                                                  | {<br />"enabled": true,<br />"type": "ws",<br />"options": {<br />"host": "localhost",<br />"port": 8080<br />}<br />}                                                                                        | {<br />enabled: boolean;<br />type: ApplicationProtocol;<br />options: ServerOptions;<br />authentication: {<br />enabled: boolean;<br />type: AuthenticationType;<br />username: string;<br />password: string;<br />}<br />}      | UI server configuration section                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
-| performanceStorage         |                                                  | {<br />"enabled": false,<br />"type": "jsonfile",<br />"file:///performanceRecords.json"<br />}                                                                                                               | {<br />enabled: boolean;<br />type: string;<br />URI: string;<br />}<br />where type can be 'jsonfile' or 'mongodb'                                                                                                                 | performance storage configuration section                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
-| stationTemplateUrls        |                                                  | {}[]                                                                                                                                                                                                          | {<br />file: string;<br />numberOfStations: number;<br />}[]                                                                                                                                                                        | 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                     |                                                  | {<br />"processType": "workerSet",<br />"startDelay": 500,<br />"elementStartDelay": 0,<br />"elementsPerWorker": 1,<br />"poolMinSize": 4,<br />"poolMaxSize": 16,<br />"poolStrategy": "FAIR_SHARE"<br />} | {<br />processType: WorkerProcessType;<br />startDelay: number;<br />elementStartDelay: number;<br />elementsPerWorker: number;<br />poolMinSize: number;<br />poolMaxSize: number;<br />poolStrategy: WorkerChoiceStrategy;<br />} | Worker configuration section:<br />- processType: worker threads process type (workerSet/staticPool/dynamicPool)<br />- startDelay: milliseconds to wait at worker threads startup (only for workerSet threads process type)<br />- elementStartDelay: milliseconds to wait at charging station startup<br />- elementsPerWorker: number of charging stations per worker threads for the `workerSet` process type<br />- poolMinSize: worker threads pool minimum number of threads</br >- poolMaxSize: worker threads pool maximum number of threads<br />- poolStrategy: worker threads pool [poolifier](https://github.com/poolifier/poolifier) worker choice strategy |
+| uiServer                   |                                                  | {<br />"enabled": true,<br />"type": "ws",<br />"options": {<br />"host": "localhost",<br />"port": 8080<br />}<br />}                                                                                       | {<br />enabled: boolean;<br />type: ApplicationProtocol;<br />options: ServerOptions;<br />authentication: {<br />enabled: boolean;<br />type: AuthenticationType;<br />username: string;<br />password: string;<br />}<br />}      | UI server configuration section                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
+| performanceStorage         |                                                  | {<br />"enabled": false,<br />"type": "jsonfile",<br />"file:///performanceRecords.json"<br />}                                                                                                              | {<br />enabled: boolean;<br />type: string;<br />URI: string;<br />}<br />where type can be 'jsonfile' or 'mongodb'                                                                                                                 | performance storage configuration section                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
+| stationTemplateUrls        |                                                  | {}[]                                                                                                                                                                                                         | {<br />file: string;<br />numberOfStations: number;<br />}[]                                                                                                                                                                        | array of charging station configuration templates URIs configuration section (charging station configuration template file name and number of stations)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
 
 #### Worker process model
 
index ccd030c9a9d1a424c31b34f605fcc96ed29dfc64..e3a2c403d6a77108a19683d3f7acfaf5a1b60aa5 100644 (file)
@@ -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",
       }
     },
     "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"
       }
     },
     "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",
index b4a67b293e5f7b5159845a6320678ec09317e6db..7d06de1f56633f5715463dac39984c165385461d 100644 (file)
@@ -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",
index 4fc46b059ffa9dfa1aa5ce4c99883e758eb12c68..db0eebb70eecbc0641f0ebb4b28416cdd5075020 100644 (file)
@@ -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 };