Skip to content

feat: use go-freelru consistently #16549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 10, 2025
Merged

Conversation

kruskall
Copy link
Member

@kruskall kruskall commented Apr 7, 2025

Motivation/summary

replace all lru cache deps with go-freelru

go-freelru requires a capacity so use a reasonable default

Checklist

For functional changes, consider:

  • Is it observable through the addition of either logging or metrics?
  • Is its use being published in telemetry to enable product improvement?
  • Have system tests been added to avoid regression?

How to test these changes

Related issues

Closes #16435

replace all lru cache deps with go-freelru

go-freelru requires a capacity so use a reasonable default
@kruskall kruskall requested a review from a team as a code owner April 7, 2025 13:37
Copy link
Contributor

mergify bot commented Apr 7, 2025

This pull request does not have a backport label. Could you fix it @kruskall? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-7.17 is the label to automatically backport to the 7.17 branch.
  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit.
  • backport-9./d is the label to automatically backport to the 9./d branch. /d is the digit.
  • backport-8.x is the label to automatically backport to the 8.x branch.
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

1pkg
1pkg previously approved these changes Apr 9, 2025
Copy link
Contributor

mergify bot commented Apr 9, 2025

This pull request is now in conflicts. Could you fix it @kruskall? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b feat/standard-cache upstream/feat/standard-cache
git merge upstream/main
git push upstream feat/standard-cache

@kruskall kruskall enabled auto-merge (squash) April 10, 2025 08:34
@kruskall kruskall merged commit e0c9eda into elastic:main Apr 10, 2025
15 checks passed
@kruskall kruskall deleted the feat/standard-cache branch April 10, 2025 08:39
@kruskall
Copy link
Member Author

@Mergifyio backport 8.19

Copy link
Contributor

mergify bot commented Jun 11, 2025

backport 8.19

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Jun 11, 2025
* feat: use go-freelru consistently

replace all lru cache deps with go-freelru

go-freelru requires a capacity so use a reasonable default

* lint: update notice file

* lint: run make fmt

* lint: remove unused code

(cherry picked from commit e0c9eda)

# Conflicts:
#	NOTICE-fips.txt
#	NOTICE.txt
#	go.mod
#	go.sum
#	internal/agentcfg/cache_test.go
#	internal/agentcfg/kibana.go
mergify bot added a commit that referenced this pull request Jun 11, 2025
* feat: use go-freelru consistently (#16549)

* feat: use go-freelru consistently

replace all lru cache deps with go-freelru

go-freelru requires a capacity so use a reasonable default

* lint: update notice file

* lint: run make fmt

* lint: remove unused code

(cherry picked from commit e0c9eda)

# Conflicts:
#	NOTICE-fips.txt
#	NOTICE.txt
#	go.mod
#	go.sum
#	internal/agentcfg/cache_test.go
#	internal/agentcfg/kibana.go

* Update cache_test.go

* Update kibana.go

* lint: run go mod tidy

---------

Co-authored-by: kruskall <99559985+kruskall@users.noreply.github.com>
@simitt
Copy link
Contributor

simitt commented Jun 12, 2025

@kruskall what are the performance and change in resource usage implications from this PR?

@kruskall
Copy link
Member Author

performance didn't change much, this is mostly to drop deprecated/unmaintained libraries

@rubvs rubvs mentioned this pull request Jun 17, 2025
17 tasks
@1pkg
Copy link
Member

1pkg commented Jun 23, 2025

Tested for presence of the cache packages in the binary.

For any version before 9.1, e.g. v9.0.1.

go version -m build/apm-server-darwin-arm64 | grep -e cache -e golang-lru
        dep     github.com/hashicorp/golang-lru v1.0.2  h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c=
        dep     github.com/patrickmn/go-cache   v2.1.0+incompatible     h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=

For 9.1

go version -m build/apm-server-darwin-arm64 | grep -e cache -e golang-lru


go version -m build/apm-server-darwin-arm64 | grep go-freelru                                         
        dep     github.com/elastic/go-freelru   v0.16.0 h1:gG2HJ1WXN2tNl5/p40JS/l59HjvjRhjyAa+oFTRArYs=

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

drop golang-lru and align on one lru cache library
3 participants