Replies: 2 comments 4 replies
-
What do you need the parallel processing for? Did you read https://docs.spring.io/spring-batch/reference/scalability.html? I don't think that this is a spring batch specific issue.
What do you think? |
Beta Was this translation helpful? Give feedback.
-
Spring Batch effectively opens/closes a database connection every time it interacts with the job repository to store/load the metadata it needs to function properly, but it does not hold any connection open any longer than that for meta-data related operations. What can hold a database connection open for a long time is a so saying "it was verified that one Job establishes 11 long connections to the database", yes that could be the case (you did not share the code) but if a single job uses that many connections then you should consider that in the design of your deployment patterns and configuration (ie adapt the connection pool size accordingly). Do you see ? Let me know if you need more details on that. |
Beta Was this translation helpful? Give feedback.
-
Recently, I've been considering developing a batch processing system using Spring Batch. However, while looking into the Spring Batch architecture, I found a potential issue.
Each batch job depends on database records for task information. Through use cases, it was verified that one Job establishes 11 persistent connections to the database(This is the default configuration of
spring.datasource
and can be adjusted byspring.datasource.hikari.maximum-pool-size & spring.datasource.hikari.minimum-idle
). So, if I'm designing a Spring Batch system where all Jobs connect to the same database, does this limit the number of Jobs that can run in parallel?For example, if 1000 Jobs are running at the same time, would these 1000 Jobs establish 11,000 persistent connections to the database? This could quickly exhaust the database connection pool, leading to systemic failures.
I hope my understanding is incorrect.
Beta Was this translation helpful? Give feedback.
All reactions