Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

feat: tcmalloc memory release improvements #435

Merged
merged 5 commits into from
Apr 10, 2020

Conversation

hycdong
Copy link
Contributor

@hycdong hycdong commented Apr 8, 2020

What is this pull request solved

In pull request #343 , we optimize tcmalloc release memory. Based on the former implementation, this pull request add more improvements about it:

  1. Add a new perf-counter to record tcmalloc release memory
  2. Add a new remote command to control release memory or not
  3. Fix percentage range check from (0, 100) to (0, 100]

New perf-counter

replica*eon.replica_stub*tcmalloc.release.memory.size

This perf-counter has a problem that it will only be updated every interval time. For example, if tcmalloc memory release time interval is one hour, one server releases 1G memory at 10:00, the value won't change until 11:00. As a result, the monitor graph will be like a trapezoid.
If you have a better way to solve this problem, please comment this pull request or discuss with me offline.

New remote command

command help: replica.release-tcmalloc-memory <true|false>

Usage sample:

// query current value
>>> remote_command -t replica-server replica.release-tcmalloc-memory
COMMAND: replica.release-tcmalloc-memory

CALL [replica-server] [ip1: port1] succeed: true
CALL [replica-server] [ip2: port2] succeed: true
CALL [replica-server] [ip3: port3] succeed: true

Succeed count: 3
Failed count: 0

// not release memory
>>> remote_command -t replica-server replica.release-tcmalloc-memory false
COMMAND: replica.release-tcmalloc-memory false

CALL [replica-server] [ip1: port1] succeed: OK
CALL [replica-server] [ip2: port2] succeed: OK
CALL [replica-server] [ip3: port3] succeed: OK

Succeed count: 3
Failed count: 0

@hycdong hycdong added area/tcmalloc type/perf-counter PR that made modification on perf-counter, which should be noted in release note. labels Apr 8, 2020

#ifdef DSN_ENABLE_GPERF
_counter_tcmalloc_release_memory_size.init_app_counter("eon.replica_stub",
"tcmalloc.release.memory.size",
Copy link
Contributor

Choose a reason for hiding this comment

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

tcmalloc_release_memory_size

@neverchanje neverchanje merged commit 54df4bb into XiaoMi:master Apr 10, 2020
@hycdong hycdong deleted the tcmalloc_enhancement branch April 22, 2020 01:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1.12.3 type/perf-counter PR that made modification on perf-counter, which should be noted in release note.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants