Skip to content

Use piped streams to avoid loading cache entry bytes into memory #49

Open
@aSemy

Description

@aSemy

Currently the Build Cache implementations load the build cache entries into memory as a ByteArray

I believe this will negatively impact performance (although I admit I haven't done any testing, so I could be wrong!).

It can be avoided by piping the streams. For example:

    override fun store(key: BuildCacheKey, writer: BuildCacheEntryWriter) {
        // ...

        val incoming = PipedOutputStream()
        writer.writeTo(incoming)
        val contents = PipedInputStream(incoming)

        storageService.store(cacheKey, contents, writer.size) // must manually pass the size down
    }

I'd be happy to contribute a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions