Uploaded image for project: 'ActiveMQ Artemis'
  1. ActiveMQ Artemis
  2. ARTEMIS-3745

OOM with PostgreSQL when loading large amount of messages from DB

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.19.1
    • None
    • Broker
    • None

    Description

      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:

      org.apache.activemq.artemis.jdbc.store.journal.JDBCJournalImpl#load(org.apache.activemq.artemis.core.journal.LoaderCallback)
      

      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:

      connection.setAutoCommit(false);
      selectJournalRecords.setFetchSize(FETCH_SIZE);
      

      Reference (see "Getting results based on a cursor"): https://jdbc.postgresql.org/documentation/head/query.html

      Attachments

        Activity

          People

            Unassigned Unassigned
            apachedev Apache Dev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: