Commit Graph

101 Commits

Author SHA1 Message Date
tidwall b7674349cf Updated btree library 2021-08-23 07:33:57 -07:00
tidwall 5c21d1277f Update buntdb 2021-08-04 14:47:09 -07:00
tidwall 17ab07bd3e Update tidwall dependencies 2021-07-31 07:45:09 -07:00
tidwall 694ad1fb62 Update btree/buntdb 2021-07-31 07:42:58 -07:00
tidwall afd77d9448 Update nats-server dependency
Dependabot alert
2021-07-29 17:23:41 -07:00
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 22c4a05f03 vendor dir 2021-07-08 06:46:28 -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
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 c567512600 Fix packages not vendoring on build 2020-02-11 11:02:15 -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 cfc65a13f6 Refactor repository and build scripts
This commit includes updates that affects the build, testing, and
deployment of Tile38.

- The root level build.sh has been broken up into multiple scripts
  and placed in the "scripts" directory.

- The vendor directory has been updated to follow the Go modules
  rules, thus `make` should work on isolated environments. Also
  some vendored packages may have been updated to a later
  version, if needed.

- The Makefile has been updated to allow for making single
  binaries such as `make tile38-server`. There is some scaffolding
  during the build process, so from now on all binaries should be
  made using make. For example, to run a development version of
  the tile38-cli binary, do this:
     make tile38-cli && ./tile38-cli
  not this:
     go run cmd/tile38-cli/main.go

- Travis.CI docker push script has been updated to address a
  change to Docker's JSON repo meta output, which in turn fixes
  a bug where new Tile38 versions were not being properly pushed
  to Docker
2019-11-18 10:33:15 -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
tidwall 23b016d192 Fix excessive memory usage for objects with TTLs
This commit fixes an issue where Tile38 was using lots of extra
memory to track objects that are marked to expire. This was
creating problems with applications that set big TTLs.

How it worked before:

Every collection had a unique hashmap that stores expiration
timestamps for every object in that collection. Along with
the hashmaps, there's also one big server-wide list that gets
appended every time a new SET+EX is performed.

From a background routine, this list is looped over at least
10 times per second and is randomly searched for potential
candidates that might need expiring. The routine then removes
those entries from the list and tests if the objects matching
the entries have actually expired. If so, these objects are
deleted them from the database. When at least 25% of
the 20 candidates are deleted the loop is immediately
continued, otherwise the loop backs off with a 100ms pause.

Why this was a problem.

The list grows one entry for every SET+EX. When TTLs are long,
like 24-hours or more, it would take at least that much time
before the entry is removed. So for databased that have objects
that use TTLs and are updated often this could lead to a very
large list.

How it was fixed.

The list was removed and the hashmap is now search randomly. This
required a new hashmap implementation, as the built-in Go map
does not provide an operation for randomly geting entries. The
chosen implementation is a robinhood-hash because it provides
open-addressing, which makes for simple random bucket selections.

Issue #502
2019-10-29 11:19:33 -07:00
tidwall 5abadd72a3 Updated geoindex 2019-09-19 11:30:49 -07:00
tidwall 639f6e2deb Replaced boxtree for rbang 2019-09-12 18:42:53 -07:00
tidwall 54f14d8b03 Updated gjson library 2019-08-15 06:08:38 -07:00
tidwall 85b70e0d26 Updated geojson package 2019-06-28 10:01:12 -07:00
tidwall 3ae59274e3 Removed evio option 2019-04-26 11:50:49 -07:00
Josh Baker 55a175c767
Merge pull request #430 from tidwall/sqs-update
SQS Credentials Updates
2019-03-14 12:50:53 -07:00
tidwall 5ae1a76450 Updated dependencies 2019-03-14 09:55:31 -07:00
tidwall 4e656ad19b Fixed nearby inaccuracy with geofence
Closes #431
2019-03-12 14:38:05 -07:00
tidwall 3e64497a51 Update aws-sdk-go package 2019-03-11 09:18:55 -07:00
tidwall 30f903bd51 Require properties member for geojson features 2019-02-12 06:49:13 -07:00
tidwall 92c1ce8ef9 Update tinybtree dep 2019-02-11 13:39:29 -07:00
Steven Wolfe 1e775bf59b Adding ARM and ARM64 packages 2019-01-14 12:38:11 -07:00
Steve Lacy 74809188f6
Update geojson dependency 2019-01-10 09:37:20 -07:00
tidwall c75a144b83 Fixed MultiPolygon intersect failure
close #394
2018-12-03 17:19:18 -07:00
tidwall d8b813a423 Added redigo vendor 2018-12-03 16:12:55 -07:00
tidwall 1bdc2135d7 Update geojson vendor 2018-11-11 09:33:58 -07:00
tidwall a160fa0860 wip: cricle 2018-11-11 09:05:26 -07:00