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"""(Hello World!)""";
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}, {});
if (input.bad()) throw google::cloud::Status(input.status());
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 outlines how to use the GCS+gRPC plugin, an optional component of the GCS C++ client library that can improve throughput for large workloads on Google Compute Engine (GCE).\u003c/p\u003e\n"],["\u003cp\u003eTo enable GCS+gRPC, you must include the \u003ccode\u003egoogle/cloud/storage/grpc_plugin.h\u003c/code\u003e header and initialize the client using \u003ccode\u003egoogle::cloud::storage_experimental::DefaultGrpcClient()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eWhen using the GCS+gRPC plugin, note that certain features are not implemented or behave differently compared to the REST-based implementation, such as the \u003ccode\u003eFields\u003c/code\u003e request parameter and the \u003ccode\u003estorage::Client::*AccessControl()\u003c/code\u003e functions.\u003c/p\u003e\n"],["\u003cp\u003eFor optimal performance with GCS+gRPC, it is recommended to use Protobuf version 23.2 or higher and gRPC version 1.55.0 or higher, and on GCE or GKE environments consider using the \u003ccode\u003egoogle-c2p:///storage.googleapis.com\u003c/code\u003e endpoint.\u003c/p\u003e\n"],["\u003cp\u003eIf compiling with CMake or Bazel, update the 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 and \u003ccode\u003e@google_cloud_cpp//:experimental-storage_grpc\u003c/code\u003e instead of \u003ccode\u003e@google_cloud_cpp//:storage\u003c/code\u003e respectively.\u003c/p\u003e\n"]]],[],null,["Version 2.21.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.21.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.21.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 #include \"google/cloud/storage/options.h\"\n #include \"google/cloud/common_options.h\"\n #include \"google/cloud/options.h\"\n\nThen you initialize a [`google::cloud::storage::Client`](/cpp/docs/reference/storage/2.21.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.21.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\"\"\"(Hello World!)\"\"\";\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 if (input.bad()) throw google::cloud::Status(input.status());\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 )"]]