influxdb/pkg
WeblWabl 06ab224516
fix(influxd): update xxhash, avoid stringtoslicebyte in cache (#578) (#25622)
* 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>
2024-12-05 16:57:26 -06:00
..
binaryutil
bloom fix(influxd): update xxhash, avoid stringtoslicebyte in cache (#578) (#25622) 2024-12-05 16:57:26 -06:00
bytesutil
cmputil build: upgrade to Go 1.18.1 (#23252) 2022-04-13 15:24:27 -05:00
data/gen chore: move v2/v1/tsdb → v2/tsdb 2020-08-26 10:46:47 -07:00
deep build: upgrade to Go 1.18.1 (#23252) 2022-04-13 15:24:27 -05:00
durablequeue test: use `T.TempDir` to create temporary test directory (#23258) 2023-03-21 16:22:11 -04:00
encoding/simple8b chore: update to go 1.20 (#24088) 2023-02-09 14:14:35 -05:00
errors chore: update to go 1.20 (#24088) 2023-02-09 14:14:35 -05:00
escape chore(tsdb): Initial commit of tsdb package 2020-08-03 09:17:23 -07:00
estimator fix(influxd): update xxhash, avoid stringtoslicebyte in cache (#578) (#25622) 2024-12-05 16:57:26 -06:00
file build: upgrade to Go 1.18.1 (#23252) 2022-04-13 15:24:27 -05:00
fs feat: disable file:// urls when hardening enabled (#24858) 2024-06-17 17:33:48 -05:00
httpc build: upgrade to Go 1.18.1 (#23252) 2022-04-13 15:24:27 -05:00
jsonnet build: upgrade to Go 1.18.1 (#23252) 2022-04-13 15:24:27 -05:00
jsonparser fix: more expressive errors (#22448) 2021-09-13 15:12:35 -04:00
limiter build: upgrade to Go 1.18.1 (#23252) 2022-04-13 15:24:27 -05:00
metrics chore: update staticcheck and fix newly identified lint checks (#18737) 2020-06-26 18:54:09 -05:00
mincore build: upgrade to Go 1.18.1 (#23252) 2022-04-13 15:24:27 -05:00
mmap fix: fully clean up partially opened TSI (#23430) (#23454) 2022-06-14 11:49:16 -07:00
pointer
pool fix(tsm1): limit concurrent WAL encodings to reduce memory pressure under heavy write load (#20814) 2021-06-03 16:11:36 -04:00
radix chore(tsdb): Initial commit of tsdb package 2020-08-03 09:17:23 -07:00
reporthelper feat: port report-db command from 1.x (#23922) 2022-11-21 11:23:13 -05:00
rhh fix(influxd): update xxhash, avoid stringtoslicebyte in cache (#578) (#25622) 2024-12-05 16:57:26 -06:00
slices chore: upgrade to go 1.21.6 (main-2.x) (#24709) 2024-03-05 12:58:59 -05:00
snowflake
tar chore: remove duplicate word in comments (#23685) 2022-09-13 11:00:52 -05:00
testing/assert
testttp
tracing chore: update google.golang.org/protobuf to 1.33.0 (#24940) 2024-05-01 10:16:23 -04:00