The GCS C++ client library includes an optional plugin to access GCS via gRPC. When using GCS from Google Compute Engine (GCE) this plugin can enable higher total throughput across large workloads that run on hundreds or thousands of VMs. Note that this feature is not GA. Consult with your account manager to be included in the early access program.
Release Notes
There are some features that the gRPC plugin does not implement or implements differently from the REST-based implementation.
For best performance consider using Protobuf >= 23.2 and gRPC >= 1.55.0. Older versions of Protobuf requires enablingctype=CORD workaroundsat compile-time.
The default endpoint (storage.googleapis.com) works from any hosting environment (on-prem, GKE, GCE, other cloud providers, etc.). For best performance on GCE or GKE consider usinggoogle-c2p:///storage.googleapis.com.
TheFieldsrequest parameter is passed verbatim to the backend. Some fields have different names in gRPC, and the backend does not translate them. This is a rarely used feature, and we do not anticipate the behavior change is likely to cause problems. If it does cause any issues pleasefile a bug.
All thestorage::Client::*AccessControl()functions are emulated. For functions that change state, the emulation uses anOCC loop. While this preserves the semantics of a single RPC (e.g. no other concurrent changes are lost), it requires making at least two RPCs. This may increase the cost of calling these functions. Our telemetry shows these functions are not used via the C++ client library, but you should keep this in mind before deciding to use these functions in new code.
Required code changes
To use GCS+gRPC plugin you need to make some changes to how your application initializes the GCS C++ client library. First, an additional header provides the initialization functions:
void GrpcReadWrite(std::string const& bucket_name) {
namespace gcs = ::google::cloud::storage;
auto constexpr kText = R"""(Lorem ipsum dolor sit amet, consectetur adipiscing
elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
)""";
auto client = google::cloud::storage_experimental::DefaultGrpcClient();
auto object = client.InsertObject(bucket_name, "lorem.txt", kText);
if (!object) throw std::move(object).status();
auto input = client.ReadObject(bucket_name, "lorem.txt",
gcs::Generation(object->generation()));
std::string const actual(std::istreambuf_iterator<char>{input}, {});
std::cout << "The contents read back are:\n"
<< actual
<< "\nThe received checksums are: " << input.received_hash()
<< "\nThe computed checksums are: " << input.computed_hash()
<< "\nThe original hashes are: crc32c=" << object->crc32c()
<< ",md5=" << object->md5_hash() << "\n";
}
Changing your build scripts
If you are using CMake to compile your application, then you need to change thetarget_link_libraries()command to usegoogle-cloud-cpp::experimental-storage-grpcinstead ofgoogle-cloud-cpp::storage. For example, our quickstart program for gRPC uses:
If you are using Bazel to compile your application, then you need to change the dependencies from@google_cloud_cpp//:storageto@google_cloud_cpp//:experimental-storage-grpc. For example, our `grpc/quickstart uses:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThis document details how to use the GCS+gRPC plugin, an optional component of the GCS C++ client library that can improve throughput on large workloads in environments like Google Compute Engine (GCE).\u003c/p\u003e\n"],["\u003cp\u003eThe GCS+gRPC plugin has some specific implementation differences from the REST-based approach, such as using \u003ccode\u003eEndpointOption\u003c/code\u003e instead of \u003ccode\u003eRestEndpointOption\u003c/code\u003e to override endpoints and directly passing the \u003ccode\u003eFields\u003c/code\u003e request parameter to the backend without translation.\u003c/p\u003e\n"],["\u003cp\u003eTo use the GCS+gRPC plugin, developers need to include the "google/cloud/storage/grpc_plugin.h" header, initialize a \u003ccode\u003egoogle::cloud::storage::Client\u003c/code\u003e using \u003ccode\u003egoogle::cloud::storage_experimental::DefaultGrpcClient()\u003c/code\u003e, and update their build scripts to link against \u003ccode\u003egoogle-cloud-cpp::experimental-storage-grpc\u003c/code\u003e instead of \u003ccode\u003egoogle-cloud-cpp::storage\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eFor functions that change state the \u003ccode\u003estorage::Client::*AccessControl()\u003c/code\u003e functions in the gRPC plugin are emulated using an OCC loop, which may increase the cost of these functions due to requiring at least two RPCs, but this is not anticipated to be a large issue as these are not frequently used functions.\u003c/p\u003e\n"],["\u003cp\u003eThe latest release candidate of this client library is version 2.37.0-rc, with a list of other versions going back to 2.11.0, where this specific documentation is located.\u003c/p\u003e\n"]]],[],null,["Version 2.11.0keyboard_arrow_down\n\n- [2.42.0-rc (latest)](/cpp/docs/reference/storage/latest/storage-grpc)\n- [2.41.0](/cpp/docs/reference/storage/2.41.0/storage-grpc)\n- [2.40.0](/cpp/docs/reference/storage/2.40.0/storage-grpc)\n- [2.39.0](/cpp/docs/reference/storage/2.39.0/storage-grpc)\n- [2.38.0](/cpp/docs/reference/storage/2.38.0/storage-grpc)\n- [2.37.0](/cpp/docs/reference/storage/2.37.0/storage-grpc)\n- [2.36.0](/cpp/docs/reference/storage/2.36.0/storage-grpc)\n- [2.35.0](/cpp/docs/reference/storage/2.35.0/storage-grpc)\n- [2.34.0](/cpp/docs/reference/storage/2.34.0/storage-grpc)\n- [2.33.0](/cpp/docs/reference/storage/2.33.0/storage-grpc)\n- [2.32.0](/cpp/docs/reference/storage/2.32.0/storage-grpc)\n- [2.31.0](/cpp/docs/reference/storage/2.31.0/storage-grpc)\n- [2.30.0](/cpp/docs/reference/storage/2.30.0/storage-grpc)\n- [2.29.0](/cpp/docs/reference/storage/2.29.0/storage-grpc)\n- [2.28.0](/cpp/docs/reference/storage/2.28.0/storage-grpc)\n- [2.27.0](/cpp/docs/reference/storage/2.27.0/storage-grpc)\n- [2.26.0](/cpp/docs/reference/storage/2.26.0/storage-grpc)\n- [2.25.1](/cpp/docs/reference/storage/2.25.1/storage-grpc)\n- [2.24.0](/cpp/docs/reference/storage/2.24.0/storage-grpc)\n- [2.23.0](/cpp/docs/reference/storage/2.23.0/storage-grpc)\n- [2.22.1](/cpp/docs/reference/storage/2.22.1/storage-grpc)\n- [2.21.0](/cpp/docs/reference/storage/2.21.0/storage-grpc)\n- [2.20.0](/cpp/docs/reference/storage/2.20.0/storage-grpc)\n- [2.19.0](/cpp/docs/reference/storage/2.19.0/storage-grpc)\n- [2.18.0](/cpp/docs/reference/storage/2.18.0/storage-grpc)\n- [2.17.0](/cpp/docs/reference/storage/2.17.0/storage-grpc)\n- [2.16.0](/cpp/docs/reference/storage/2.16.0/storage-grpc)\n- [2.15.1](/cpp/docs/reference/storage/2.15.1/storage-grpc)\n- [2.14.0](/cpp/docs/reference/storage/2.14.0/storage-grpc)\n- [2.13.0](/cpp/docs/reference/storage/2.13.0/storage-grpc)\n- [2.12.0](/cpp/docs/reference/storage/2.12.0/storage-grpc)\n- [2.11.0](/cpp/docs/reference/storage/2.11.0/storage-grpc) \n\nUsing the GCS+gRPC Plugin\n=========================\n\nThe GCS C++ client library includes an optional plugin to access GCS via gRPC. When using GCS from Google Compute Engine (GCE) this plugin can enable higher total throughput across large workloads that run on hundreds or thousands of VMs. Note that this feature is not GA. Consult with your account manager to be included in the early access program.\n\n### Release Notes\n\nThere are some features that the gRPC plugin does not implement or implements differently from the REST-based implementation.\n\n1. For best performance consider using Protobuf \\\u003e= 23.2 and gRPC \\\u003e= 1.55.0. Older versions of Protobuf requires enabling [ctype=CORD workarounds](https://github.com/googleapis/google-cloud-cpp/blob/main/doc/ctype-cord-workarounds.md) at compile-time.\n2. To override the default endpoint you should use [`EndpointOption`](https://cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1EndpointOption.html) instead of \\[`RestEndpointOption`\\](@ ref [`google::cloud::storage::RestEndpointOption`](/cpp/docs/reference/storage/2.11.0/structgoogle_1_1cloud_1_1storage_1_1RestEndpointOption)).\n3. The default endpoint (`storage.googleapis.com`) works from any hosting environment (on-prem, GKE, GCE, other cloud providers, etc.). For best performance on GCE or GKE consider using `google-c2p:///storage.googleapis.com`.\n4. The [`Fields`](/cpp/docs/reference/storage/2.11.0/structgoogle_1_1cloud_1_1storage_1_1Fields) request parameter is passed verbatim to the backend. Some fields have different names in gRPC, and the backend does not translate them. This is a rarely used feature, and we do not anticipate the behavior change is likely to cause problems. If it does cause any issues please [file a bug](https://github.com/googleapis/google-cloud-cpp/issues/new/choose).\n5. All the `storage::Client::*AccessControl()` functions are emulated. For functions that change state, the emulation uses an [OCC loop](https://en.wikipedia.org/wiki/Optimistic_concurrency_control). While this preserves the semantics of a single RPC (e.g. no other concurrent changes are lost), it requires making at least two RPCs. This may increase the cost of calling these functions. Our telemetry shows these functions are not used via the C++ client library, but you should keep this in mind before deciding to use these functions in new code.\n\n### Required code changes\n\nTo use GCS+gRPC plugin you need to make some changes to how your application initializes the GCS C++ client library. First, an additional header provides the initialization functions: \n\n #include \"google/cloud/storage/grpc_plugin.h\"\n\nThen you initialize a [`google::cloud::storage::Client`](/cpp/docs/reference/storage/2.11.0/classgoogle_1_1cloud_1_1storage_1_1Client) using a new function: \n\n auto client = google::cloud::storage_experimental::DefaultGrpcClient();\n\nThe [`google::cloud::storage::Client`](/cpp/docs/reference/storage/2.11.0/classgoogle_1_1cloud_1_1storage_1_1Client) object returned by this function can be used as before: \n\n void GrpcReadWrite(std::string const& bucket_name) {\n namespace gcs = ::google::cloud::storage;\n auto constexpr kText = R\"\"\"(Lorem ipsum dolor sit amet, consectetur adipiscing\n elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim\n ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea\n commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit\n esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat\n non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n )\"\"\";\n\n auto client = google::cloud::storage_experimental::DefaultGrpcClient();\n\n auto object = client.InsertObject(bucket_name, \"lorem.txt\", kText);\n if (!object) throw std::move(object).status();\n\n auto input = client.ReadObject(bucket_name, \"lorem.txt\",\n gcs::Generation(object-\u003egeneration()));\n std::string const actual(std::istreambuf_iterator\u003cchar\u003e{input}, {});\n std::cout \u003c\u003c \"The contents read back are:\\n\"\n \u003c\u003c actual\n \u003c\u003c \"\\nThe received checksums are: \" \u003c\u003c input.received_hash()\n \u003c\u003c \"\\nThe computed checksums are: \" \u003c\u003c input.computed_hash()\n \u003c\u003c \"\\nThe original hashes are: crc32c=\" \u003c\u003c object-\u003ecrc32c()\n \u003c\u003c \",md5=\" \u003c\u003c object-\u003emd5_hash() \u003c\u003c \"\\n\";\n }\n\n### Changing your build scripts\n\nIf you are using CMake to compile your application, then you need to change the `target_link_libraries()` command to use `google-cloud-cpp::experimental-storage-grpc` instead of `google-cloud-cpp::storage`. For example, our quickstart program for gRPC uses: \n\n add_executable(quickstart_grpc quickstart_grpc.cc)\n target_link_libraries(quickstart_grpc google-cloud-cpp::experimental-storage-grpc)\n\nIf you are using Bazel to compile your application, then you need to change the dependencies from `@google_cloud_cpp//:storage` to `@google_cloud_cpp//:experimental-storage-grpc`. For example, our \\`grpc/quickstart uses: \n\n cc_binary(\n name = \"quickstart_grpc\",\n srcs = [\n \"quickstart_grpc.cc\",\n ],\n deps = [\n \"@google_cloud_cpp//:experimental-storage-grpc\",\n ],\n )"]]