Skip to content

Support adjusting the number of file description #6707

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

22fortisetliber
Copy link

@22fortisetliber 22fortisetliber commented Apr 17, 2025

What this PR does:

in Kubernetes environment, adjusting the maximum number of open files could be challenging . This change add CORTEX_ULIMIT_NOFILES environment variable to configure ulimit for the Cortex process.

Which issue(s) this PR fixes:
#6709

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Copy link
Member

@friedrichg friedrichg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Can you create an issue for this?

we do recommend increasing NOFILES in some cases.
https://cortexmetrics.io/docs/blocks-storage/production-tips/#ensure-a-high-number-of-max-open-file-descriptors

But we fail to say how. I think because it's highly dependent on your orchestration for the container (docker, kubernetes, etc)

if [ "$current_limit" != "unlimited" ]; then
if [ $CORTEX_ULIMIT_NOFILES -gt $current_limit ]; then
echo "Setting file description limit to $CORTEX_ULIMIT_NOFILES"
ulimit -n $CORTEX_ULIMIT_NOFILES
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ulimit -n modifies the soft limit only.
Go always matches the soft limit to the hard nofile limit. See golang/go#46279.
Go/cortex runtime will ignore this and use the hard limit

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow, TIL, thanks a lot. Changed to hard limit. Also i already created issue #6709 for this one.

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

Successfully merging this pull request may close these issues.

2 participants