many files descriptors open after m3dbnode restart
Please provide the following information along with a description of the issue that you're experiencing:
- What service is experiencing the issue? m3dbnode
- What is the configuration of the service? create namespace with below command, configuration see attachment
curl -X POST http://localhost:7201/api/v1/database/create -d '{
"type": "local",
"namespaceName": "default",
"retentionTime": "48h"
}'
m3dbnode-local-etcd.yml config:
coordinator:
listenAddress:
type: "config"
value: "0.0.0.0:7201"
local:
namespaces:
- namespace: default
type: unaggregated
retention: 48h
metrics:
scope:
prefix: "coordinator"
prometheus:
handlerPath: /metrics
listenAddress: 0.0.0.0:7203 # until https://github.com/m3db/m3/issues/682 is resolved
sanitization: prometheus
samplingRate: 1.0
extended: none
limits:
maxComputedDatapoints: 10000
tagOptions:
# Configuration setting for generating metric IDs from tags.
idScheme: quoted
db:
logging:
level: info
metrics:
prometheus:
handlerPath: /metrics
listenAddress: 0.0.0.0:7204 # until https://github.com/m3db/m3/issues/682 is resolved
sanitization: prometheus
samplingRate: 1.0
extended: detailed
listenAddress: 0.0.0.0:9000
clusterListenAddress: 0.0.0.0:9001
httpNodeListenAddress: 0.0.0.0:9002
httpClusterListenAddress: 0.0.0.0:9003
debugListenAddress: 0.0.0.0:9004
hostID:
resolver: config
value: m3db_local
client:
writeConsistencyLevel: majority
readConsistencyLevel: unstrict_majority
gcPercentage: 100
writeNewSeriesAsync: true
writeNewSeriesLimitPerSecond: 1048576
writeNewSeriesBackoffDuration: 2ms
bootstrap:
bootstrappers:
- filesystem
- commitlog
- peers
- uninitialized_topology
commitlog:
returnUnfulfilledForCorruptCommitLogFiles: false
cache:
series:
policy: lru
lru:
maxBlocks: 10
eventsChannelSize: 10
postingsList:
size: 262144
commitlog:
flushMaxBytes: 524288
flushEvery: 1s
queue:
calculationType: fixed
size: 2097152
fs:
filePathPrefix: /var/lib/m3db
config:
service:
env: default_env
zone: embedded
service: m3db
cacheDir: /var/lib/m3kv
etcdClusters:
- zone: embedded
endpoints:
- 127.0.0.1:2379
seedNodes:
initialCluster:
- hostID: m3db_local
endpoint: http://127.0.0.1:2380
# un-comment the lines below to enable Jaeger tracing. See https://www.jaegertracing.io/docs/1.9/getting-started/
# for quick local setup (which this config will send data to).
tracing:
backend: jaeger
- How are you using the service?Prometheus
- Is there a reliable way to reproduce the behavior? If so, please provide detailed instructions. with docker-compose:
- docker-compose up -d
- create database with cmd in issue 2
- after m3dbnode initliazation finished, run docker-compose restart m3db
- check the file descriptors m3dbnode open with below and the result is more than 8k
pgrep m3dbnode|xargs sudo lsof -p|wc -l
- configuration files as below(m3db configuation see above on 2): docker-compse.yml:
version: '2'
services:
prometheus:
image: prom/prometheus:v2.6.0
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- ./rule:/prometheus/rule/
ports:
- "9090:9090"
command: --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/prometheus --web.console.libraries=/usr/share/prometheus/console_libraries --web.console.templates=/usr/share/prometheus/consoles --web.enable-lifecycle
jaeger:
image: jaegertracing/all-in-one
ports:
- "5775:5775/udp"
- "6831:6831/udp"
- "6832:6832/udp"
- "5778:5778"
- "16686:16686"
- "14268:14268"
- "9411:9411"
environment:
- COLLECTOR_ZIPKIN_HTTP_PORT=9411
m3db:
image: quay.io/m3db/m3dbnode
volumes:
- ./m3dbnode-local-etcd.yml:/etc/m3dbnode/m3dbnode.yml
ports:
- "7201:7201"
- "7203:7203"
- "7204:7204"
- "9000-9003:9000-9003"
prometheus.yml:
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
external_labels:
domain: ops
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
- "/prometheus/rule/ops/*.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['prometheus:9090']
- job_name: 'm3db'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['m3db:7203','m3db:7204']
remote_read:
- url: "http://m3db:7201/api/v1/prom/remote/read"
read_recent: true
# - url: "http://10.104.103.10:8086/api/v1/prom/read?db=domain10"
# # To test reading even when local Prometheus has the data
# remote_timeout: 2m
# read_recent: true
#
remote_write:
- url: "http://m3db:7201/api/v1/prom/remote/write"
@ShingYang This is unfortunately expected behavior. We maintain two open file descriptors for each block so 2*(retention / blockSize)*numShards can get large rather quickly.
In practice it hasn't been an issue for us. We have clusters running with over a million F.Ds each without trouble. Is this an issue for you?
I configurate the file open handler to 300k instead of 3000k, which recommanded in document. So ssh fails always with error "open too many file handlers". This is the original issue of the problem. May I know whether Uber has a plan to reduce the bootstrap process file handlers? The old blocks handers are useless for most cases anyway. One more instresting issue is that after peer bootstrapper takes effect, the peer node will have the double file handlers as well. If we have many blocks, it will quickly contributes to "open too many files"
close it. As I know this is by design.