Stay organized with collections
Save and categorize content based on your preferences.
This document lists best practices for using the Cloud Healthcare API.
The guidelines in this page are designed for greater efficiency, accuracy, and
optimal response times from the service.
Understanding latency performance
The performance of the Cloud Healthcare API is measured by the latency
between:
When you send a request to the Cloud Healthcare API.
When you receive a full response to the request.
Latency comprises three components:
Round-trip time (RTT)
Server processing latency
Server throughput
The geographical distance between you and the server you are making requests
to can have a significant impact on RTT and server throughput. The measured
inter-region latency and throughput for Google Cloud networks can be found in a
live dashboard.
The dashboard shows the performance a client can expect from different
locations when making requests to Cloud Healthcare API servers.
Measuring latency performance
The following tools and dashboards provide ways to measure the performance
of requests to and from Cloud Healthcare API servers:
Google Cloud console latency metrics: You can view the server-side latency
of Cloud Healthcare API requests in the Google Cloud console.
For more information, see Google Cloud metrics.
Cloud Logging custom metrics: You can create distribution metrics
using Logging. Distribution metrics let you configure and
understand end-to-end latency in your applications. You can also monitor and
report on any custom-defined latency measurements.
This section describes various methods of reducing the latency of requests sent
to the Cloud Healthcare API.
Sending requests to the closest regional location
To get the best RTT and server throughput performance, send requests from the
client to the closest Cloud Healthcare API regional location. See
Regions for a list of available regions.
Sending warmup requests
When a client sends requests to a Cloud Healthcare API server for the
first time during a session, the client performs TCP handshakes with the
server to establish connections for HTTP requests. Any subsequent requests
can continue to use these established connections, allowing the client to
avoid the TCP overhead typically associated with a request. This results
in better performance when sending requests.
Sending requests concurrently with HTTP/1.1 or HTTP/2
To obtain the best performance for a series of requests, send the requests
concurrently. Use the following guidelines when sending concurrent requests:
When sending concurrent requests, try to find an ideal number for the number
of concurrent requests. The ideal number depends on several factors including
your hardware and network capabilities and how many requests are being sent.
Conduct tests to find the ideal number.
Send requests from the client using HTTP/2 whenever possible. HTTP/2 provides better
performance than HTTP/1.1 because HTTP/2 requires only one TCP connection
when sending multiple requests sequentially or concurrently. As a result,
you can avoid TCP handshake overhead.
If it's not possible to use HTTP/2, use HTTP/1.1 with a persistent connection.
You can avoid TCP handshake overhead if warmup requests
have already been sent. Using a persistent connection might require you to
manage an optimized connection with a connection pool for your HTTP library.
For example, to set a connection pool with 20 concurrent requests using the Google HTTP client library for Java, your code would include the following:
PoolingHttpClientConnectionManagercm=newPoolingHttpClientConnectionManager();// Support 20 concurrent requests.cm.setDefaultMaxPerRoute(20);cm.setMaxTotal(100);HTTP_CLIENT=HttpClients.custom().setConnectionManager(cm).build();
To set a connection pool with 20 concurrent requests using Node.js, your code
would include the following:
[[["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-08-29 UTC."],[[["\u003cp\u003eThis document outlines best practices for enhancing efficiency, accuracy, and response times when using the Cloud Healthcare API.\u003c/p\u003e\n"],["\u003cp\u003eLatency in the Cloud Healthcare API is determined by the time between sending a request and receiving a full response, and is impacted by factors like round-trip time (RTT) and server throughput.\u003c/p\u003e\n"],["\u003cp\u003eTools like Google Cloud console latency metrics, Cloud Logging custom metrics, and the Chrome network panel can be used to measure the performance of requests to and from Cloud Healthcare API servers.\u003c/p\u003e\n"],["\u003cp\u003eTo reduce request latency, send requests to the nearest Cloud Healthcare API regional location, send warmup requests to establish connections, and send concurrent requests using HTTP/2 or HTTP/1.1 with persistent connections.\u003c/p\u003e\n"],["\u003cp\u003eUsing a persistent connection might require you to manage an optimized connection with a connection pool for your HTTP library, and the number of concurrent requests should be tested for your specific usage.\u003c/p\u003e\n"]]],[],null,["# Network latency best practices\n\nThis document lists best practices for using the Cloud Healthcare API.\nThe guidelines in this page are designed for greater efficiency, accuracy, and\noptimal response times from the service.\n\nUnderstanding latency performance\n---------------------------------\n\nThe performance of the Cloud Healthcare API is measured by the latency\nbetween:\n\n1. When you send a request to the Cloud Healthcare API.\n2. When you receive a full response to the request.\n\nLatency comprises three components:\n\n- Round-trip time (RTT)\n- Server processing latency\n- Server throughput\n\nThe geographical distance between you and the server you are making requests\nto can have a significant impact on RTT and server throughput. The measured\ninter-region latency and throughput for Google Cloud networks can be found in a\n[live dashboard](https://lookerstudio.google.com/c/u/0/reporting/fc733b10-9744-4a72-a502-92290f608571/page/70YCB).\nThe dashboard shows the performance a client can expect from different\nlocations when making requests to Cloud Healthcare API servers.\n\nMeasuring latency performance\n-----------------------------\n\nThe following tools and dashboards provide ways to measure the performance\nof requests to and from Cloud Healthcare API servers:\n\n- **Google Cloud console latency metrics** : You can view the server-side latency\n of Cloud Healthcare API requests in the [Google Cloud console](https://console.cloud.google.com/apis/api/healthcare.googleapis.com/metrics).\n For more information, see [Google Cloud metrics](/monitoring/api/metrics_gcp).\n\n- **Cloud Logging custom metrics** : You can [create distribution metrics](/logging/docs/logs-based-metrics/distribution-metrics)\n using Logging. Distribution metrics let you configure and\n understand end-to-end latency in your applications. You can also monitor and\n report on any custom-defined latency measurements.\n\n- **Chrome network panel** : You can [inspect network activity in Chrome DevTools](https://developers.google.com/web/tools/chrome-devtools/network)\n to view the performance details of an HTTP request sent from a browser.\n\nReducing request latency\n------------------------\n\nThis section describes various methods of reducing the latency of requests sent\nto the Cloud Healthcare API.\n\n### Sending requests to the closest regional location\n\nTo get the best RTT and server throughput performance, send requests from the\nclient to the closest Cloud Healthcare API regional location. See\n[Regions](/healthcare-api/docs/concepts/regions) for a list of available regions.\n\n### Sending warmup requests\n\nWhen a client sends requests to a Cloud Healthcare API server for the\nfirst time during a session, the client performs TCP handshakes with the\nserver to establish connections for HTTP requests. Any subsequent requests\ncan continue to use these established connections, allowing the client to\navoid the TCP overhead typically associated with a request. This results\nin better performance when sending requests.\n\n### Sending requests concurrently with HTTP/1.1 or HTTP/2\n\nTo obtain the best performance for a series of requests, send the requests\nconcurrently. Use the following guidelines when sending concurrent requests:\n\n- When sending concurrent requests, try to find an ideal number for the number of concurrent requests. The ideal number depends on several factors including your hardware and network capabilities and how many requests are being sent. Conduct tests to find the ideal number.\n- Send requests from the client using HTTP/2 whenever possible. HTTP/2 provides better performance than HTTP/1.1 because HTTP/2 requires only one TCP connection when sending multiple requests sequentially or concurrently. As a result, you can avoid TCP handshake overhead.\n- If it's not possible to use HTTP/2, use HTTP/1.1 with a persistent connection.\n You can avoid TCP handshake overhead if [warmup requests](#sending_warmup_requests)\n have already been sent. Using a persistent connection might require you to\n manage an optimized connection with a connection pool for your HTTP library.\n\n For example, to set a connection pool with 20 concurrent requests using the [Google HTTP client library for Java](https://github.com/googleapis/google-http-java-client), your code would include the following: \n\n PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();\n // Support 20 concurrent requests.\n cm.setDefaultMaxPerRoute(20);\n cm.setMaxTotal(100);\n HTTP_CLIENT = HttpClients.custom().setConnectionManager(cm).build();\n\n To set a connection pool with 20 concurrent requests using Node.js, your code\n would include the following: \n\n require('http').globalAgent.maxSockets = 20"]]