gRPC용 Endpoints에서는 Endpoints의 API 관리 기능을 사용하여 API 콘솔, 모니터링, 호스팅, 추적, 인증 등을 gRPC 서비스에 추가할 수 있습니다. 또한 특수 매핑 규칙을 지정하면 ESP와 ESPv2가 HTTP의 RESTful JSON을 gRPC 요청으로 변환합니다. 즉, Endpoints에서 관리하는 gRPC 서버를 배포하고 gRPC 또는 JSON/HTTP 클라이언트를 사용하여 해당 API를 호출할 수 있으므로 다른 시스템과의 통합이 훨씬 더 유연하고 간편해집니다.
gRPC를 지원하는 모든 언어로 Endpoints용 gRPC 서비스를 만들 수 있습니다. 서비스 및 클라이언트를 만들기 위한 빠른 시작과 가이드를 비롯하여 gRPC에 대한 자세한 내용은 gRPC 사이트에서 확인할 수 있습니다.
Google Cloud 컴퓨팅 플랫폼에 API 및 Extensible Service Proxy를 배포하는 방법에 대한 자세한 내용은 API 백엔드 배포를 참조하세요.
서비스 정의 및 구성
gRPC는 서비스를 정의하고 매개변수 및 반환 유형을 사용하여 원격으로 호출 가능한 메소드를 지정한다는 개념을 바탕으로 합니다. 기본적으로 gRPC는 서비스 인터페이스와 페이로드 메시지의 구조를 설명하는 인터페이스 정의 언어(IDL)로 프로토콜 버퍼를 사용합니다.
// The greeting service definition.serviceGreeter{// Sends a greetingrpcSayHello(HelloRequest)returns(HelloReply){}}// The request message containing the user's name.messageHelloRequest{stringname=1;}// The response message containing the greetingsmessageHelloReply{stringmessage=1;}
Endpoints에서 gRPC를 사용하려면 서비스 구성과 서비스 정의를 제공해야 합니다. 이를 통해 인증, 서비스에 포함되는 API, HTTP 요청에서 gRPC 메소드로의 매핑, 특수한 Cloud Endpoints 설정을 비롯한 서비스의 런타임 동작이 구성됩니다.
트랜스코딩
Endpoints는 gRPC 서비스를 위한 프로토콜 변환 기능을 제공하여 클라이언트에서 HTTP/JSON을 사용하여 ESP 또는 ESPv2를 통해 gRPC 서비스와 통신할 수 있도록 합니다.
가장 일반적인 사용 사례는 브라우저 클라이언트가 gRPC 클라이언트 라이브러리의 특별한 지원 없이 gRPC 서버와 통신할 수 있도록 하는 것입니다. Endpoints는 서비스 구성의 일부로 HTTP 요청을 gRPC 메소드에 매핑하기 위한 메커니즘을 제공합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2024-12-21(UTC)"],[[["\u003cp\u003egRPC, a high-performance RPC framework developed by Google, allows client applications to directly call methods on a server application as if it were a local object.\u003c/p\u003e\n"],["\u003cp\u003eEndpoints for gRPC utilizes the Extensible Service Proxy (ESP) or Extensible Service Proxy V2 (ESPv2) to provide API management capabilities such as monitoring, authentication, and tracing for gRPC services.\u003c/p\u003e\n"],["\u003cp\u003eEndpoints offers protocol translation, enabling clients to communicate with gRPC services using HTTP/JSON through ESP or ESPv2, which facilitates integration with systems that do not natively support gRPC.\u003c/p\u003e\n"],["\u003cp\u003egRPC services in Endpoints are configured using service definition files and a service configuration file, allowing users to customize runtime behaviors, API mappings, and Cloud Endpoints settings.\u003c/p\u003e\n"],["\u003cp\u003eWhile Endpoints provides robust gRPC support, it currently does not support payload compression or IDLs other than protocol buffers, and it is limited to GKE, Compute Engine, and Cloud Run compute platforms.\u003c/p\u003e\n"]]],[],null,["# Cloud Endpoints for gRPC\n\n[gRPC](http://www.grpc.io) is a high performance, open-source universal RPC\nframework, developed by Google. In gRPC, a client application can directly call\nmethods on a server application on a different machine as if it was a local\nobject, making it easier to create distributed applications and services.\n\nAPI management\n--------------\n\nEndpoints works with either the\n[Extensible Service Proxy (ESP)](/endpoints/docs/grpc/glossary#extensible_service_proxy) or the [Extensible Service Proxy V2](/endpoints/docs/openapi/glossary#extensible_service_proxy_v2) (ESPv2) to provide API management.\n\nWith Endpoints for gRPC, you can use the API management\ncapabilities of Endpoints to add an API console, monitoring,\nhosting, tracing, authentication, and more to your gRPC services. In addition,\nonce you specify special mapping rules, ESP and ESPv2 translate RESTful JSON over HTTP\ninto gRPC requests. This means that you can deploy a gRPC server managed by\nEndpoints and call its API using a gRPC or JSON/HTTP client,\ngiving you much more flexibility and ease of integration with other systems.\n\nYou can create gRPC services for Endpoints in any\ngRPC-supported language. You can find out much more about gRPC,\nincluding quickstarts and tutorials for creating servers and clients, on the\n[gRPC site](http://www.grpc.io/docs/).\n\nSupported compute platforms\n---------------------------\n\nESP and ESPv2 are Open Source projects and are available to you in the following ways:\n\n- A container in Artifact Registry.\n - See the [ESP release notes](https://github.com/cloudendpoints/esp/releases) for the current ESP Docker image.\n - See the [ESPv2 release notes](https://github.com/GoogleCloudPlatform/esp-v2/releases) for the current ESPv2 Docker image.\n- Source code in GitHub.\n - See the [ESP README](https://github.com/cloudendpoints/esp/blob/master/README.md) for details on building ESP.\n - See the [ESPv2 README](https://github.com/GoogleCloudPlatform/esp-v2/blob/master/README.md) for details on building ESPv2.\n\nYou can run the ESP container on the following:\n\n- Compute Engine with Docker\n- Kubernetes, including Google Kubernetes Engine\n- A [Linux or macOS computer or another cloud provider](/endpoints/docs/grpc/running-esp-localdev)\n\nYou can run the ESPv2 container on the following:\n\n- Cloud Run\n- Knative serving\n- GKE\n- Compute Engine\n- Kubernetes\n\nSee [About Cloud Endpoints](/endpoints/docs/grpc/about-cloud-endpoints) for more.\n\nSee [Deploying the API Backend](/endpoints/docs/grpc/deploy-api-backend) for\ninformation on deploying your API and Extensible Service Proxy on Google Cloud compute platforms.\n\nService definition and configuration\n------------------------------------\n\ngRPC is based around the idea of defining a **service** , specifying the methods\nthat can be called remotely with their parameters and return types. By default,\ngRPC uses [protocol buffers](https://developers.google.com/protocol-buffers/docs/overview)\nas the Interface Definition Language (IDL) for describing both the service\ninterface and the structure of the payload messages. \n\n // The greeting service definition.\n service Greeter {\n // Sends a greeting\n rpc SayHello (HelloRequest) returns (HelloReply) {}\n }\n\n // The request message containing the user's name.\n message HelloRequest {\n string name = 1;\n }\n\n // The response message containing the greetings\n message HelloReply {\n string message = 1;\n }\n\nTo use gRPC with Endpoints, you must provide a\n[service configuration](/endpoints/docs/grpc/grpc-service-config)\nalong with the service definition. This configures the runtime\nbehavior of your service, including authentication, the API(s) included in the\nservice, mappings from HTTP requests to gRPC methods, and special Cloud\nEndpoints settings.\n\nTranscoding\n-----------\n\nEndpoints provides protocol translation for your gRPC services\nallowing clients to use HTTP/JSON to communicate with a gRPC service through the ESP or ESPv2.\n\nThe most common use case is allowing browser clients to talk to gRPC servers\nwithout special support from gRPC client libraries. Endpoints\nprovides a mechanism for mapping HTTP requests to gRPC methods as part of\n[service configuration](/endpoints/docs/grpc/grpc-service-config).\n\nYou can find out more about this in [Transcoding HTTP/JSON to gRPC](/endpoints/docs/grpc/transcoding).\n\nLimitations\n-----------\n\nThe following gRPC features are not yet supported in Endpoints:\n\n- Payload compression\n- Any IDL other than protocol buffers\n\nIn addition, Endpoints only supports gRPC services for GKE, Compute Engine, and Cloud Run (Beta). Endpoints does **not** support gRPC services for App Engine environments.\n\nWhat's next?\n------------\n\n- Follow one of our [tutorials](/endpoints/docs/grpc/tutorials) to get a simple gRPC service up and running with Cloud Endpoints in your environment of choice\n- Find out how to [configure a gRPC service](/endpoints/docs/grpc/grpc-service-config) for Cloud Endpoints\n- Explore samples. The getting-started-grpc sample is available on GitHub in the following languages:\n - [Java](https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/endpoints/getting-started-grpc)\n - [Python](https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/endpoints/getting-started-grpc)\n - [Ruby](https://github.com/GoogleCloudPlatform/ruby-docs-samples/tree/master/endpoints/getting-started-grpc)\n - [Go](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/endpoints/getting-started-grpc)\n - [Node.js](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/endpoints/getting-started-grpc)\n- The Bookstore sample is available in the following languages:\n - [Python](https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/endpoints/bookstore-grpc)\n - [Java](https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/endpoints)"]]