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

Memory consumed totally 3-4 times as data size #7056

Closed
yanliang567 opened this issue Aug 11, 2021 · 11 comments
Closed

Memory consumed totally 3-4 times as data size #7056

yanliang567 opened this issue Aug 11, 2021 · 11 comments
Assignees
Labels
kind/bug Issues or changes related a bug stale indicates no udpates for 30 days triage/accepted Indicates an issue or PR is ready to be actively worked on.
Milestone

Comments

@yanliang567
Copy link
Contributor

Steps/Code to reproduce:

in tests20/python_client: run pytest test_e2e.py --host x.x.x.x after updating nb=100,000
or

  1. deploy Milvus 2.0 cluster
    1.1 after deployment, Milvus consumes about 380MB memory totally.
  2. insert 100,000 entities (about 50MB) into a collection
  3. flush
  4. load
  5. search
  6. make a sq8 index
  7. query

Expected result:

memory consumed smoothly

Actual results:

total memory consumed from 380MB to 1480MB and keeps at 750MB after step#7, looking into different pods:
querynode: 50MB to 222MB, and keeps at 200MB after step#7
datanode: 50MB to 470MB, and keeps 152MB after step#7
Indexnode: 50M to 286MB, and keeps at 150MB after step#7
proxy: 60M to 336MB, and keeps at 75MB after step#7 (I think 75MB is acceptable after step#7)

Environment:

  • Milvus version(e.g. v2.0.0-RC2 or 8b23a93): master-20210810-bdb8396
  • Deployment mode(standalone or cluster): cluster
  • SDK version(e.g. pymilvus v2.0.0rc2):
    pymilvus 2.0.0rc3.dev16
    pymilvus-orm 2.0.0rc3.dev15

Configuration file:

Additional context:

after deployment with no workload:
Screen Shot 2021-08-11 at 2 16 53 PM
when there is workload
Screen Shot 2021-08-11 at 2 17 43 PM
after step#7
Screen Shot 2021-08-11 at 2 18 33 PM

@yanliang567 yanliang567 added kind/bug Issues or changes related a bug triage/accepted Indicates an issue or PR is ready to be actively worked on. labels Aug 11, 2021
@yanliang567 yanliang567 added this to the 2.0.0-RC4 milestone Aug 11, 2021
@yanliang567
Copy link
Contributor Author

there is a similar issue which focuses on querynode, #6745

@congqixia
Copy link
Contributor

Currently invoking cgo functionality must do data copy, which means same data occupies twice memory in both golang and cpp side.
And decoding message and row-column conversion consumes same amount of memory as well.
That's the two main reasons cause 3~4 times memory consumption.
Maybe we should have some solution for this case.
@xige-16

@yhmo yhmo changed the title memory consumed totally 3-4 times as data size Memory consumed totally 3-4 times as data size Aug 17, 2021
@xige-16
Copy link
Contributor

xige-16 commented Aug 21, 2021

Currently invoking cgo functionality must do data copy, which means same data occupies twice memory in both golang and cpp side.
And decoding message and row-column conversion consumes same amount of memory as well.
That's the two main reasons cause 3~4 times memory consumption.
Maybe we should have some solution for this case.
@xige-16

Changing the format of the internal data to arrow will solves the problem of copying the data between cgo and golang.

@xige-16 xige-16 modified the milestones: 2.0.0-RC5, 2.0.0-RC6 Aug 23, 2021
@czs007 czs007 assigned sunby and unassigned xige-16 Aug 26, 2021
@congqixia
Copy link
Contributor

An MEP is in WIP status for this. Please check #7210

@xiaofan-luan
Copy link
Contributor

assign @cydrain

@xiaofan-luan
Copy link
Contributor

why are we copying the data? from design perspective, data should not be resident in go?

@congqixia
Copy link
Contributor

why are we copying the data? from design perspective, data should not be resident in go?

By copying the data, do you mean copying the data from go managed memory to c managed memory? If that's the case, this behavior is the designed behavior of cgo. The reason is that it's unsafe to allow c/cpp to operate memory from go runtime. Say if the memory is cleaned up by gc when c/cpp tried to operate it.

@xige-16
Copy link
Contributor

xige-16 commented Sep 1, 2021

I will check if there is a memory leak

@cydrain
Copy link
Contributor

cydrain commented Sep 8, 2021

/assign

@stale
Copy link

stale bot commented Oct 10, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Rotten issues close after 30d of inactivity. Reopen the issue with /reopen.

@stale stale bot added the stale indicates no udpates for 30 days label Oct 10, 2021
@yanliang567 yanliang567 modified the milestones: 2.0.0-RC7, 2.0.0-GA Oct 13, 2021
@yanliang567
Copy link
Contributor Author

lets keep it

@stale stale bot closed this as completed Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Issues or changes related a bug stale indicates no udpates for 30 days triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

6 participants