Skip to content
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

slow lc_lib:get_sys_memory_usage() with lots of ports #13

Open
qzhuyan opened this issue Jul 21, 2022 · 0 comments
Open

slow lc_lib:get_sys_memory_usage() with lots of ports #13

qzhuyan opened this issue Jul 21, 2022 · 0 comments

Comments

@qzhuyan
Copy link
Collaborator

qzhuyan commented Jul 21, 2022

Description

We get report that during 100M connections tests, the function lc_lib:get_sys_memory_usage() is very slow as following.

iex([email protected])9> :timer.tc(&:load_ctl.get_sys_memory/0)
{9624, {0.8642148373449763, 134799187968}}
iex([email protected])10> :timer.tc(&:load_ctl.get_sys_memory/0)
{717, {0.8661882218141999, 134799187968}}
iex([email protected])11> :timer.tc(&:load_ctl.get_sys_memory/0)
{609, {0.8671846375495222, 134799187968}}
iex([email protected])12> :timer.tc(&:load_ctl.get_sys_memory/0)
{4690, {0.8890156894153435, 134799187968}}
iex([email protected])13> :timer.tc(&:load_ctl.get_sys_memory/0)
{617, {0.890001986632739, 134799187968}}
iex([email protected])14> :timer.tc(&:load_ctl.get_sys_memory/0)
{64898181, {0.8134260153112319, 134799187968}}

Impacted nodes

10/20 nodes runs into this issue.

Read from shell

Reading Cgroup/ cgroupv2/ or /proc/meminfo from shell is fast.

runq length:

iex([email protected])18> :erlang.statistics(:run_queue_lengths) |> IO.inspect(limit: :infinity)
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

We suspect it relates to the large number of erlang ports. (~5M / node)

cause

Likely it is caused by memsup

iex([email protected])18> :timer.tc(&:memsup.get_system_memory_data/0)
{13702147,
 [
   available_memory: 86003736576,
   buffered_memory: 119590912,
   cached_memory: 4353019904,
   free_memory: 81441886208,
   free_swap: 0,
   system_total_memory: 134799183872,
   total_memory: 134799183872,
   total_swap: 0
 ]}
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

No branches or pull requests

1 participant