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

Experiment with 1MB buffer size to increase download speed #554

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import java.util.UUID;

public class HollowFilesystemBlobRetriever implements HollowConsumer.BlobRetriever {
private static final int BUFFER_SIZE = 1048576;

private final Path blobStorePath;
private final HollowConsumer.BlobRetriever fallbackBlobRetriever;
private final boolean useExistingStaleSnapshot;
Expand Down Expand Up @@ -83,7 +85,6 @@ public HollowFilesystemBlobRetriever(Path blobStorePath, HollowConsumer.BlobRetr
this.fallbackBlobRetriever = fallbackBlobRetriever;
this.useExistingStaleSnapshot = useExistingStaleSnapshot;
this.optionalBlobParts = fallbackBlobRetriever == null ? null : fallbackBlobRetriever.configuredOptionalBlobParts();

ensurePathExists(blobStorePath);
}

Expand Down Expand Up @@ -319,7 +320,7 @@ public InputStream getInputStream() throws IOException {
InputStream is = remoteBlob.getInputStream();
OutputStream os = Files.newOutputStream(tempPath)
) {
byte buf[] = new byte[4096];
byte buf[] = new byte[BUFFER_SIZE];
int n;
while (-1 != (n = is.read(buf)))
os.write(buf, 0, n);
Expand All @@ -337,7 +338,7 @@ public File getFile() throws IOException {
InputStream is = remoteBlob.getInputStream();
OutputStream os = Files.newOutputStream(tempPath)
) {
byte buf[] = new byte[4096];
byte buf[] = new byte[BUFFER_SIZE];
int n;
while (-1 != (n = is.read(buf)))
os.write(buf, 0, n);
Expand All @@ -364,7 +365,7 @@ public OptionalBlobPartInput getOptionalBlobPartInputs() throws IOException {
InputStream is = entry.getValue();
OutputStream os = Files.newOutputStream(tempPath)
) {
byte buf[] = new byte[4096];
byte buf[] = new byte[BUFFER_SIZE];
int n;
while (-1 != (n = is.read(buf, 0, buf.length)))
os.write(buf, 0, n);
Expand Down