Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Decode JSON to avoid ReadFile#8946

Merged
LK4D4 merged 3 commits into
moby:masterfrom
unclejack:stream_decode
Nov 4, 2014
Merged

Decode JSON to avoid ReadFile#8946
LK4D4 merged 3 commits into
moby:masterfrom
unclejack:stream_decode

Conversation

@unclejack

Copy link
Copy Markdown
Contributor

docker ps -a and docker images were allocating a lot of memory because of ioutil.ReadFile. Running those two commands 10000 times would cause the allocation of around 30-50 gigabytes because of ReadFile.

This PR fixes some code paths for images, containers and volumes to use JSON decoding instead.

Comment thread daemon/container.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

no need for &container, container is already a pointer.

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <[email protected]> (github: unclejack)
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <[email protected]> (github: unclejack)
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <[email protected]> (github: unclejack)
@unclejack

Copy link
Copy Markdown
Contributor Author

@tiborvass Thanks! I've updated the code, PTAL.

@cpuguy83 for changes to docker/volumes/
@crosbymichael @vieux for docker/daemon
@jlhawn for docker/image

@tiborvass

Copy link
Copy Markdown
Contributor

LGTM Thanks @unclejack !

@cpuguy83

cpuguy83 commented Nov 4, 2014

Copy link
Copy Markdown
Member

LGTM

2 similar comments
@jessfraz

jessfraz commented Nov 4, 2014

Copy link
Copy Markdown
Contributor

LGTM

@LK4D4

LK4D4 commented Nov 4, 2014

Copy link
Copy Markdown
Contributor

LGTM

LK4D4 added a commit that referenced this pull request Nov 4, 2014
@LK4D4 LK4D4 merged commit b8678aa into moby:master Nov 4, 2014
@unclejack unclejack deleted the stream_decode branch November 4, 2014 17:04
@jlhawn

jlhawn commented Nov 4, 2014

Copy link
Copy Markdown

late to the party, but LGTM

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

Successfully merging this pull request may close these issues.

6 participants