Skip to content

Prereview of "Revamp the ktor-exposed portion and add new variant benchmarks with R2DBC"#5

Closed
ShreckYe wants to merge 18 commits intomasterfrom
ktor-exposed-revamp-dec-2025
Closed

Prereview of "Revamp the ktor-exposed portion and add new variant benchmarks with R2DBC"#5
ShreckYe wants to merge 18 commits intomasterfrom
ktor-exposed-revamp-dec-2025

Conversation

@ShreckYe
Copy link
Copy Markdown
Member

@ShreckYe ShreckYe commented Dec 23, 2025

Major changes:

  • Bump all dependencies and toolchains to the latest.
  • Migrate to Exposed v1 APIs.
  • Add Exposed R2DBC benchmarks and restructure the code for better abstraction.
  • Revert to use ParallelGC in all Ktor benchmarks. As run on my device, "Requests/sec" results of the db and json tests of the ktor portion are improved greatly.

Misc changes:

  • Init the result mutable list and add elements with mapTo in the fortunes test instead to slightly improve some performance, as in the vertx-web-kotlinx portion.
  • Split the code into multiple files and reorganize the code for better separation of concerns.
  • Copy the optimized kotlinx-serialization Json configuration from the ktor portion.
  • Fix inconsistent ports replacing all 8080s with 9090.

