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

configurable azure blocksize plus docs #321

Merged
merged 1 commit into from
Aug 17, 2021
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions AZURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ Start the server with the following run profiles enabled: `prod,secure,azure`

## Client Setup
Follow the regular client setup of access token and storage and metadata urls.
However when running the client use azure pofile option:
However when running the client use azure profile option:
```bash
$ bin/score-client --profile azure ...
```
```

Upload block size for Azure can be configured with the `azure.blockSize` configuration property.
3 changes: 3 additions & 0 deletions score-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,6 @@ To enable logging of request bodies and headers, append the following to the com

`--logging.level.org.apache.http=DEBUG`

## Azure
For azure support, use the `azure` profile. Block sizes for uploads
can be configured with the `azure.blockSize` property.
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ public class AzureUploadService implements UploadService {
@Value("${transport.parallel}")
private int parallelUploads;

// Azure used to have a 4MiB maximum part size, it has been since increased. Setting to 100MiB for now.
private final static int BLOCK_SIZE = 100 * 1024 * 1024;
@Value("${azure.blockSize:104857600")
private int blockSize = 100 * 1024 * 1024;

@Override
public void upload(File file, String objectId, String md5, boolean redo) throws IOException {
// Get object specification from server
val spec = storageService.initiateUpload(objectId, file.length(), redo, md5);

// Calculate expected number of parts to track progress against
val partInfo = calculateNumBlocks(file.length(), BLOCK_SIZE);
val partInfo = calculateNumBlocks(file.length(), blockSize);

// Will contain one Part as far as Storage Service is concerned. There is no need for more than one SAS to be
// generated for an entire file; each Part does not require its own pre-signed URL.
Expand All @@ -83,7 +83,7 @@ public void upload(File file, String objectId, String md5, boolean redo) throws

@Override
public void eventOccurred(ResponseReceivedEvent eventArg) {
long bytesSent = BLOCK_SIZE;
long bytesSent = blockSize;
int partCount = completedParts.incrementAndGet();

if (partCount <= partInfo.getLeft()) {
Expand All @@ -99,7 +99,7 @@ public void eventOccurred(ResponseReceivedEvent eventArg) {

@Override
public void eventOccurred(ResponseReceivedEvent eventArg) {
long bytesSent = BLOCK_SIZE;
long bytesSent = blockSize;
int partCount = completedParts.incrementAndGet();

if (partCount <= partInfo.getLeft()) {
Expand All @@ -122,7 +122,7 @@ public void eventOccurred(RetryingEvent eventArg) {

val options = new BlobRequestOptions();
options.setConcurrentRequestCount(parallelUploads);
blob.setStreamWriteSizeInBytes(BLOCK_SIZE);
blob.setStreamWriteSizeInBytes(blockSize);

progress.start();
progress.startTransfer();
Expand Down
13 changes: 12 additions & 1 deletion score-client/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@ client:

---

###############################################################################
# Profile - "azure"
###############################################################################

spring.profiles: azure

azure:
blockSize: 104857600

---

###############################################################################
# Profile - "kf"
###############################################################################
Expand Down Expand Up @@ -130,7 +141,7 @@ metadata:

client:
ssl:
custom: false
custom: false

---

Expand Down