You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Justin Bertram (Jira)" <ji...@apache.org> on 2022/03/25 18:50:00 UTC

[jira] [Commented] (ARTEMIS-3745) OOM with PostgreSQL when loading large amount of messages from DB

    [ https://issues.apache.org/jira/browse/ARTEMIS-3745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17512542#comment-17512542 ] 

Justin Bertram commented on ARTEMIS-3745:
-----------------------------------------

Can you provide a heap dump?

> 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.1#820001)