Skip to content

There is an unknown problem with transaction support for reactive projects #30050

@ht-coder-wu

Description

@ht-coder-wu

Description

A simple demo project, using spring boot+webflux+spring data-r2dbc, stress testing, and some requesters hang for a long time until timeout.
I'm not sure which link caused the suspension,but i did some experiments at https://github.com/ht-coder-wu/demo.
I think :

  1. there must be some problems with connection pool or transactions
  2. request is suspended for some unknown reasons in the concurrent scenario for a long time

Version

  • spring-boot-starter-parent 2.7.8
  • r2dbc-mysql 0.8.2.RELEASE
  • r2dbc-pool 0.9.2.RELEASE
  • jdk 8

Recurrence(occasional)

application.properties like this:
spring.application.name=demo
spring.r2dbc.url=r2dbcs:mysql://localhost:3306/test
spring.r2dbc.username=root
spring.r2dbc.password=root
spring.r2dbc.pool.enabled=true
server.port=8080
logging.level.org.springframework.r2dbc=info
spring.r2dbc.pool.initial-size=100
spring.r2dbc.pool.max-size=500

I did four sets of tests:
image

Their difference is :
testA Declarative transaction+request db
testB Declarative transaction+do not request db
testC no transaction+do not request db
testD no transaction+request db

I use scripts for concurrency testing:
iwtbafpdeMacBook-Pro:~ iwtbafp$ ab -n 100000 -c 100 -s 120 http://localhost:8080/testA
image

there are 4 requests timeout(cause i set timeout 100s in webfilter and do response status 400),If I don't restart the service, continue to pressure test testD

request is suspended for some unknown reasons in the concurrent scenario for a long time

iwtbafpdeMacBook-Pro:~ iwtbafp$ ab -n 100000 -c 100 -s 120 http://localhost:8080/testD
image

It looks like there's no problem but there are some tx hang in db
image

If i restart the service after pressure test testA and test testD directly
iwtbafpdeMacBook-Pro:~ iwtbafp$ ab -n 100000 -c 100 -s 120 http://localhost:8080/testD
image

request is suspended for some unknown reasons in the concurrent scenario for a long time

I think there must be some problems with connection pool or transactions,It looks like testA causes some connections in the thread pool to no longer be submitted automatically,then testD which not in transaction hang in db tx.

there must be some problems with connection pool or transactions

Restart the service and pressure test testB directly
iwtbafpdeMacBook-Pro:~ iwtbafp$ ab -n 100000 -c 100 -s 120 http://localhost:8080/testB
image

request is suspended for some unknown reasons in the concurrent scenario for a long time

Restart the service and pressure test testC directly
iwtbafpdeMacBook-Pro:~ iwtbafp$ ab -n 100000 -c 100 -s 120 http://localhost:8080/testC
image
I have tried this scene several times ,It seems to be all right (no transaction,no db).

Summarize

  • testA(transaction&db)+testD ,we see tx hang in db till i restart service, there must be some problems with connection pool or transaction(Declarative & Programmatic).

  • testC(no transaction&no db), it seems to be all right.

  • testB(transaction&no db),request hang till time out.

  • testD(no transaction& db ),request hang till time out (Occasional appearance).

I'm not sure what the problem is, but it does exist,hope to get helps,thanks.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions