crud-service icon indicating copy to clipboard operation
crud-service copied to clipboard

Better default for `MONGODB_MAX_IDLE_TIME_MS`

Open fredmaggiowski opened this issue 1 year ago • 0 comments

Feature Description

Since the resolution of #224 (with PR #225 and #227) we have the new MONGODB_MAX_IDLE_TIME_MS env variable to set the maxIdleTimeMs MongoDB connection option.

The current default value is aligned to the driver specification default which is 0, meaning that connection are always kept alive once opened.

While for drivers this might make sense (I've asked them some clarification), I think that for our service we could provide some default value that makes sense without overloading the MongoDB cluster with opened connections.

I propose two approaches:

  • aggressive connection removal: set the value to 1s (or even lower 500ms?)
  • garbage collection approach: set the value to something like 4h (or even more: 12h/24h?)

Additional context

This change is breaking so I'd try to land it before v7

fredmaggiowski avatar Nov 22 '23 14:11 fredmaggiowski