…fortunes` test instead, as in the `vertx-web-kotlinx` portion

Since this test is imperative we don't need to write it the functional way, and we also save some `Sequence` transformations which should reduce some overhead.
Copy the JDBC configs from the `ktor` portion again and comment about it BTW.
As run on my device, "Requests/sec" results of the `db` and `json` tests of the `ktor` portion are improved greatly.
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @ShreckYe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request undertakes a comprehensive revamp of the ktor-exposed benchmark implementation. It involves a significant upgrade of all project dependencies and toolchains, a migration to the latest Exposed v1 APIs, and the crucial addition of new R2DBC benchmark variants. The codebase has been extensively refactored to enhance abstraction and support the new R2DBC integration. Furthermore, performance has been targeted through the consistent application of ParallelGC in Ktor benchmarks and other minor code optimizations.

Highlights

  • Dependency and Toolchain Updates: All project dependencies and toolchains have been updated to their latest versions, including Kotlin (2.3.0), kotlinx-serialization (1.9.0), Gradle (9.2.1), Exposed (1.0.0-rc-4), PostgreSQL driver (42.7.8), and HikariCP (7.0.2). The JVM toolchain has been upgraded to JDK 25.
  • Exposed v1 Migration and R2DBC Support: The ktor-exposed portion has been migrated to the new Exposed v1 APIs. This includes the introduction of new R2DBC benchmark variants, requiring significant code restructuring to support both JDBC and R2DBC connection modes through a new ExposedOps interface.
  • Code Restructuring and Abstraction: The ktor-exposed application code has been extensively refactored into multiple files (Json.kt, Models.kt, database/Exposed.kt, database/Jdbc.kt, database/R2dbc.kt) to improve abstraction, separation of concerns, and maintainability.
  • Performance Tuning with ParallelGC: The Ktor benchmarks, including the new Exposed R2DBC variants, now consistently use ParallelGC for the JVM, which has been noted to greatly improve 'Requests/sec' results in db and json tests.
  • Optimized Fortune Handling: The fortunes test has been optimized by initializing the result mutable list and using mapTo for populating it, aiming for slight performance improvements.
  • Gradle Wrapper Updates: The Gradle wrapper scripts (gradlew and gradlew.bat) have been updated to reflect changes in Gradle 9.x, including copyright updates, SPDX license identifiers, and a shift from classpath-based execution to JAR-based execution for the wrapper.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a significant and well-executed revamp of the ktor-exposed benchmarks. The migration to Exposed v1, addition of R2DBC support, and major code restructuring are excellent improvements. The code is now much more modular and easier to understand. I've identified a critical issue with the Docker configuration that will prevent the new benchmarks from building, and another critical performance issue where blocking JDBC calls could starve the Ktor event loop. I've also included some high-severity suggestions to improve performance by introducing concurrency for database queries, and a medium-severity suggestion to improve code clarity. Overall, great work on this complex refactoring.

Comment thread frameworks/Kotlin/ktor/ktor-exposed-jdbc-dao.dockerfile
Comment thread frameworks/Kotlin/ktor/ktor-exposed/app/src/main/kotlin/App.kt
Comment thread frameworks/Kotlin/ktor/ktor-exposed/app/src/main/kotlin/App.kt
Comment thread frameworks/Kotlin/ktor/ktor-exposed/app/src/main/kotlin/App.kt
Comment thread frameworks/Kotlin/ktor/ktor-exposed/app/src/main/kotlin/App.kt
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR is a major refactoring of the ktor-exposed benchmark portion, migrating from Exposed v0 to v1 APIs, adding R2DBC support alongside JDBC, and updating all dependencies and toolchains to the latest versions. The changes also include switching from G1GC to ParallelGC for improved performance, restructuring the code for better abstraction using a repository pattern, and creating separate benchmark variants for JDBC/R2DBC with DSL/DAO modes.

Key changes:

  • Migration to Exposed v1 APIs with separate JDBC and R2DBC support
  • Dependency and toolchain updates (Kotlin, Gradle, JDK, and libraries)
  • Code restructuring with repository pattern for better separation of concerns
  • Addition of new R2DBC benchmark variant configurations

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
ktor.dockerfile Updated JVM GC flag from G1GC to ParallelGC
ktor-r2dbc.dockerfile Updated JVM GC flag from G1GC to ParallelGC
ktor-exposed/gradlew.bat Updated Gradle wrapper script to newer version
ktor-exposed/gradlew Updated Gradle wrapper script to newer version
ktor-exposed/gradle/wrapper/gradle-wrapper.properties Upgraded Gradle version with validation
ktor-exposed/gradle/wrapper/gradle-wrapper.jar Updated Gradle wrapper JAR binary
ktor-exposed/app/src/main/kotlin/database/R2dbc.kt New R2DBC connection configuration
ktor-exposed/app/src/main/kotlin/database/Jdbc.kt Extracted JDBC configuration
ktor-exposed/app/src/main/kotlin/database/Exposed.kt Extracted Exposed table definitions and mapping functions
ktor-exposed/app/src/main/kotlin/Models.kt Extracted data model classes
ktor-exposed/app/src/main/kotlin/Json.kt Extracted JSON configuration
ktor-exposed/app/src/main/kotlin/App.kt Refactored with repository pattern supporting both JDBC and R2DBC modes
ktor-exposed/app/build.gradle.kts Updated dependencies, toolchain, and plugin versions
ktor-exposed-r2dbc-dsl.dockerfile New dockerfile for R2DBC DSL variant
ktor-exposed-jdbc-dsl.dockerfile New dockerfile for JDBC DSL variant
ktor-exposed-jdbc-dao.dockerfile Updated dockerfile with new command arguments
ktor-exposed-dsl.dockerfile Removed legacy dockerfile
benchmark_config.json Updated benchmark configurations with new variant names
Comments suppressed due to low confidence (2)

frameworks/Kotlin/ktor/ktor-exposed-jdbc-dao.dockerfile:1

  • The Docker base image "gradle:jdk25" does not exist. The Gradle Docker images use JDK versions that are actually released. As of the current date, there is no JDK 25. This should be changed to a valid image such as "gradle:jdk21" or "gradle:jdk23".
    frameworks/Kotlin/ktor/ktor-exposed-jdbc-dao.dockerfile:8
  • The exposed port is inconsistent. The port is set to 8080 in the EXPOSE directive but the application is configured to start on port 9090 in the main function. These should match to avoid confusion and potential connection issues.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread frameworks/Kotlin/ktor/ktor-exposed-r2dbc-dsl.dockerfile Outdated
Comment thread frameworks/Kotlin/ktor/ktor-exposed-jdbc-dsl.dockerfile Outdated
Comment thread frameworks/Kotlin/ktor/ktor-exposed/app/build.gradle.kts Outdated
@ShreckYe ShreckYe force-pushed the ktor-exposed-revamp-dec-2025 branch from e8e9e21 to 6456fc1 Compare December 24, 2025 12:05
@ShreckYe ShreckYe closed this Dec 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants