Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

Proposal to improve memory performance decoding packfiles. #832

Closed
ajnavarro opened this issue May 14, 2018 · 1 comment
Closed

Proposal to improve memory performance decoding packfiles. #832

ajnavarro opened this issue May 14, 2018 · 1 comment

Comments

@ajnavarro
Copy link
Contributor

Proposal

Problem

Analyzing the code, I saw the following on packfile decoder:

actual

This is forcing the read of all the object contents, even if we are not gonna use them.

Proposed solution

Instead of copy all into memory and resolve all the object deltas, create a DeltaReader abstraction to encapsulate that logic:

proposed

All the actual logic of the Object Cache and delta resolution will be exposed as a Reader. This Reader will contain the same logic as the actual one that is in the decoder, but it will be only executed if the Object.Read() method is called.

This reader will use the ObjectStorer to resolve deltas. The deltaBaseCache that is on the decoder should be moved inside the ObjectStorer.

Applying this solution will decrease drastically the memory usage. Instead of having all the objects in memory + deltaBaseCache objects + delta base + delta target, we are going to have only deltaBaseCache objects + delta base and target.

Caveats @jfontan @smola @mcuadros ?

distorhead added a commit to werf/werf that referenced this issue Sep 6, 2018
Go-git experiment failed for now.

There is blocking issue to continue use go-git:
 * Corrupt patch generation for files without newline-at-the-end: src-d/go-git#936

And some non-blocking, but harmful:
 * Memory usage is too big on big repos: src-d/go-git#832.
 * Corrupt patch generation (solved in fork): src-d/go-git#932.

Libgit2 is too complex to install or statically build into dapp. Also libgit2 has memory leaks.

The decision is to use raw git command in a clean and efficient way.

Implemented Diff operation.
distorhead added a commit to werf/werf that referenced this issue Sep 6, 2018
Go-git experiment failed for now.

There is blocking issue to continue use go-git:
 * Corrupt patch generation for files without newline-at-the-end: src-d/go-git#936

And some non-blocking, but harmful:
 * Memory usage is too big on big repos: src-d/go-git#832
 * Corrupt patch generation (solved in fork): src-d/go-git#932

Libgit2 is too complex to install or statically build into dapp. Also libgit2 has memory leaks.

The decision is to use raw git command in a clean and efficient way.

Implemented Diff operation.
@mcuadros
Copy link
Contributor

mcuadros commented Sep 6, 2018

Solved by:
plumbing/format: packfile, new packfile representation #899 (erizocosmico)
plumbing/format: packfile, new packfile parser #898 (jfontan)
plumbing/format: packfile, improve packfile reading performance #906 (erizocosmico) #916 (jfontan)

@mcuadros mcuadros closed this as completed Sep 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants