Skip to content

Commit

Permalink
Merge branch 'main' into renovate/org.easymock-easymock-5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
cindy-peng authored Dec 9, 2024
2 parents db9841a + 3de67d5 commit af8b46f
Show file tree
Hide file tree
Showing 26 changed files with 241 additions and 166 deletions.
13 changes: 1 addition & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,4 @@ updates:
# If a security vulnerability comes in, we will be notified about
# it via template in the synthtool repository.
ignore:
- dependency-name: "*"

# rules for the `V3-experimental` branch
- package-ecosystem: maven
directory: "/"
schedule:
interval: daily
commit-message:
# Prefix all commit messages with "deps: "
prefix: "deps"
open-pull-requests-limit: 10
target-branch: "V3-experimental"
- dependency-name: "*"
18 changes: 2 additions & 16 deletions .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ branchProtectionRules:
- 'Kokoro - Test: Java GraalVM Native Image'
- 'Kokoro - Test: Java 17 GraalVM Native Image'
- javadoc
- library_generation
- unmanaged_dependency_check
- pattern: 1.106.5-sp
isAdminEnforced: true
requiredApprovingReviewCount: 1
Expand Down Expand Up @@ -107,22 +109,6 @@ branchProtectionRules:
- cla/google
- 'Kokoro - Test: Java GraalVM Native Image'
- 'Kokoro - Test: Java 17 GraalVM Native Image'
- pattern: V3-experimental
isAdminEnforced: true
requiredApprovingReviewCount: 1
requiresCodeOwnerReviews: true
requiresStrictStatusChecks: false
requiredStatusCheckContexts:
- dependencies (17)
- lint
- clirr
- units (8)
- units (11)
- 'Kokoro - Test: Integration'
- cla/google
- 'Kokoro - Test: Java GraalVM Native Image'
- 'Kokoro - Test: Java 17 GraalVM Native Image'
- javadoc
- pattern: 2.15.x
isAdminEnforced: true
requiredApprovingReviewCount: 1
Expand Down
82 changes: 60 additions & 22 deletions .readme-partials.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,28 +110,33 @@ custom_content: |
-------
In this feature launch, the [Java Datastore client](https://github.com/googleapis/java-datastore) now offers gRPC as a transport layer option with experimental support. Using [gRPC connection pooling](https://grpc.io/docs/guides/performance/) enables distributing RPCs over multiple connections which may improve performance.
#### Download Instructions
Instructions:
1. Clone the grpc-experimental branch from GitHub:
```python
git clone -b grpc-experimental https://github.com/googleapis/java-datastore.git
```
2. Run the following commands to build the library:
```python
# Go to the directory the code was downloaded to
cd java-datastore/
# Build the library
mvn clean install -DskipTests=true
```
3. Add the following dependency to your project:
```xml
<dependency>
#### Installation Instructions
The client can be built from the `grpc-experimental` branch on GitHub. For private preview, you can also download the artifact with the instructions provided below.
1. Download the datastore private preview package with dependencies:
```
curl -o <path-to-downloaded-jar> https://datastore-sdk-feature-release.web.app/google-cloud-datastore-2.20.0-grpc-experimental-1-SNAPSHOT-jar-with-dependencies.jar
```
2. Run the following commands to install JDK locally:
```
mvn install:install-file -Dfile=<path-to-downloaded-jar> -DgroupId=com.google.cloud -DartifactId=google-cloud-datastore -Dversion=2.20.0-grpc
```
3. Edit your pom.xml to add above package to `<dependencies/>` section:
```xml
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-datastore</artifactId>
<version>2.20.0-grpc-experimental-1-SNAPSHOT</version>
</dependency>
```
</dependency>
```
And if you have not yet, add below to `<repositories/>` section:
```xml
<repository>
<id>local-repo</id>
<url>file://${user.home}/.m2/repository</url>
</repository>
```
#### How to Use
To opt-in to the gRPC transport behavior, simply add the below line of code (`setTransportOptions`) to your Datastore client instantiation.
Expand Down Expand Up @@ -181,11 +186,44 @@ custom_content: |
#### New Features
There are new gRPC specific features available to use in this update.
##### Channel Pooling
To customize the number of channels your client uses, you can update the channel provider in the DatastoreOptions.
##### Connection Pool
A connection pool, also known as a channel pool, is a cache of database connections that are shared and reused to improve connection latency and performance. With this update, now you will be able to configure the channel pool to improve application performance. This section guides you in determining the optimal connection pool size and configuring it within the Java datastore client.
To customize the number of channels your client uses, you can update the channel provider in the DatastoreOptions.
###### Determine the best connection pool size
The default connection pool size is right for most applications, and in most cases there's no need to change it.
However sometimes you may want to change your connection pool size due to high throughput or buffered requests. Ideally, to leave room for traffic fluctuations, a connection pool has about twice the number of connections it takes for maximum saturation. Because a connection can handle a maximum of 100 concurrent requests, between 10 and 50 outstanding requests per connection is optimal. The limit of 100 concurrent streams per gRPC connection is enforced in Google's middleware layer, and you are not able to reconfigure this number.
The following steps help you calculate the optimal number of connections in your channel pool using estimate per-client QPS and average latency numbers.
To calculate the optimal connections, gather the following information:
1. The maximum number of queries per second (QPS) per client when your application is running a typical workload.
2. The average latency (the response time for a single request) in ms.
3. Determine the number of requests that you can send serially per second by dividing 1,000 by the average latency value.
4. Divide the QPS in seconds by the number of serial requests per second.
5. Divide the result by 50 requests per channel to determine the minimum optimal channel pool size. (If your calculation is less than 2, use at least 2 channels anyway, to ensure redundancy.)
6. Divide the same result by 10 requests per channel to determine the maximum optimal channel pool size.
These steps are expressed in the following equations:
```java
(QPS ÷ (1,000 ÷ latency ms)) ÷ 50 streams = Minimum optimal number of connections
(QPS ÷ (1,000 ÷ latency ms)) ÷ 10 streams = Maximum optimal number of connections
```
###### Example
Your application typically sends 50,000 requests per second, and the average latency is 10 ms. Divide 1,000 by 10 ms to determine that you can send 100 requests serially per second.
Divide that number into 50,000 to get the parallelism needed to send 50,000 QPS: 500. Each channel can have at most 100 requests out concurrently, and your target channel utilization
is between 10 and 50 concurrent streams. Therefore, to calculate the minimum, divide 500 by 50 to get 10. To find the maximum, divide 500 by 10 to get 50. This means that your channel
pool size for this example should be between 10 and 50 connections.
It is also important to monitor your traffic after making changes and adjust the number of connections in your pool if necessary.
###### Set the pool size
The following code sample demonstrates how to configure the channel pool in the client libraries using `DatastoreOptions`.
See [ChannelPoolSettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.grpc.ChannelPoolSettings) and [Performance Best Practices](https://grpc.io/docs/guides/performance/) for more information on channel pools and best practices for performance.
Example:
Code Example
```java
InstantiatingGrpcChannelProvider channelProvider =
DatastoreSettings.defaultGrpcTransportProviderBuilder()
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [2.24.3](https://github.com/googleapis/java-datastore/compare/v2.24.2...v2.24.3) (2024-11-18)


### Dependencies

* Update sdk platform java dependencies ([#1662](https://github.com/googleapis/java-datastore/issues/1662)) ([b4d3ab9](https://github.com/googleapis/java-datastore/commit/b4d3ab9a72bb2a4dff59bf54abcc5d9536b2596b))

## [2.24.2](https://github.com/googleapis/java-datastore/compare/v2.24.1...v2.24.2) (2024-11-06)


Expand Down
90 changes: 64 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,20 @@ If you are using Maven without the BOM, add this to your dependencies:
If you are using Gradle 5.x or later, add this to your dependencies:

```Groovy
implementation platform('com.google.cloud:libraries-bom:26.50.0')
implementation platform('com.google.cloud:libraries-bom:26.51.0')
implementation 'com.google.cloud:google-cloud-datastore'
```
If you are using Gradle without BOM, add this to your dependencies:

```Groovy
implementation 'com.google.cloud:google-cloud-datastore:2.24.2'
implementation 'com.google.cloud:google-cloud-datastore:2.24.3'
```

If you are using SBT, add this to your dependencies:

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-datastore" % "2.24.2"
libraryDependencies += "com.google.cloud" % "google-cloud-datastore" % "2.24.3"
```

## Authentication
Expand Down Expand Up @@ -208,28 +208,33 @@ gRPC Java Datastore Client User Guide
-------
In this feature launch, the [Java Datastore client](https://github.com/googleapis/java-datastore) now offers gRPC as a transport layer option with experimental support. Using [gRPC connection pooling](https://grpc.io/docs/guides/performance/) enables distributing RPCs over multiple connections which may improve performance.

#### Download Instructions
Instructions:
1. Clone the grpc-experimental branch from GitHub:
```python
git clone -b grpc-experimental https://github.com/googleapis/java-datastore.git
```
2. Run the following commands to build the library:
```python
# Go to the directory the code was downloaded to
cd java-datastore/

# Build the library
mvn clean install -DskipTests=true
```
3. Add the following dependency to your project:
```xml
<dependency>
#### Installation Instructions
The client can be built from the `grpc-experimental` branch on GitHub. For private preview, you can also download the artifact with the instructions provided below.

1. Download the datastore private preview package with dependencies:
```
curl -o <path-to-downloaded-jar> https://datastore-sdk-feature-release.web.app/google-cloud-datastore-2.20.0-grpc-experimental-1-SNAPSHOT-jar-with-dependencies.jar
```
2. Run the following commands to install JDK locally:
```
mvn install:install-file -Dfile=<path-to-downloaded-jar> -DgroupId=com.google.cloud -DartifactId=google-cloud-datastore -Dversion=2.20.0-grpc
```
3. Edit your pom.xml to add above package to `<dependencies/>` section:
```xml
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-datastore</artifactId>
<version>2.20.0-grpc-experimental-1-SNAPSHOT</version>
</dependency>
```
</dependency>
```

And if you have not yet, add below to `<repositories/>` section:
```xml
<repository>
<id>local-repo</id>
<url>file://${user.home}/.m2/repository</url>
</repository>
```

#### How to Use
To opt-in to the gRPC transport behavior, simply add the below line of code (`setTransportOptions`) to your Datastore client instantiation.
Expand Down Expand Up @@ -279,11 +284,44 @@ boolean isHTTP = datastore.getOptions().getTransportOptions() instanceof HTTPTra
#### New Features
There are new gRPC specific features available to use in this update.

##### Channel Pooling
To customize the number of channels your client uses, you can update the channel provider in the DatastoreOptions.
##### Connection Pool
A connection pool, also known as a channel pool, is a cache of database connections that are shared and reused to improve connection latency and performance. With this update, now you will be able to configure the channel pool to improve application performance. This section guides you in determining the optimal connection pool size and configuring it within the Java datastore client.
To customize the number of channels your client uses, you can update the channel provider in the DatastoreOptions.
###### Determine the best connection pool size
The default connection pool size is right for most applications, and in most cases there's no need to change it.

However sometimes you may want to change your connection pool size due to high throughput or buffered requests. Ideally, to leave room for traffic fluctuations, a connection pool has about twice the number of connections it takes for maximum saturation. Because a connection can handle a maximum of 100 concurrent requests, between 10 and 50 outstanding requests per connection is optimal. The limit of 100 concurrent streams per gRPC connection is enforced in Google's middleware layer, and you are not able to reconfigure this number.

The following steps help you calculate the optimal number of connections in your channel pool using estimate per-client QPS and average latency numbers.

To calculate the optimal connections, gather the following information:

1. The maximum number of queries per second (QPS) per client when your application is running a typical workload.
2. The average latency (the response time for a single request) in ms.
3. Determine the number of requests that you can send serially per second by dividing 1,000 by the average latency value.
4. Divide the QPS in seconds by the number of serial requests per second.
5. Divide the result by 50 requests per channel to determine the minimum optimal channel pool size. (If your calculation is less than 2, use at least 2 channels anyway, to ensure redundancy.)
6. Divide the same result by 10 requests per channel to determine the maximum optimal channel pool size.

These steps are expressed in the following equations:
```java
(QPS ÷ (1,000 ÷ latency ms)) ÷ 50 streams = Minimum optimal number of connections
(QPS ÷ (1,000 ÷ latency ms)) ÷ 10 streams = Maximum optimal number of connections
```

###### Example
Your application typically sends 50,000 requests per second, and the average latency is 10 ms. Divide 1,000 by 10 ms to determine that you can send 100 requests serially per second.
Divide that number into 50,000 to get the parallelism needed to send 50,000 QPS: 500. Each channel can have at most 100 requests out concurrently, and your target channel utilization
is between 10 and 50 concurrent streams. Therefore, to calculate the minimum, divide 500 by 50 to get 10. To find the maximum, divide 500 by 10 to get 50. This means that your channel
pool size for this example should be between 10 and 50 connections.

It is also important to monitor your traffic after making changes and adjust the number of connections in your pool if necessary.

###### Set the pool size
The following code sample demonstrates how to configure the channel pool in the client libraries using `DatastoreOptions`.
See [ChannelPoolSettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.grpc.ChannelPoolSettings) and [Performance Best Practices](https://grpc.io/docs/guides/performance/) for more information on channel pools and best practices for performance.

Example:
Code Example
```java
InstantiatingGrpcChannelProvider channelProvider =
DatastoreSettings.defaultGrpcTransportProviderBuilder()
Expand Down Expand Up @@ -479,7 +517,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-datastore/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-datastore.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-datastore/2.24.2
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-datastore/2.24.3
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
4 changes: 2 additions & 2 deletions datastore-v1-proto-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.cloud.datastore</groupId>
<artifactId>datastore-v1-proto-client</artifactId>
<version>2.24.3-SNAPSHOT</version><!-- {x-version-update:datastore-v1-proto-client:current} -->
<version>2.24.3</version><!-- {x-version-update:datastore-v1-proto-client:current} -->

<parent>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-datastore-parent</artifactId>
<version>2.24.3-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
<version>2.24.3</version><!-- {x-version-update:google-cloud-datastore:current} -->
</parent>

<packaging>jar</packaging>
Expand Down
6 changes: 3 additions & 3 deletions generation_config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
gapic_generator_version: 2.49.0
googleapis_commitish: 5257378f52352e70b8995713f0d4484bdab7e71d
libraries_bom_version: 26.50.0
gapic_generator_version: 2.50.0
googleapis_commitish: 0f3a20ebd29fb1deb2bd1f75c7ba55500d35457d
libraries_bom_version: 26.51.0
libraries:
- api_shortname: datastore
name_pretty: Cloud Datastore
Expand Down
10 changes: 5 additions & 5 deletions google-cloud-datastore-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-datastore-bom</artifactId>
<version>2.24.3-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore-bom:current} -->
<version>2.24.3</version><!-- {x-version-update:google-cloud-datastore-bom:current} -->
<packaging>pom</packaging>
<parent>
<groupId>com.google.cloud</groupId>
Expand Down Expand Up @@ -52,22 +52,22 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-datastore</artifactId>
<version>2.24.3-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
<version>2.24.3</version><!-- {x-version-update:google-cloud-datastore:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-cloud-datastore-admin-v1</artifactId>
<version>2.24.3-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-datastore-admin-v1:current} -->
<version>2.24.3</version><!-- {x-version-update:grpc-google-cloud-datastore-admin-v1:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-datastore-v1</artifactId>
<version>0.115.3-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-datastore-v1:current} -->
<version>0.115.3</version><!-- {x-version-update:proto-google-cloud-datastore-v1:current} -->
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-datastore-admin-v1</artifactId>
<version>2.24.3-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-datastore-admin-v1:current} -->
<version>2.24.3</version><!-- {x-version-update:proto-google-cloud-datastore-admin-v1:current} -->
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
4 changes: 2 additions & 2 deletions google-cloud-datastore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>google-cloud-datastore</artifactId>
<version>2.24.3-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
<version>2.24.3</version><!-- {x-version-update:google-cloud-datastore:current} -->
<packaging>jar</packaging>
<name>Google Cloud Datastore</name>
<url>https://github.com/googleapis/java-datastore</url>
Expand All @@ -12,7 +12,7 @@
<parent>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-datastore-parent</artifactId>
<version>2.24.3-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore:current} -->
<version>2.24.3</version><!-- {x-version-update:google-cloud-datastore:current} -->
</parent>
<properties>
<site.installationModule>google-cloud-datastore</site.installationModule>
Expand Down
Loading

0 comments on commit af8b46f

Please sign in to comment.