1

I tried to insert 40k records where I got this error. It's working fine for 15k records happening in 5 seconds. When we bulk insert 20k records getting this error.

I have tried batch update limited 5000 records after inserting 15k records getting error again.

How to do multiple inserts in database using spring JDBC Template batch?

Getting 504 error so I increased timeout to 180 seconds for 15k records as usual it worked fine. When it comes to 20k records its not sufficient.

{ "log": "Exception in thread \"PostgreSQL-JDBC-SharedTimer-1\" java.lang.OutOfMemoryError: Java heap space\n" } { "log": "\tat java.base/java.io.BufferedOutputStream.<init> (BufferedOutputStream.java:75)\n" } { "log": "\tat org.postgresql.core.PGStream.changeSocket(PGStream.java:120)\n" } { "log": "\tat org.postgresql.core.PGStream.<init>(PGStream.java:62)\n" } { "log": "\tat org.postgresql.core.v3.ProtocolConnectionImpl.sendQueryCancel(ProtocolConnectionImpl.java:99)\n" } { "log": "\tat org.postgresql.jdbc2.AbstractJdbc2Connection.cancelQuery(AbstractJdbc2Connection.java:1200)\n" }

  • 1
    Try to do some profiling on your VM. Use jvisual vm when doing a 15k import and try to grab a dump. Afterwards use https://www.eclipse.org/mat/ to open the dump file. Is going to do an analysis to you and tell you if you are still keeping the objects in memory. – Vladucu Voican Mar 03 '21 at 09:30

0 Answers0