[ http://jira.jboss.com/jira/browse/JBMQ-2?page=comments#action_12310800 ]
     
Adrian Brock commented on JBMQ-2:
---------------------------------

The fundamental problem is databases that try to retrieve the entire
result set into memory regardless of the size of the query.

This can cause out of memory problems before the message cache gets chance
to "soften" the messages.

I don't see how this can be done in an easily portable way,
e.g. here is the MySQL mechanism to avoid the problem which is very
inefficient:

"By default, ResultSets are completely retrieved and stored in memory. In most 
cases this is the most efficient way to operate, and due to the design of the 
MySQL network protocol is easier to implement. If you are working with 
ResultSets that have a large number of rows or large values, and can not 
allocate heap space in your JVM for the memory required, you can tell the 
driver to 'stream' the results back one row at-a-time.

To enable this functionality, you need to create a Statement instance in the 
following manner:

stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY,
              java.sql.ResultSet.CONCUR_READ_ONLY);
stmt.setFetchSize(Integer.MIN_VALUE);

The combination of a forward-only, read-only result set, with a fetch size of 
Integer.MIN_VALUE serves as a signal to the driver to "stream" result sets 
row-by-row. After this any result sets created with the statement will be 
retrieved row-by-row.

There are some caveats with this approach. You will have to read all of the 
rows in the result set (or close it) before you can issue any other queries on 
the connection, or an exception will be thrown. Also, any tables referenced by 
the query that created the streaming result will be locked until all of the 
results have been read or the connection closed."



> Need better control over the pm memory usage during destination recovery
> ------------------------------------------------------------------------
>
>          Key: JBMQ-2
>          URL: http://jira.jboss.com/jira/browse/JBMQ-2
>      Project: JBoss MQ
>         Type: Patch
>     Versions:  JBossAS-3.2.5
>     Reporter: Scott M Stark
>     Assignee: Adrian Brock

>
>
> When starting up jboss with a destination with either a large number or very 
> large persistent messages, the jdbc pm may run out of memory if the select * 
> from the db results in the jdbc driver pulling in all of the records. We need 
> to either write the pm with this expectation or allow for some configuration 
> to avoid this.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.jboss.com/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to