storj/scripts
Jessica Grebenschikov 4a2c66fa06 satellite/accounting: add cache for getting project storage and bw limits
This PR adds the following items:
1) an in-memory read-only cache thats stores project limit info for projectIDs

This cache is stored in-memory since this is expected to be a small amount of data. In this implementation we are only storing in the cache projects that have been accessed. Currently for the largest Satellite (eu-west) there is about 4500 total projects. So storing the storage limit (int64) and the bandwidth limit (int64), this would end up being about 200kb (including the 32 byte project ID) if all 4500 projectIDs were in the cache. So this all fits in memory for the time being. At some point it may not as usage grows, but that seems years out.

The cache is a read only cache. When requests come in to upload/download a file, we will read from the cache what the current limits are for that project. If the cache does not contain the projectID, it will get the info from the database (satellitedb project table), then add it to the cache.

The only time the values in the cache are modified is when either a) the project ID is not in the cache, or b) the item in the cache has expired (default 10mins), then the data gets refreshed out of the database. This occurs by default every 10 mins. This means that if we update the usage limits in the database, that change might not show up in the cache for 10 mins which mean it will not be reflected to limit end users uploading/downloading files for that time period..

Change-Id: I3fd7056cf963676009834fcbcf9c4a0922ca4a8f
2020-09-25 16:28:49 +00:00
..
testdata satellite/accounting: add cache for getting project storage and bw limits 2020-09-25 16:28:49 +00:00
tests satellite/testing: Change testing to use PG 12.3 (#3913) 2020-06-25 20:17:39 +03:00
waitlist Waitlist script (#573) 2018-11-06 18:43:20 +01:00
cert-gating.sh Delete Bootstrap and Kademlia (#2974) 2019-10-04 16:48:41 -04:00
check-satellite-config-lock.sh Update Notification Text to new process (#2120) 2019-06-04 22:43:07 -04:00
deploy-storagenode.sh scripts/deploy-storagenode: tag docker image as latest (#3858) 2020-04-18 11:59:56 +02:00
deploy-watchtower.sh Script for deploying the Docker manifest for watchtower (#3015) 2019-09-12 17:38:48 +03:00
gerrit-cla.py gerrit: add cla 2019-06-19 18:28:53 +00:00
install-awscli.sh Travis with go1.11 and modules (#479) 2018-10-16 20:02:00 +03:00
pg-to-crdb.go all: fix comments 2020-07-16 19:13:14 +03:00
postgres-dev.sh satellite/testing: Change testing to use PG 12.3 (#3913) 2020-06-25 20:17:39 +03:00
release.sh storj: remove storj/private/version package which was moved to 2020-03-24 14:31:33 +00:00
tag-release.sh private/version: minimal fix for tag-release.sh 2020-04-01 13:46:45 +00:00
test-backwards.sh scripts: reduce file size for backward compatibility tests 2020-05-27 13:21:55 +00:00
test-billing.sh satellite/payments: delete credits and credits_spendings db tables 2020-07-30 12:19:57 +03:00
test-certificates.sh fix certificates auth export command (#3110) 2019-09-24 10:38:18 -06:00
test-network-stalls.go all: fix dots 2020-07-16 14:58:28 +00:00
test-sim-backwards-dev.sh scripts: use postgres script with all tests (#3404) 2019-10-31 07:03:54 -07:00
test-sim-backwards.sh scripts: reduce file size for backward compatibility tests 2020-05-27 13:21:55 +00:00
test-sim-dev.sh scripts: use postgres script with all tests (#3404) 2019-10-31 07:03:54 -07:00
test-sim.sh cmd/satellite: choose correct Stripe client also for commands 2020-06-15 11:03:14 +00:00
test-uplink-share.sh scripts/tests: uplink no longer respects --client.segment-size 2020-03-22 17:48:57 +00:00
test-uplink.sh cmd/uplink: use DeleteBucketWithObjects for bucket force deletion 2020-09-02 16:39:20 +00:00
update-access.go scripts: remove lib/uplink from update-access 2020-05-29 13:35:10 +03:00
update-satellite-config-lock.sh scripts: Fix warn message update sat config lock (#3029) 2019-09-12 18:10:22 +02:00
utils.sh cmd/certificates: auth export improvements & certificates test script (#2897) 2019-09-04 19:58:38 +02:00