Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local cache for PostgreSQL driver #3828

Open
wants to merge 3 commits into
base: V3/develop
Choose a base branch
from

Conversation

Tobotimus
Copy link
Member

Type

  • Enhancement

Description of the changes

I'm back! In some capacity at least...

I decided to whip up a cache for the Postgres driver. In theory this cache is generic and could be its own layer above all drivers, I didn't want to change anything about the JSON driver, and for now, Postgres is the only other one :)

The cache is an LRU cache, which scales up and down in size based on the number of cogs loaded (read: drivers instantiated). Its max size per cog is admittedly somewhat arbitrary and meaningless, considering the values stored in the cache could range from single bools to massive dicts. However I think it's better to get something working and process-efficient out there rather than get stuck on a cache-sizing issue, and this is still bound to be a lot more memory-efficient than the JSON driver.

I'm interested to hear what people's experiences are with regards to this, especially on large bots. I haven't actually done any performance testing, but anecdotally it seems a lot faster ;)

@Tobotimus Tobotimus added Type: Enhancement Something meant to enhance existing Red features. Changelog Entry: Pending Changelog entry for this PR hasn't been added by repo maintainers yet. Category: Core - API - Config This is related to the `redbot.core.config` module and `redbot.core.drivers` package. labels May 7, 2020
# Conflicts:
#	redbot/core/drivers/base.py
@Jackenmen Jackenmen added the Type: Optimisation Situations where too much time is necessary to complete the task. label May 10, 2020
@Jackenmen Jackenmen removed the Changelog Entry: Pending Changelog entry for this PR hasn't been added by repo maintainers yet. label Jun 22, 2020
@Jackenmen Jackenmen added this to the Backlog milestone Jul 6, 2020
@Drapersniper Drapersniper modified the milestones: Backlog, 3.5.0 May 25, 2021
@Jackenmen Jackenmen modified the milestones: 3.5.0, 3.4.x Jun 25, 2021
@github-actions github-actions bot added Category: Tests Category: Core - API - Utils Package This is related to stuff in `redbot.core.utils` labels Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Core - API - Config This is related to the `redbot.core.config` module and `redbot.core.drivers` package. Category: Core - API - Utils Package This is related to stuff in `redbot.core.utils` Type: Enhancement Something meant to enhance existing Red features. Type: Optimisation Situations where too much time is necessary to complete the task.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants