You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "pingtimeout (via GitHub)" <gi...@apache.org> on 2025/03/19 14:40:10 UTC

[PR] Add Polaris benchmarks that use the REST APIs [polaris]

pingtimeout opened a new pull request, #1208:
URL: https://github.com/apache/polaris/pull/1208

   This pull request introduces a comprehensive set of benchmarks to Polaris.  The current set includes:
   
   * A benchmark that populates an empty Polaris server with a dataset that have predefined attributes
   * A benchmark that issues only read queries over that dataset
   * A benchmark that issues read and write queries (entity updates) over that dataset, with a configurable read/write ratio
   
   A documentation if provided in the README.md file, including examples of the different datasets that can be generated.  The datasets are procedural, which means that given the same input parameters, the same datasets will be generated, thus enabling reproducible benchmarks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Polaris benchmarks that use the REST APIs [polaris]

Posted by "pingtimeout (via GitHub)" <gi...@apache.org>.
pingtimeout commented on code in PR #1208:
URL: https://github.com/apache/polaris/pull/1208#discussion_r2003670114


##########
.scalafmt.conf:
##########
@@ -0,0 +1,25 @@
+# Scalafmt is used to reformat Gatling benchmarks from the benchmarks/ directory

Review Comment:
   I am ok with replacing that with anything.  To be honest, I just did not want to care about any formatting concern while I was working on benchmarks.  I understand that the rules in that scalafmt config file could be very different from those adopted by Polaris.  



##########
gradle/projects.main.properties:
##########
@@ -36,6 +36,7 @@ aggregated-license-report=aggregated-license-report
 polaris-immutables=tools/immutables
 polaris-container-spec-helper=tools/container-spec-helper
 polaris-version=tools/version
+polaris-benchmarks=benchmarks

Review Comment:
   It could be.  I am also considering removing the `Iceberg` mention from the benchmarks folder altogether as the benchmarks also relies on the Management API, and is not just an Iceberg REST API benchmark.  Let's wait until we reach consensus on where the benchmarks should live before we move this around though.



##########
getting-started/assets/polaris/create-catalog.sh:
##########
@@ -50,7 +50,7 @@ curl -s -H "Authorization: Bearer ${token}" \
        "storageConfigInfo": {
          "storageType": "FILE",
          "allowedLocations": [
-           "file:///tmp"
+           "file:///tmp/polaris/"

Review Comment:
   Kind of.  That one is a bit of a 🥷.  The current getting-started code prevents any catalog to be created under `/tmp/` altogether, even though a single catalog is created under `/tmp/polaris`.  See L48 of this file.  Updating the allowedLocations attribute to match that of the catalog makes it possible to created any number of catalogs under `/tmp/`.



##########
benchmarks/build.gradle.kts:
##########
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+plugins {
+    id("scala")
+    id("io.gatling.gradle") version "3.13.4.1"
+    id("com.diffplug.spotless")
+}
+
+dependencies {
+    gatling("com.typesafe.play:play-json_2.13:2.9.4")
+}
+
+description = "Polaris Iceberg REST API performance tests"
+
+spotless {
+    scala {
+        // Use scalafmt for Scala formatting
+        scalafmt("3.9.3").configFile("../.scalafmt.conf")
+    }
+}

Review Comment:
   Do you think there should be a `polaris-scala.gradle.kts` file?  I wouldn't mind adding `polaris-server` there, really.  But the code does not strictly depend on Polaris server.  It might actually be moved to the tools repository



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Polaris benchmarks that use the REST APIs [polaris]

Posted by "pingtimeout (via GitHub)" <gi...@apache.org>.
pingtimeout commented on PR #1208:
URL: https://github.com/apache/polaris/pull/1208#issuecomment-2736932166

   Related to #1120 although these are Gatling benchmarks, not JMeter.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Polaris benchmarks that use the REST APIs [polaris]

Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy commented on PR #1208:
URL: https://github.com/apache/polaris/pull/1208#issuecomment-2739407272

   (same comment as in #1211)
   
   So, let me summarize:
   a) the project wants a Spark plugin, and Spark relies on Scala
   b) the project wants the benchmarks, and those run on Gatling, ẃhich relies on Scala
   
   I'm not a Scala fan, but for Spark + Gatling there's just no way around that.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Polaris benchmarks that use the REST APIs [polaris]

Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy commented on code in PR #1208:
URL: https://github.com/apache/polaris/pull/1208#discussion_r2003873471


##########
benchmarks/docs/dataset-shape-2-3-5.svg:
##########


Review Comment:
   The SVGs also need a (C) header (it's effectively just XML)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Polaris benchmarks that use the REST APIs [polaris]

Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy commented on code in PR #1208:
URL: https://github.com/apache/polaris/pull/1208#discussion_r2003871069


##########
benchmarks/build.gradle.kts:
##########
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+plugins {
+    id("scala")
+    id("io.gatling.gradle") version "3.13.4.1"
+    id("com.diffplug.spotless")
+}
+
+dependencies {
+    gatling("com.typesafe.play:play-json_2.13:2.9.4")
+}
+
+description = "Polaris Iceberg REST API performance tests"
+
+spotless {
+    scala {
+        // Use scalafmt for Scala formatting
+        scalafmt("3.9.3").configFile("../.scalafmt.conf")
+    }
+}

Review Comment:
   Or better: #1211 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Polaris benchmarks that use the REST APIs [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on PR #1208:
URL: https://github.com/apache/polaris/pull/1208#issuecomment-2738722877

   Scala is natural to Gatling. I do not see it as a blocker for adopting a well-written tool (like this PR)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Polaris benchmarks that use the REST APIs [polaris]

Posted by "pingtimeout (via GitHub)" <gi...@apache.org>.
pingtimeout closed pull request #1208: Add Polaris benchmarks that use the REST APIs
URL: https://github.com/apache/polaris/pull/1208


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Polaris benchmarks that use the REST APIs [polaris]

Posted by "collado-mike (via GitHub)" <gi...@apache.org>.
collado-mike commented on code in PR #1208:
URL: https://github.com/apache/polaris/pull/1208#discussion_r2009146933


##########
benchmarks/src/gatling/scala/org/apache/polaris/benchmarks/actions/CatalogActions.scala:
##########
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.polaris.benchmarks.actions
+
+import io.gatling.core.Predef._
+import io.gatling.core.feeder.Feeder
+import io.gatling.core.structure.ChainBuilder
+import io.gatling.http.Predef._
+import org.apache.polaris.benchmarks.RetryOnHttpCodes.{
+  retryOnHttpStatus,
+  HttpRequestBuilderWithStatusSave
+}
+import org.apache.polaris.benchmarks.parameters.DatasetParameters
+import org.slf4j.LoggerFactory
+
+import java.util.concurrent.atomic.AtomicReference
+
+/**
+ * Actions for performance testing catalog operations in Apache Iceberg. This class provides methods
+ * to create and fetch catalogs.
+ *
+ * @param dp Dataset parameters controlling the dataset generation
+ * @param accessToken Reference to the authentication token for API requests
+ * @param maxRetries Maximum number of retry attempts for failed operations
+ * @param retryableHttpCodes HTTP status codes that should trigger a retry
+ */
+case class CatalogActions(
+    dp: DatasetParameters,
+    accessToken: AtomicReference[String],
+    maxRetries: Int = 10,
+    retryableHttpCodes: Set[Int] = Set(409, 500)
+) {
+  private val logger = LoggerFactory.getLogger(getClass)

Review Comment:
   It's not a constant. It's an immutable field



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Polaris benchmarks that use the REST APIs [polaris]

Posted by "pingtimeout (via GitHub)" <gi...@apache.org>.
pingtimeout commented on PR #1208:
URL: https://github.com/apache/polaris/pull/1208#issuecomment-2769780861

   Closed this PR and opened a new one against the polaris-tools repository: https://github.com/apache/polaris-tools/pull/2


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Polaris benchmarks that use the REST APIs [polaris]

Posted by "pingtimeout (via GitHub)" <gi...@apache.org>.
pingtimeout commented on PR #1208:
URL: https://github.com/apache/polaris/pull/1208#issuecomment-2739646295

   @flyrain let's continue this discussion on the dev mailing list and keep the PR comments for actual code review.  JB has already raised the question of the best location for this tool (polaris or polaris-tools) and no decision has been made yet.  Depending on the decision, that could answer your comment "_I think we should avoid introducing a new language into the Polaris main repo._".


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Polaris benchmarks that use the REST APIs [polaris]

Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy commented on code in PR #1208:
URL: https://github.com/apache/polaris/pull/1208#discussion_r2003527755


##########
benchmarks/build.gradle.kts:
##########
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+plugins {
+    id("scala")

Review Comment:
   Nit:
   ```suggestion
       scala
   ```



##########
benchmarks/build.gradle.kts:
##########
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+plugins {
+    id("scala")
+    id("io.gatling.gradle") version "3.13.4.1"
+    id("com.diffplug.spotless")
+}
+
+dependencies {
+    gatling("com.typesafe.play:play-json_2.13:2.9.4")
+}
+
+description = "Polaris Iceberg REST API performance tests"
+
+spotless {
+    scala {
+        // Use scalafmt for Scala formatting
+        scalafmt("3.9.3").configFile("../.scalafmt.conf")
+    }
+}

Review Comment:
   It's probably better to have [the spotless parts](https://github.com/apache/polaris/pull/1203/files#diff-8dfadd8fa1b8d3481c35056ba0b776f249e34b2337dd5d43f545cdf6910501dcR184-R191) in `polaris-java.gradle.kts`. Adding `polaris-server` as a plugin would then pull that in.



##########
.scalafmt.conf:
##########
@@ -0,0 +1,25 @@
+# Scalafmt is used to reformat Gatling benchmarks from the benchmarks/ directory

Review Comment:
   I suspect this fails the `rat` check (no (C) header).



##########
benchmarks/src/gatling/resources/logback-test.xml:
##########
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>

Review Comment:
   (C) header missing



##########
gradle/libs.versions.toml:
##########
@@ -100,3 +100,4 @@ jandex = { id = "org.kordamp.gradle.jandex", version = "2.1.0" }
 openapi-generator = { id = "org.openapi.generator", version = "7.12.0" }
 quarkus = { id = "io.quarkus", version.ref = "quarkus" }
 rat = { id = "org.nosphere.apache.rat", version = "0.8.1" }
+gatling = { id = "io.gatling.gradle", version = "3.13.4.1" }

Review Comment:
   Please add a trailing linebreak



##########
benchmarks/src/gatling/scala/org/apache/polaris/benchmarks/actions/CatalogActions.scala:
##########
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.polaris.benchmarks.actions
+
+import io.gatling.core.Predef._
+import io.gatling.core.feeder.Feeder
+import io.gatling.core.structure.ChainBuilder
+import io.gatling.http.Predef._
+import org.apache.polaris.benchmarks.RetryOnHttpCodes.{
+  retryOnHttpStatus,
+  HttpRequestBuilderWithStatusSave
+}
+import org.apache.polaris.benchmarks.parameters.DatasetParameters
+import org.slf4j.LoggerFactory
+
+import java.util.concurrent.atomic.AtomicReference
+
+/**
+ * Actions for performance testing catalog operations in Apache Iceberg. This class provides methods
+ * to create and fetch catalogs.
+ *
+ * @param dp Dataset parameters controlling the dataset generation
+ * @param accessToken Reference to the authentication token for API requests
+ * @param maxRetries Maximum number of retry attempts for failed operations
+ * @param retryableHttpCodes HTTP status codes that should trigger a retry
+ */
+case class CatalogActions(
+    dp: DatasetParameters,
+    accessToken: AtomicReference[String],
+    maxRetries: Int = 10,
+    retryableHttpCodes: Set[Int] = Set(409, 500)
+) {
+  private val logger = LoggerFactory.getLogger(getClass)

Review Comment:
   Not sure about the usual Scala nomenclature - should `logger` be all upper case to indicate that it's a constant?



##########
benchmarks/src/gatling/scala/org/apache/polaris/benchmarks/DatasetVerificationSimulation.scala:
##########
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.polaris.benchmarks
+
+import org.apache.polaris.benchmarks.simulations.ReadUpdateTreeDatasetConcurrent
+
+/**
+ * This simulation is only kept for compatibility reasons. It is recommended to use the
+ * ReadTreeDataset class directly instead.
+ */
+class DatasetVerificationSimulation extends ReadUpdateTreeDatasetConcurrent {}

Review Comment:
   Same here (remove, nothing to be compatible with)



##########
benchmarks/docs/dataset-shape-1-1000-7.puml:
##########
@@ -0,0 +1,49 @@
+@startuml

Review Comment:
   Similar here, I suspect those files fail the `rat` check



##########
.scalafmt.conf:
##########
@@ -0,0 +1,25 @@
+# Scalafmt is used to reformat Gatling benchmarks from the benchmarks/ directory

Review Comment:
   spotless parts are also in #1203 (see also below). I don't mind to have this file as "the" formatting rule - but it should live in the `gradle/` or maybe better in the `codestyle/` folder.



##########
getting-started/assets/polaris/create-catalog.sh:
##########
@@ -50,7 +50,7 @@ curl -s -H "Authorization: Bearer ${token}" \
        "storageConfigInfo": {
          "storageType": "FILE",
          "allowedLocations": [
-           "file:///tmp"
+           "file:///tmp/polaris/"

Review Comment:
   Unrelated change?



##########
benchmarks/README.md:
##########
@@ -0,0 +1,177 @@
+# Polaris Benchmarks
+
+This repository contains benchmarks for the Polaris service using Gatling.
+
+## Available Benchmarks
+
+### Dataset Creation Benchmark
+
+The CreateTreeDataset benchmark creates a test dataset with a specific structure. It exists in two variants:
+
+- `org.apache.polaris.benchmarks.simulations.CreateTreeDatasetSequential`: Creates entities one at a time
+- `org.apache.polaris.benchmarks.simulations.CreateTreeDatasetConcurrent`: Creates up to 50 entities simultaneously
+
+These are write-only workloads designed to populate the system for subsequent benchmarks.
+
+### Read/Update Benchmark
+
+The ReadUpdateTreeDataset benchmark tests read and update operations on an existing dataset. It exists in two variants:
+
+- `org.apache.polaris.benchmarks.simulations.ReadUpdateTreeDatasetSequential`: Performs read/update operations one at a time
+- `org.apache.polaris.benchmarks.simulations.ReadUpdateTreeDatasetConcurrent`: Performs up to 20 read/update operations simultaneously
+
+These benchmarks can only be run after using CreateTreeDataset to populate the system.
+
+## Parameters
+
+### Dataset Structure Parameters
+
+These parameters must be consistent across all benchmarks:
+
+- `NUM_CATALOGS`: Number of catalogs to create (default: 1)
+- `NAMESPACE_WIDTH`: Width of the namespace tree (default: 2)
+- `NAMESPACE_DEPTH`: Depth of the namespace tree (default: 4)
+- `NUM_TABLES_PER_NAMESPACE`: Tables per namespace (default: 5)
+- `NUM_VIEWS_PER_NAMESPACE`: Views per namespace (default: 3)
+- `NUM_COLUMNS`: Columns per table (default: 10)
+- `DEFAULT_BASE_LOCATION`: Base location for datasets (default: file:///tmp/polaris)
+
+### Workload Parameters
+
+These parameters can vary between benchmarks:
+
+- `CLIENT_ID`: Required OAuth2 client ID
+- `CLIENT_SECRET`: Required OAuth2 client secret
+- `BASE_URL`: Service URL (default: http://localhost:8181)
+- `READ_WRITE_RATIO`: Ratio of read to write operations (for ReadUpdateTreeDataset only)
+
+## Running the Benchmarks
+
+Required environment variables:
+```bash
+export CLIENT_ID=your_client_id
+export CLIENT_SECRET=your_client_secret
+export BASE_URL=http://your-polaris-instance:8181
+```
+
+To run the sequential dataset creation benchmark:
+```bash
+./gradlew gatlingRun-org.apache.polaris.benchmarks.simulations.CreateTreeDatasetSequential
+```
+
+To run the concurrent dataset creation benchmark:
+```bash
+./gradlew gatlingRun-org.apache.polaris.benchmarks.simulations.CreateTreeDatasetConcurrent
+```
+
+To run the sequential read/update benchmark:
+```bash
+export READ_WRITE_RATIO=0.8  # 80% reads, 20% writes
+./gradlew gatlingRun-org.apache.polaris.benchmarks.simulations.ReadUpdateTreeDatasetSequential
+```
+
+To run the concurrent read/update benchmark:
+```bash
+export READ_WRITE_RATIO=0.8  # 80% reads, 20% writes
+./gradlew gatlingRun-org.apache.polaris.benchmarks.simulations.ReadUpdateTreeDatasetConcurrent
+```
+
+A message will show the location of the Gatling report:
+```
+Reports generated in: ./benchmarks/build/reports/gatling/<simulation-name>/index.html
+```
+

Review Comment:
   ```suggestion
   
   ### Example Polaris server startup
   
   For repeated testing and benchmarking purposes it's convenient to have fixed client-ID + client-secret combinations. **The following example is ONLY for testing and benchmarking against an airgapped Polaris instance**
   
   ```bash
   # Start Polaris with the fixed client-ID/secret admin/admin
   # DO NEVER EVER USE THE FOLLOWING FOR ANY NON-AIRGAPPED POLARIS INSTANCE !!
   ./gradlew :polaris-quarkus-server:quarkusBuild &&  java \
     -Dpolaris.bootstrap.credentials=POLARIS,admin,admin \
     -Djava.security.manager=allow \
     -jar quarkus/server/build/quarkus-app/quarkus-run.jar
   
   With the above you can run the benchmarks with the environment variables `CLIENT_ID=admin` and `CLIENT_SECRET=admin` - meant only for convenience in a fully airgapped system.
   ```
   



##########
gradle/projects.main.properties:
##########
@@ -36,6 +36,7 @@ aggregated-license-report=aggregated-license-report
 polaris-immutables=tools/immutables
 polaris-container-spec-helper=tools/container-spec-helper
 polaris-version=tools/version
+polaris-benchmarks=benchmarks

Review Comment:
   Wonder if this work should go under `benchmarks/iceberg-rest` so we can have all benchmarks grouped together.



##########
benchmarks/src/gatling/scala/org/apache/polaris/benchmarks/DatasetCreationSimulation.scala:
##########
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.polaris.benchmarks
+
+import org.apache.polaris.benchmarks.simulations.CreateTreeDatasetConcurrent
+
+/**
+ * This simulation is only kept for compatibility reasons. It is recommended to use the
+ * CreateTreeDataset class directly instead.

Review Comment:
   Let's remove this class - there's nothing to be compatible with ;) 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Polaris benchmarks that use the REST APIs [polaris]

Posted by "eric-maynard (via GitHub)" <gi...@apache.org>.
eric-maynard commented on PR #1208:
URL: https://github.com/apache/polaris/pull/1208#issuecomment-2744341476

   > b) the project wants the benchmarks, and those run on Gatling, ẃhich relies on Scala
   
   You can write gatling benchmarks in a language other than Scala.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Polaris benchmarks that use the REST APIs [polaris]

Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy commented on code in PR #1208:
URL: https://github.com/apache/polaris/pull/1208#discussion_r2003870685


##########
benchmarks/build.gradle.kts:
##########
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+plugins {
+    id("scala")
+    id("io.gatling.gradle") version "3.13.4.1"
+    id("com.diffplug.spotless")
+}
+
+dependencies {
+    gatling("com.typesafe.play:play-json_2.13:2.9.4")
+}
+
+description = "Polaris Iceberg REST API performance tests"
+
+spotless {
+    scala {
+        // Use scalafmt for Scala formatting
+        scalafmt("3.9.3").configFile("../.scalafmt.conf")
+    }
+}

Review Comment:
   Opened a PR against your branch...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Polaris benchmarks that use the REST APIs [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on PR #1208:
URL: https://github.com/apache/polaris/pull/1208#issuecomment-2744390708

   @pingtimeout , I'm not against a new language like Scala, my main concern is how we manage the complexity.  I'm supportive on the idea of putting this tool in a different repo, either `Polaris-tools` or other one if needed. This is also what a lot of other OSS projects do for implementations and tools in different languages. 
   An alternative is converting it in Java might also not a bad idea, we could avoid Scala version issues largely, while still keep the tool within one repo. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Polaris benchmarks that use the REST APIs [polaris]

Posted by "pingtimeout (via GitHub)" <gi...@apache.org>.
pingtimeout commented on code in PR #1208:
URL: https://github.com/apache/polaris/pull/1208#discussion_r2009164771


##########
benchmarks/src/gatling/scala/org/apache/polaris/benchmarks/actions/CatalogActions.scala:
##########
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.polaris.benchmarks.actions
+
+import io.gatling.core.Predef._
+import io.gatling.core.feeder.Feeder
+import io.gatling.core.structure.ChainBuilder
+import io.gatling.http.Predef._
+import org.apache.polaris.benchmarks.RetryOnHttpCodes.{
+  retryOnHttpStatus,
+  HttpRequestBuilderWithStatusSave
+}
+import org.apache.polaris.benchmarks.parameters.DatasetParameters
+import org.slf4j.LoggerFactory
+
+import java.util.concurrent.atomic.AtomicReference
+
+/**
+ * Actions for performance testing catalog operations in Apache Iceberg. This class provides methods
+ * to create and fetch catalogs.
+ *
+ * @param dp Dataset parameters controlling the dataset generation
+ * @param accessToken Reference to the authentication token for API requests
+ * @param maxRetries Maximum number of retry attempts for failed operations
+ * @param retryableHttpCodes HTTP status codes that should trigger a retry
+ */
+case class CatalogActions(
+    dp: DatasetParameters,
+    accessToken: AtomicReference[String],
+    maxRetries: Int = 10,
+    retryableHttpCodes: Set[Int] = Set(409, 500)
+) {
+  private val logger = LoggerFactory.getLogger(getClass)

Review Comment:
   Indeed, this one is a bit confusing.  As per [the naming conventions](https://docs.scala-lang.org/style/naming-conventions.html#constants-values-and-variables), it is not a constant.  Given that although it is an immutable, final field, it is not static.
   
   And really, a logger should not be created in each instance of a class.  So that's where the confusion comes from.  To be completely correct, there should be a companion `object CatalogActions` where that constant is defined.  But I think it would make the code unnecessarily more complex, especially considering that there should be only one instance of `CatalogActions` per simulation.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Polaris benchmarks that use the REST APIs [polaris]

Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy commented on code in PR #1208:
URL: https://github.com/apache/polaris/pull/1208#discussion_r2009643475


##########
benchmarks/src/gatling/scala/org/apache/polaris/benchmarks/actions/CatalogActions.scala:
##########
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.polaris.benchmarks.actions
+
+import io.gatling.core.Predef._
+import io.gatling.core.feeder.Feeder
+import io.gatling.core.structure.ChainBuilder
+import io.gatling.http.Predef._
+import org.apache.polaris.benchmarks.RetryOnHttpCodes.{
+  retryOnHttpStatus,
+  HttpRequestBuilderWithStatusSave
+}
+import org.apache.polaris.benchmarks.parameters.DatasetParameters
+import org.slf4j.LoggerFactory
+
+import java.util.concurrent.atomic.AtomicReference
+
+/**
+ * Actions for performance testing catalog operations in Apache Iceberg. This class provides methods
+ * to create and fetch catalogs.
+ *
+ * @param dp Dataset parameters controlling the dataset generation
+ * @param accessToken Reference to the authentication token for API requests
+ * @param maxRetries Maximum number of retry attempts for failed operations
+ * @param retryableHttpCodes HTTP status codes that should trigger a retry
+ */
+case class CatalogActions(
+    dp: DatasetParameters,
+    accessToken: AtomicReference[String],
+    maxRetries: Int = 10,
+    retryableHttpCodes: Set[Int] = Set(409, 500)
+) {
+  private val logger = LoggerFactory.getLogger(getClass)

Review Comment:
   Ah, true - Scala stuff. All good.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Polaris benchmarks that use the REST APIs [polaris]

Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on code in PR #1208:
URL: https://github.com/apache/polaris/pull/1208#discussion_r2003561411


##########
benchmarks/README.md:
##########
@@ -0,0 +1,177 @@
+# Polaris Benchmarks

Review Comment:
   ASF header is missing here.



##########
benchmarks/src/gatling/resources/logback-test.xml:
##########
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>

Review Comment:
   ASF header is missing here.



##########
.scalafmt.conf:
##########
@@ -0,0 +1,25 @@
+# Scalafmt is used to reformat Gatling benchmarks from the benchmarks/ directory

Review Comment:
   ASF header is missing here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Polaris benchmarks that use the REST APIs [polaris]

Posted by "pingtimeout (via GitHub)" <gi...@apache.org>.
pingtimeout commented on PR #1208:
URL: https://github.com/apache/polaris/pull/1208#issuecomment-2745371079

   @flyrain In case it can help, Gatling is only compatible and compiled against Scala 2.13.  There is no other supported version whatsoever.  So assuming we only *use* Gatling (as opposed to creating Gatling plugins), the integration should be limited to pointing to the right executable.
   
   @eric-maynard @snazy @dimas-b I just sent a response on the `Polaris benchmarks proposal` thread on the dev ML.  This is a discussion that should happen outside of PR comments.  Let's have it there please.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add Polaris benchmarks that use the REST APIs [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on PR #1208:
URL: https://github.com/apache/polaris/pull/1208#issuecomment-2738474814

   Thanks @pingtimeout for the benchmark tools. It's pretty useful. Can we convert the code to Java code? I think we should avoid introducing a new language into the Polaris main repo. It increases complexity and reduce maintainability, especially considering the Scala compatibilities issue across multiple versions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org