[
https://issues.apache.org/jira/browse/ARTEMIS-3745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17604925#comment-17604925
]
Justin Bertram commented on ARTEMIS-3745:
-----------------------------------------
[~apachedev], any feedback on my last comment/question?
> OOM with PostgreSQL when loading large amount of messages from DB
> -----------------------------------------------------------------
>
> Key: ARTEMIS-3745
> URL: https://issues.apache.org/jira/browse/ARTEMIS-3745
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Components: Broker
> Affects Versions: 2.19.1
> Reporter: Apache Dev
> Priority: Major
>
> Scenario:
> * Broker using PostgreSQL DB storage
> * Address memory (about half of heap, with heap defined as 4GB) is filled
> with persistent messages
> * Broker is restarted
> * OutOfMemory occurs during broker startup when broker loads messages from DB
> Issue occurs in:
> {code:java}
> org.apache.activemq.artemis.jdbc.store.journal.JDBCJournalImpl#load(org.apache.activemq.artemis.core.journal.LoaderCallback)
> {code}
> It depends on PostgreSQL JDBC driver default behavior, loading all result-set
> rows in memory.
> In order to fetch smaller chunks of rows, it is possible to use this pattern:
> {code:java}
> connection.setAutoCommit(false);
> selectJournalRecords.setFetchSize(FETCH_SIZE);
> {code}
> Reference (see "Getting results based on a cursor"):
> [https://jdbc.postgresql.org/documentation/head/query.html]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)