Create server-wide toke map. #186

Closed
opened 2025-10-11 08:07:25 -04:00 by rainbownapkin · 4 comments

Tokebot profile currently calculates out toke counts from the toke log. This is fine for smaller toke counts, but starts to show scaling issues, even when just handling existing tokes from our legacy site.

The statistics document should have a toke map, similar to standard user toke maps, which contain toke counts keyed by the command they're counting the usage of.

While it would technically be double-storing info, it would reduce the server-side computational complexity of rendering out tokebots user profile DRASTICALLY.

Tokebot profile currently calculates out toke counts from the toke log. This is fine for smaller toke counts, but starts to show scaling issues, even when just handling existing tokes from our legacy site. The statistics document should have a toke map, similar to standard user toke maps, which contain toke counts keyed by the command they're counting the usage of. While it would technically be double-storing info, it would reduce the server-side computational complexity of rendering out tokebots user profile DRASTICALLY.
rainbownapkin added this to the Canopy v0.4-Indev milestone 2025-10-11 08:07:25 -04:00
rainbownapkin added the
Cleanup/Refactor
Performance Improvement
labels 2025-10-11 08:07:25 -04:00
rainbownapkin added a new dependency 2025-10-11 08:08:17 -04:00
Author
Owner

Looks like the tokebot part of userSchema.statics.findProfile needed tuning.

Calculating the tokemap wasn't the issue, and actually seems to be just as fast, if not faster, than pulling a map out of the stat document.

We probably need to drop the toke log from the stat document and make it it's own collection if we want to pull the stat doc any faster.

Looks like the tokebot part of userSchema.statics.findProfile needed tuning. Calculating the tokemap wasn't the issue, and actually seems to be just as fast, if not faster, than pulling a map out of the stat document. We probably need to drop the toke log from the stat document and make it it's own collection if we want to pull the stat doc any faster.
Author
Owner

Refactored userSchema.statics.findProfile()'s tokebot profile generation procedure: 42ad17072f

Refactored userSchema.statics.findProfile()'s tokebot profile generation procedure: 42ad17072f
rainbownapkin added a new dependency 2025-10-11 09:45:31 -04:00
Author
Owner

Once toke logs are migrated to a dedicated portion of the DB, and tokebot profile pulls off of a minimized tokemap from the stats DB, we should consider caching certain server-side stats in RAM for quicker access.

Once toke logs are migrated to a dedicated portion of the DB, and tokebot profile pulls off of a minimized tokemap from the stats DB, we should consider caching certain server-side stats in RAM for quicker access.
Author
Owner

Bad way of handling this. #187 makes more sense :P

Bad way of handling this. #187 makes more sense :P
rainbownapkin removed a dependency 2025-10-12 20:35:19 -04:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
#161 DB Dump Ingester
rainbownapkin/canopy
Reference: rainbownapkin/canopy#186
No description provided.