-
Notifications
You must be signed in to change notification settings - Fork 502
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
feat: Add scalar storage support for DynamoDB #531
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: gauthamchandra The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Welcome @gauthamchandra! It looks like this is your first PR to zilliztech/GPTCache 🎉 |
Signed-off-by: Gautham Chandra <gautham.chandra@live.com>
1587ffb
to
0ccdb2e
Compare
Sorry for the failing tests. My latest changes should hopefully fix the issue. 🙏🏼 |
This change allows GPTCache to use DynamoDB as the underlying scalar storage for the cache. The underlying implementation uses 2 tables: - `gptcache_questions` - which holds all questions and session information. - `gptcache_reports` - which holds the reporting information. Normally, we would do a single table design and rollup `gptcache_reports` into the same table as `gptcache_questions`. However, this was not done for one key reason: billing. In the event a lot of analytics data is being created, then table scans for operations like `count()` and `get_ids()` would also involve reading these reporting rows before filtering them out, resulting in higher read costs for end users of GPTCache. Signed-off-by: Gautham Chandra <gautham.chandra@live.com>
It seems a totally unrelated test is failing. Might be finicky 🤔 |
@gauthamchandra thanks your patience, and i will fix it in the next pr |
Has this been released? can we use dynamodb now as a storage for caching? I can't see in the documentation anywhere? |
yes, you can. the usage is like other cache storage, and its params include:
|
@mikeblackk, just want to clarify that it uses As a result, it relies on the standard AWS resolution logic (so if you have ENV vars like Let me know if you run into any issues. I am not an expert on Dynamo by any means so there might be issues which need to be fixed 😄 |
This change allows GPTCache to use DynamoDB as the underlying scalar
storage for the cache. Addresses #200
The underlying implementation uses 2 tables:
gptcache_questions
- which holds all questions and sessioninformation.
gptcache_reports
- which holds the reporting information.Normally, we would do a single table design and rollup
gptcache_reports
into the same table asgptcache_questions
. However,this was not done for one key reason: billing.
In the event a lot of analytics data is being created, then table scans
for operations like
count()
andget_ids()
would also involve readingthese reporting rows before filtering them out, resulting in higher
read costs for end users of GPTCache.
Preview of what the tables look like:
gpt_cache
tableSecondary Indexes:
gsi_items_by_type:
gsi_questions_by_deletion_status: