Skip to content

Commit cf3ac8a

Browse files
committed
Document PM2, Gatling usage
1 parent 8745cb4 commit cf3ac8a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

readme.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,30 @@ When applying multiple rate limits (e.g. a global limit and a more strict limit
6565
for a specific endpoint), set this to a unique value on each to prevent
6666
double-counting of visits.
6767

68+
## Usage with PM2, gatling, and other process managers
69+
70+
Because this store requires code execution in the primary process, it doesn't
71+
work with process managers that need full control of the primary process,
72+
including PM2 when in `cluster` mode.
73+
74+
### PM2
75+
76+
To work with [PM2](https://pm2.keymetrics.io/), use the following configuration:
77+
78+
instances: 1,
79+
exec_mode: 'fork',
80+
81+
And then edit your main JS file to include the clustering code, similar to
82+
[this example](https://github.com/express-rate-limit/cluster-memory-store/blob/8745cb4da4035f84255e1c0146951a0fe2fbcc10/example/server.js).
83+
84+
This looses some of the benefits of using PM2, because it can no longer directly
85+
manage worker processes.
86+
87+
### Gatling
88+
89+
[Gatling](https://www.npmjs.com/package/gatling) is not currently compatibile
90+
with `cluster-memory-store`.
91+
6892
## Issues and Contributing
6993

7094
If you encounter a bug or want to see something added/changed, please go ahead

0 commit comments

Comments
 (0)