tile38/internal/server
tidwall 9e68703841 Update expiration logic
This commit changes the logic for managing the expiration of
objects in the database.

Before: There was a server-wide hashmap that stored the
collection key, id, and expiration timestamp for all objects
that had a TTL. The hashmap was occasionally probed at 20
random positions, looking for objects that have expired. Those
expired objects were immediately deleted, and if there was 5
or more objects deleted, then the probe happened again, with
no delay. If the number of objects was less than 5 then the
there was a 1/10th of a second delay before the next probe.

Now: Rather than a server-wide hashmap, each collection has
its own ordered priority queue that stores objects with TTLs.
Rather than probing, there is a background routine that
executes every 1/10th of a second, which pops the expired
objects from the collection queues, and deletes them.

The collection/queue method is a more stable approach than
the hashmap/probing method. With probing, we can run into
major cache misses for some cases where there is wide
TTL duration, such as in the hours or days. This may cause
the system to occasionally fall behind, leaving should-be
expired objects in memory. Using a queue, there is no
cache misses, all objects that should be expired will be
right away, regardless of the TTL durations.

Fixes #616
2021-07-12 13:37:50 -07:00
..
aof.go Close follower files before finishing aofshrink 2021-06-13 07:53:27 -07:00
aofmigrate.go Code cleanup 2021-03-31 08:13:44 -07:00
aofshrink.go Update expiration logic 2021-07-12 13:37:50 -07:00
atomic.go Removed unused atomics 2018-11-23 01:39:04 -07:00
atomic_test.go Replaced net package with evio 2018-10-28 15:51:47 -07:00
bson.go Replaced net package with evio 2018-10-28 15:51:47 -07:00
checksum.go Code cleanup 2019-10-30 10:17:59 -07:00
client.go Code cleanup 2021-03-31 08:13:44 -07:00
config.go Code cleanup 2021-03-31 08:13:44 -07:00
crud.go Update expiration logic 2021-07-12 13:37:50 -07:00
dev.go Update expiration logic 2021-07-12 13:37:50 -07:00
expire.go Update expiration logic 2021-07-12 13:37:50 -07:00
expression.go Code cleanup 2019-10-30 10:17:59 -07:00
fence.go Update expiration logic 2021-07-12 13:37:50 -07:00
follow.go Code cleanup 2021-03-31 08:13:44 -07:00
hooks.go Code cleanup 2021-03-31 08:13:44 -07:00
json.go Update expiration logic 2021-07-12 13:37:50 -07:00
json_test.go Code cleanup 2019-10-30 10:17:59 -07:00
keys.go Code cleanup 2021-03-31 08:13:44 -07:00
live.go Added MONITOR command 2020-08-12 12:38:52 -07:00
metrics.go add more metrics, add metrics index page 2021-05-13 21:14:05 -04:00
monitor.go Code cleanup 2021-03-31 08:13:44 -07:00
output.go Code cleanup 2021-03-31 08:13:44 -07:00
pubsub.go Code cleanup 2021-03-31 08:13:44 -07:00
readonly.go Code cleanup 2019-10-30 10:17:59 -07:00
respconn.go Replaced net package with evio 2018-10-28 15:51:47 -07:00
scan.go Code cleanup 2021-03-31 08:13:44 -07:00
scanner.go Fix last merge 2021-07-11 10:09:51 -07:00
scanner_test.go Map field names to array indices in scanwriter, once per query. 2020-03-25 15:15:06 -07:00
scripts.go Update expiration logic 2021-07-12 13:37:50 -07:00
search.go Update expiration logic 2021-07-12 13:37:50 -07:00
server.go Update expiration logic 2021-07-12 13:37:50 -07:00
stats.go Fix invalid healthz output 2021-06-09 10:55:07 -07:00
stats_cpu.go Fix go vet error in stats_cpu.go for non-linux/darwin builds 2019-10-28 22:39:27 -03:00
stats_cpu_darlin.go Code cleanup 2019-10-30 10:17:59 -07:00
test.go Update expiration logic 2021-07-12 13:37:50 -07:00
token.go Merge branch 'rshura-optimize-field-match' 2021-07-10 17:59:22 -07:00
token_test.go Replaced net package with evio 2018-10-28 15:51:47 -07:00