influxdb/pkg
WeblWabl 45a8227ad6
fix(influxd): update xxhash, avoid stringtoslicebyte in cache (#578) (#25622) (#25624)
* fix(influxd): update xxhash, avoid stringtoslicebyte in cache (#578)

* fix(influxd): update xxhash, avoid stringtoslicebyte in cache

This commit does 3 things:

* it updates xxhash from v1 to v2; v2 includes a assembly arm version of
  Sum64
* it changes the cache storer to write with a string key instead of a
  byte slice. The cache only reads the key which WriteMulti already has
as a string so we can avoid a host of allocations when converting back
and forth from immutable strings to mutable byte slices. This includes
updating the cache ring and ring partition to write with a string key
* it updates the xxhash for finding the cache ring partition to use
Sum64String which uses unsafe pointers to directly use a string as a
byte slice since it only reads the string. Note: this now uses an
assembly version because of the v2 xxhash update. Go 1.22 included new
compiler ability to recognize calls of Method([]byte(myString)) and not
make a copy but from looking at the call sites, I'm not sure the
compiler would recognize it as the conversion to a byte slice was
happening several calls earlier.

That's what this change set does. If we are uncomfortable with any of
these, we can do fewer of them (for example, not upgrade xxhash; and/or
not use the specialized Sum64String, etc).

For the performance issue in maz-rr, I see converting string keys to
byte slices taking between 3-5% of cpu usage on both the primary and
secondary. So while this pr doesn't address directly the increased cpu
usage on the secondary, it makes cpu usage less on both which still
feels like a win. I believe these changes are easier to review that
switching to a byte slice pool that is likely needed in other places as
the compiler provides nearly all of the correctness checks we need (we
are relying also on xxhash v2 being correct).

* helps #550

* chore: fix tests/lint

* chore: don't use assembly version; should inline

This 2 line change causes xxhash to use a purego Sum64 implementation
which allows the compiler to see that Sum64 only read the byte slice
input which them means is can skip the string to byte slice allocation
and since it can skip that, it should inline all the calls to
getPartitionStringKey and Sum64 avoiding 1 call to Sum64String which
isn't inlined.

* chore: update ci build file

the ci build doesn't use the make file!!!

* chore: revert "chore: update ci build file"

This reverts commit 94be66fde03e0bbe18004aab25c0e19051406de2.

* chore: revert "chore: don't use assembly version; should inline"

This reverts commit 67d8d06c02e17e91ba643a2991e30a49308a5283.

(cherry picked from commit 1d334c679ca025645ed93518b7832ae676499cd2)

* feat: need to update go sum

---------

Co-authored-by: Phil Bracikowski <13472206+philjb@users.noreply.github.com>
(cherry picked from commit 06ab224516)
2024-12-06 16:05:03 -06:00
..
binaryutil Partition series file. 2018-01-10 08:33:25 -07:00
bloom fix(influxd): update xxhash, avoid stringtoslicebyte in cache (#578) (#25622) (#25624) 2024-12-06 16:05:03 -06:00
bytesutil Cleanup pkg package 2018-01-21 12:08:25 -08:00
data/gen chore: update protobuf library versions and remove influx_tsm (#21882) 2021-07-20 09:42:52 -04:00
deep build: upgrade to go1.18 (#23250) 2022-03-31 16:17:57 -05:00
encoding/simple8b chore: upgrade Go to v1.19.3 (1.x) (#23941) 2022-11-28 12:15:47 -05:00
errors chore: upgrade Go to v1.19.3 (1.x) (#23941) 2022-11-28 12:15:47 -05:00
escape pkg/escape: Add benchmarks for all bytes escape/unescape funcs 2018-01-16 11:12:47 +13:00
estimator fix(influxd): update xxhash, avoid stringtoslicebyte in cache (#578) (#25622) (#25624) 2024-12-06 16:05:03 -06:00
file fix: add tests for file rename across volumes (#23787) 2022-10-13 09:26:59 -07:00
limiter build: upgrade to go1.18 (#23250) 2022-03-31 16:17:57 -05:00
metrics fix: address static check warning s1039 (#18135) 2020-05-18 13:55:05 -04:00
mmap fix: fully clean up partially opened TSI (#23430) 2022-06-10 11:31:29 -07:00
pool Cleanup pkg package 2018-01-21 12:08:25 -08:00
pprofutil Fix retain/release hang issues. 2017-12-06 09:09:41 -07:00
radix inmem: use radix sort for series ids 2018-07-17 12:31:12 -06:00
reporthelper chore: run goimports -w ./ 2021-01-29 11:40:02 -05:00
rhh fix(influxd): update xxhash, avoid stringtoslicebyte in cache (#578) (#25622) (#25624) 2024-12-06 16:05:03 -06:00
slices refactor: Change ToLower comparisons to EqualFold (#18147) 2020-05-18 19:46:59 -04:00
snowflake pkg/snowflake: be more robust against sequence rollover 2018-08-16 11:18:06 -06:00
tar chore: upgrade Go to v1.19.3 (1.x) (#23941) 2022-11-28 12:15:47 -05:00
testing/assert storage service 2017-10-25 13:38:07 -07:00
testttp chore: Add kit (#21086) 2021-03-30 13:09:04 -04:00
tlsconfig fix(tls): Enable configuration of TLS 1.3 (#20939) 2021-03-12 16:35:28 -05:00
tracing chore: upgrade protocol buffers to v5.26.1 (#24949) 2024-05-01 11:00:26 -07:00
README.md Correctly name pkg README 2015-12-17 11:24:58 -08:00

README.md

pkg/ is a collection of utility packages used by the InfluxDB project without being specific to its internals.

Utility packages are kept separate from the InfluxDB core codebase to keep it as small and concise as possible. If some utilities grow larger and their APIs stabilize, they may be moved to their own repository under the InfluxDB organization, to facilitate re-use by other projects. However that is not the priority.

Because utility packages are small and neatly separated from the rest of the codebase, they are a good place to start for aspiring maintainers and contributors. Get in touch if you want to help maintain them!