Skip to content

Performance degradation due to Kotlin value class checks #32334

Closed
@koo-taejin

Description

@koo-taejin

Affects: : >= 6.1.2
Related issue : #31698

Since spring-boot 3.2.1, we have noticed a significant performance drop in our application.
A colleague of mine (@koisyu) have tried to figure out the cause.
He had analyzed that loading the Java class every time while invoking getClassifier() from KType was the reason.
I think that if cache these parts, spring-framework can use this feature with similar performance as before.

Steps to reproduce

This is a very simple Kotlin-based controller method that makes it easy to test.

@GetMapping("/message")
fun message(message1: String, message2: String, message3: String): String {
    return "$message1 $message2 $message3"
}

benchmark

  • spring-boot 3.2.0
[~/Workspaces/spring]$ hey -n 100000 -c 1 http://localhost:8080/message\?message1\=hello\&message2\=hi\&message3\=thanks

Summary:
  Total:	13.5588 secs
  Slowest:	0.0098 secs
  Fastest:	0.0001 secs
  Average:	0.0001 secs
  Requests/sec:	7375.3008
  • spring-boot 3.2.1
[~/Workspaces/spring]$ hey -n 100000 -c 1 http://localhost:8080/message\?message1\=hello\&message2\=hi\&message3\=thanks

Summary:
  Total:	14.9566 secs
  Slowest:	0.1087 secs
  Fastest:	0.0001 secs
  Average:	0.0001 secs
  Requests/sec:	6686.0123

async-profiler

  • spring-boot 3.2.0
    image

  • spring-boot 3.2.1
    image

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)theme: kotlinAn issue related to Kotlin supporttype: regressionA bug that is also a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions