Runtime: Plain docker running as root
Docker image: fmartinou/whats-up-docker:6.3.0
The issue
I've run into an issue with my instance of whats-up-docker running extremely slowly and poorly. It was basically constantly pegging a cpu core. Furthermore, the app became so slow it was mostly unusable. It would take upwards of 30s for containers to load at all on the web ui. After taking a look with a profiler (command: "node --prof index") I've discovered that:
The backing LokiJS store was responsible for almost all of the load. Specifically the comparator (from reindexing/searching) and the serializer (from auto-saving the database).
The backing store is a simple json file. After inspecting it, I had 1 single entry in app collection, 200 or so entries (as expected) in the containers, but 290k+ of entries in "Sessions" collection.
Turns out that the Express Session connector to loki also persists the session cookies for authentication purposes.
Vast majority of the session entries are from basic-auth for API calls performed by Prometheus for metrics collection.
Now the 2 major issues here are:
The session entries are never pruned from the store which makes all store operation with them slower and slower in memory.
All API calls result in sessions being looked up or stored. External agents like prometheus do not reuse the session and since they can call very frequently many sessions can accumulate quickly.
I can kludge a workaround to clear the sessions collection every once in a while in the meantime to avoid this issue, but in app periodic pruning should address this issue, i.e. remove all expired session entries once an hour and once at the start.
On a side note, I have noticed that LokiJS is now replaced by RxDB and the project is basically dead since 2022. Might want to migrate away from it in the future.
Environment
Runtime: Plain docker running as root Docker image: fmartinou/whats-up-docker:6.3.0
The issue
I've run into an issue with my instance of whats-up-docker running extremely slowly and poorly. It was basically constantly pegging a cpu core. Furthermore, the app became so slow it was mostly unusable. It would take upwards of 30s for containers to load at all on the web ui. After taking a look with a profiler (
command: "node --prof index"
) I've discovered that:Now the 2 major issues here are:
I can kludge a workaround to clear the sessions collection every once in a while in the meantime to avoid this issue, but in app periodic pruning should address this issue, i.e. remove all expired session entries once an hour and once at the start.
On a side note, I have noticed that LokiJS is now replaced by RxDB and the project is basically dead since 2022. Might want to migrate away from it in the future.