Skip to content

daemon: lower allocations#14268

Merged
LK4D4 merged 1 commit intomoby:masterfrom
unclejack:lower_allocations_execdriver
Jun 30, 2015
Merged

daemon: lower allocations#14268
LK4D4 merged 1 commit intomoby:masterfrom
unclejack:lower_allocations_execdriver

Conversation

@unclejack
Copy link
Copy Markdown
Contributor

This PR helps improve things with #12899. I'm not going to say this fully fixes it for now as there are other changes to be made.

@LK4D4
Copy link
Copy Markdown
Contributor

LK4D4 commented Jun 29, 2015

@unclejack Could you describe how it helps save memory? Also #12899 definitely has origins in never-removed execConfig structs.

@unclejack
Copy link
Copy Markdown
Contributor Author

@LK4D4 execConfig structs are moste likely a small part of this. This saves memory by avoiding the allocation of io.Copy buffers. This saves about 96 KB per exec.

@LK4D4
Copy link
Copy Markdown
Contributor

LK4D4 commented Jun 29, 2015

Makes sense to write own Copy function for this.

@unclejack
Copy link
Copy Markdown
Contributor Author

@LK4D4 Fair enough, I'll add it to pools.

Comment thread daemon/exec.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.

I know this is unrelated to the PR, but could we add a check for this error here.

@stevvooe
Copy link
Copy Markdown
Contributor

@LK4D4 Sorry to disagree with you here, but we should avoid having a specialized version of io.Copy. It is a subtle function to get right. io.Copy can defer buffer allocation with ReaderFrom and WriterTo. Perhaps, a helper method like BufferedReaderFromSize(rd, size) would be appropriate.

@LK4D4
Copy link
Copy Markdown
Contributor

LK4D4 commented Jun 29, 2015

@stevvooe but our function will be just wrapper around. Helper method not helping here, because we have hardcoded pools in pkg/pools.
So, we have four repetitions of same pattern, wrap reader to BufioReader from pool and use io.Copy, I think it make sense to wrap it to function.

@unclejack unclejack force-pushed the lower_allocations_execdriver branch 2 times, most recently from bbb7504 to 838e441 Compare June 29, 2015 21:53
@unclejack
Copy link
Copy Markdown
Contributor Author

@LK4D4 It's done. I've added it as a package level exported function for convenience.
@stevvooe As @LK4D4 said, it was only going to be a wrapper, not a full implementation of io.Copy.

@LK4D4
Copy link
Copy Markdown
Contributor

LK4D4 commented Jun 29, 2015

@unclejack Looks like some tests are broken.

@unclejack
Copy link
Copy Markdown
Contributor Author

@LK4D4 I've reproduced the failure and I'm working on fixing it right away.

Signed-off-by: Cristian Staretu <[email protected]>
@unclejack unclejack force-pushed the lower_allocations_execdriver branch from 838e441 to c1477db Compare June 29, 2015 22:45
@unclejack
Copy link
Copy Markdown
Contributor Author

@LK4D4 The tests seem to be OK now. There's more work to be done for this, but this is good enough for one PR.

@calavera
Copy link
Copy Markdown
Contributor

LGTM

1 similar comment
@LK4D4
Copy link
Copy Markdown
Contributor

LK4D4 commented Jun 30, 2015

LGTM

LK4D4 added a commit that referenced this pull request Jun 30, 2015
@LK4D4 LK4D4 merged commit bb364ff into moby:master Jun 30, 2015
@unclejack unclejack deleted the lower_allocations_execdriver branch June 30, 2015 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants