# Class ParallelCompositeUploadBlobWriteSessionConfig (2.69.0)

2.69.0 (latest) 2.67.0 2.64.0 2.63.0 2.62.1 2.60.0 2.59.0 2.58.1 2.57.0 2.56.0 2.55.0 2.54.0 2.53.3 2.52.3 2.50.0 2.49.0 2.48.2 2.47.0 2.46.0 2.45.0 2.44.1 2.43.2 2.42.0 2.41.0 2.40.1 2.39.0 2.38.0 2.37.0 2.36.1 2.34.0 2.33.0 2.32.1 2.30.1 2.29.1 2.28.0 2.27.1 2.24.0 2.23.0 2.22.6 2.21.0 2.20.2 2.19.0 2.18.0 2.17.2 2.16.0 2.15.1 2.14.0 2.13.1 2.12.0 2.11.3 2.10.0 2.9.3 2.8.1 2.7.1 2.6.1 2.5.1 2.4.5 2.3.0 2.2.3 2.1.10

> [!WARNING]
> **Beta**
>
>
> This library is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1)
> of the Terms of Service. Pre-GA libraries might have limited support,
> and changes to pre-GA libraries might not be compatible with other pre-GA versions.
> For more information, see the
> [launch stage descriptions](https://docs.cloud.google.com/products#product-launch-stages).

    public final class ParallelCompositeUploadBlobWriteSessionConfig extends BlobWriteSessionConfig implements BlobWriteSessionConfig.HttpCompatible, BlobWriteSessionConfig.GrpcCompatible

Immutable config builder to configure BlobWriteSession instances to perform Parallel Composite
Uploads.

Parallel Composite Uploads can yield higher throughput when uploading large objects. However,
there are some things which must be kept in mind when choosing to use this strategy.

1. Performing parallel composite uploads costs more money. [Class A](https://cloud.google.com/storage/pricing#operations-by-class) operations are performed to create each part and to perform each compose. If a storage tier other than [`STANDARD`](https://cloud.google.com/storage/docs/storage-classes) is used, early deletion fees apply to deletion of the parts.

   An illustrative example. Upload a 5GiB object using 64MiB as the max size per part.   

   1. 80 Parts will be created (Class A)
   2. 3 compose calls will be performed (Class A)
   3. Delete 80 Parts along with 2 intermediary Compose objects (Free tier as long as `STANDARD` class)
   Once the parts and intermediary compose objects are deleted, there will be no storage charges related to those temporary objects.
2. The service account/credentials used to perform the parallel composite upload require [`
   storage.objects.delete`](https://cloud.google.com/storage/docs/access-control/iam-permissions#object_permissions) in order to cleanup the temporary part and intermediary compose objects.   
   *To handle handle part and intermediary compose object deletion out of band* passing PartCleanupStrategy#never() to [ParallelCompositeUploadBlobWriteSessionConfig#withPartCleanupStrategy(PartCleanupStrategy)](https://docs.cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.ParallelCompositeUploadBlobWriteSessionConfig#com_google_cloud_storage_ParallelCompositeUploadBlobWriteSessionConfig_withPartCleanupStrategy_) will prevent automatic cleanup.
3. Please see the [Parallel composite uploads](https://cloud.google.com/storage/docs/parallel-composite-uploads) documentation for a more in depth explanation of the limitations of Parallel composite uploads.
4. A failed upload can leave part and intermediary compose objects behind which will count as storage usage, and you will be billed for it.   
   By default if an upload fails, an attempt to cleanup the part and intermediary compose will be made. However if the program were to crash there is no means for the client to perform the cleanup.   
   Every part and intermediary compose object will be created with a name which ends in `
   .part`. An Object Lifecycle Management rule can be setup on your bucket to automatically cleanup objects with the suffix after some period of time. See [Object Lifecycle Management](https://cloud.google.com/storage/docs/lifecycle) for full details and a guide on how to setup a [Delete](https://cloud.google.com/storage/docs/lifecycle#delete) rule with a [suffix
   match](https://cloud.google.com/storage/docs/lifecycle#matchesprefix-suffix) condition.
5. Using parallel composite uploads are not a a one size fits all solution. They have very real overhead until uploading a large enough object. The inflection point is dependent upon many factors, and there is no one size fits all value. You will need to experiment with your deployment and workload to determine if parallel composite uploads are useful to you.

In general if you object sizes are smaller than several hundred megabytes it is unlikely
parallel composite uploads will be beneficial to overall throughput.
See Also: [BlobWriteSessionConfigs#parallelCompositeUpload()](https://docs.cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.BlobWriteSessionConfigs#com_google_cloud_storage_BlobWriteSessionConfigs_parallelCompositeUpload__), [Storage#blobWriteSession(BlobInfo, BlobWriteOption...)](https://docs.cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.Storage#com_google_cloud_storage_Storage_blobWriteSession_), GrpcStorageOptions.Builder#setBlobWriteSessionConfig(BlobWriteSessionConfig), <https://cloud.google.com/storage/docs/parallel-composite-uploads>

## Inheritance

[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> [BlobWriteSessionConfig](https://docs.cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.BlobWriteSessionConfig) \> ParallelCompositeUploadBlobWriteSessionConfig

## Implements

com.google.cloud.storage.BlobWriteSessionConfig.HttpCompatible, com.google.cloud.storage.BlobWriteSessionConfig.GrpcCompatible

## Inherited Members

[BlobWriteSessionConfig.equals(Object)](https://docs.cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.BlobWriteSessionConfig#com_google_cloud_storage_BlobWriteSessionConfig_equals_java_lang_Object_) [BlobWriteSessionConfig.hashCode()](https://docs.cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.BlobWriteSessionConfig#com_google_cloud_storage_BlobWriteSessionConfig_hashCode__) [Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Methods

### equals(Object o)

    public boolean equals(Object o)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `o` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

**Overrides** [BlobWriteSessionConfig.equals(Object obj)](https://docs.cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.BlobWriteSessionConfig#com_google_cloud_storage_BlobWriteSessionConfig_equals_java_lang_Object_)

### hashCode()

    public int hashCode()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

**Overrides** [BlobWriteSessionConfig.hashCode()](https://docs.cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.BlobWriteSessionConfig#com_google_cloud_storage_BlobWriteSessionConfig_hashCode__)

### withBufferAllocationStrategy(ParallelCompositeUploadBlobWriteSessionConfig.BufferAllocationStrategy bufferAllocationStrategy)

    public ParallelCompositeUploadBlobWriteSessionConfig withBufferAllocationStrategy(ParallelCompositeUploadBlobWriteSessionConfig.BufferAllocationStrategy bufferAllocationStrategy)

> [!WARNING]
> **Beta**
>
> This feature is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1) of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.

Specify a specific buffering strategy which will dictate how buffers are allocated and used
when performing a parallel composite upload.

*Default: * BufferAllocationStrategy#simple(16MiB)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `bufferAllocationStrategy` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.ParallelCompositeUploadBlobWriteSessionConfig.BufferAllocationStrategy` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.ParallelCompositeUploadBlobWriteSessionConfig` |   |

### withExecutorSupplier(ParallelCompositeUploadBlobWriteSessionConfig.ExecutorSupplier executorSupplier)

    public ParallelCompositeUploadBlobWriteSessionConfig withExecutorSupplier(ParallelCompositeUploadBlobWriteSessionConfig.ExecutorSupplier executorSupplier)

> [!WARNING]
> **Beta**
>
> This feature is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1) of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.

Specify a specific executor supplier where work will be submitted when performing a parallel
composite upload.

*Default: * ExecutorSupplier#cachedPool()

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `executorSupplier` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.ParallelCompositeUploadBlobWriteSessionConfig.ExecutorSupplier` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.ParallelCompositeUploadBlobWriteSessionConfig` |   |

### withPartCleanupStrategy(ParallelCompositeUploadBlobWriteSessionConfig.PartCleanupStrategy partCleanupStrategy)

    public ParallelCompositeUploadBlobWriteSessionConfig withPartCleanupStrategy(ParallelCompositeUploadBlobWriteSessionConfig.PartCleanupStrategy partCleanupStrategy)

> [!WARNING]
> **Beta**
>
> This feature is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1) of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.

Specify a specific cleanup strategy which will dictate what cleanup operations are performed
automatically when performing a parallel composite upload.

*Default: * PartCleanupStrategy#always()

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `partCleanupStrategy` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.ParallelCompositeUploadBlobWriteSessionConfig.PartCleanupStrategy` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.ParallelCompositeUploadBlobWriteSessionConfig` |   |

### withPartMetadataFieldDecorator(ParallelCompositeUploadBlobWriteSessionConfig.PartMetadataFieldDecorator partMetadataFieldDecorator)

    public ParallelCompositeUploadBlobWriteSessionConfig withPartMetadataFieldDecorator(ParallelCompositeUploadBlobWriteSessionConfig.PartMetadataFieldDecorator partMetadataFieldDecorator)

> [!WARNING]
> **Beta**
>
> This feature is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1) of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.

Specify a Part Metadata Field decorator, this will manipulate the metadata associated with part
objects, the ultimate object metadata will remain unchanged.

*Default: * PartMetadataFieldDecorator#noOp()

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `partMetadataFieldDecorator` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.ParallelCompositeUploadBlobWriteSessionConfig.PartMetadataFieldDecorator` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.ParallelCompositeUploadBlobWriteSessionConfig` |   |

### withPartNamingStrategy(ParallelCompositeUploadBlobWriteSessionConfig.PartNamingStrategy partNamingStrategy)

    public ParallelCompositeUploadBlobWriteSessionConfig withPartNamingStrategy(ParallelCompositeUploadBlobWriteSessionConfig.PartNamingStrategy partNamingStrategy)

> [!WARNING]
> **Beta**
>
> This feature is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1) of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.

Specify a specific naming strategy which will dictate how individual part and intermediary
compose objects will be named when performing a parallel composite upload.

*Default: * PartNamingStrategy#noPrefix()

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `partNamingStrategy` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.ParallelCompositeUploadBlobWriteSessionConfig.PartNamingStrategy` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.ParallelCompositeUploadBlobWriteSessionConfig` |   |