Commit Graph

27 Commits

Author SHA1 Message Date
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
tidwall e60cbac7cf Merge distance updates 2021-07-08 07:03:36 -07:00
Mathieu 55e503c378 Add sasl 2021-07-08 06:46:57 -07:00
tidwall 5b3aeb5db7 add prometheus metrics endpoint 2021-07-08 06:46:52 -07:00
tidwall 48b46f2752 Update btree 2021-07-08 06:46:13 -07:00
tidwall 189de6496a Update BuntDB 2021-07-08 06:46:13 -07:00
tidwall 58221adccb Code cleanup
- Removed unused functions and variables
- Wrapped client formatted errors
- Updated deprecated packages
- Changed suggested code patterns
2021-07-08 06:46:08 -07:00
tidwall 6a55c8de8f fix: distance if point and object have the same coordinates 2021-07-08 06:45:31 -07:00
tidwall eb407ab125 Fix invalid queue.db error 2021-07-08 06:36:45 -07:00
tidwall 5bbe2c3166 Upgrade go.mod 2021-07-08 06:36:41 -07:00
tidwall 657bbd80ca Upgrade gjson 2021-07-08 06:36:23 -07:00
tidwall 60678020fa Updated dependencies 2021-07-08 06:36:10 -07:00
tidwall d209edbd59 Updated rtree library 2021-07-08 06:36:10 -07:00
tidwall afd51f5dae Updated rtree library 2021-07-08 06:36:10 -07:00
tidwall 094d35757c Various updates
- Updated all dependencies
- Updated geoindex Box api
2021-07-08 06:36:05 -07:00
tidwall c313a63603 Updated packages 2021-07-08 06:35:43 -07:00
tidwall f44bae43ca Replace tinybtree 2021-07-08 06:35:15 -07:00
tidwall 076cd4b009 Updated btree deps 2021-07-08 06:35:01 -07:00
tidwall e00d9763a6 Updated dependencies 2021-07-08 06:34:44 -07:00
tidwall 03662bb1fb Updated Kafka client 2021-07-08 06:34:09 -07:00
Mads Schou-Andreasen 37224791f4 added geofence webhook for GCP Pubsub 2020-05-19 17:11:31 +02:00
tidwall b3dc025545 Optimize point in ring 2020-03-25 15:07:14 -07:00
tidwall 957233c298 Fixed issue with some features not working with WITHIN
This bug was fixed in the geojson dependency.

https://github.com/tidwall/geojson/pull/15

Closed #539
2020-03-21 17:38:14 -07:00
tidwall 2f907bd4c0 Update geojson
Fixes #529
2020-02-10 05:18:52 -07:00
tidwall 6f3716a0cf Fixes a false negative for intersecting rings
https://github.com/tidwall/geojson/commit/ac08098
2019-11-28 10:13:00 -07:00
tidwall 4b17a1b828 Nuke vendor directory 2019-11-17 15:01:07 -07:00
tidwall b27f32a66e Updated to Go modules 2019-11-17 14:38:27 -07:00