I have a simple spring batch application.
If I use H2 for the DB - add it in the .pom and clear the application.yml, the application processes 50,000 records in 8 seconds. And when I say processes I mean only counting the time a class that extends ItemProcessor is called, while most of the class that extends ItemWriter is commented out (not called).
If I want to use SQL Server, I add this to the .pom:
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc</artifactId>
<version>6.0.0</version>
</dependency>
And define like this the application.yml:
spring:
profiles:
active: dev
---
spring:
devtools:
add-properties: false
profiles: dev
datasource:
url: jdbc:sqlserver://***.restest.bank:***;DatabaseName=****;integratedSecurity=true
driver_class_name: com.microsoft.sqlserver.jdbc.SQLServerDriver
driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
# hikari:
# maximum-pool-size: 50
# connection-test-query: SELECT 1
# validation-timeout: 30000
# minimum-idle: 5
# max-lifetime: 300
jpa:
database: SQL_SERVER
database-platform: org.hibernate.dialect.SQLServerDialect
show-sql: false
hibernate:
ddl-auto: update
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
properties:
hibernate:
default_schema: dbo
default_catalog: ****
batch:
initialize-schema: always
The application works terribly slow! To process the same records, it takes 700 seconds, even if most of the class that extends ItemWriter is commented out!
Why?
Update: Now I see that even though I don't write to the DB, spring does, to the tables BATCH_JOB_*.
Could this be what slow the app down so much? Because its not reasonable that its so slow!