You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by wojtekpia <wo...@hotmail.com> on 2008/06/25 02:23:23 UTC

DataImportHandler running out of memory

I'm trying to load ~10 million records into Solr using the DataImportHandler.
I'm running out of memory (java.lang.OutOfMemoryError: Java heap space) as
soon as I try loading more than about 5 million records.

Here's my configuration:
I'm connecting to a SQL Server database using the sqljdbc driver. I've given
my Solr instance 1.5 GB of memory. I have set the dataSource batchSize to
10000. My SQL query is "select top XXX field1, ... from table1". I have
about 40 fields in my Solr schema.

I thought the DataImportHandler would stream data from the DB rather than
loading it all into memory at once. Is that not the case? Any thoughts on
how to get around this (aside from getting a machine with more memory)? 

-- 
View this message in context: http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p18102644.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: DataImportHandler running out of memory

Posted by Grant Ingersoll <gs...@apache.org>.
This is a bug in MySQL.  Try setting the Fetch Size the Statement on  
the connection to Integer.MIN_VALUE.

See http://forums.mysql.com/read.php?39,137457 amongst a host of other  
discussions on the subject.  Basically, it tries to load all the rows  
into memory, the only alternative is to set the fetch size to  
Integer.MIN_VALUE so that it gets it one row at a time.  I've hit this  
one myself and it isn't caused by the DataImportHandler, but by the  
MySQL JDBC handler.

-Grant



On Jun 24, 2008, at 8:23 PM, wojtekpia wrote:

>
> I'm trying to load ~10 million records into Solr using the  
> DataImportHandler.
> I'm running out of memory (java.lang.OutOfMemoryError: Java heap  
> space) as
> soon as I try loading more than about 5 million records.
>
> Here's my configuration:
> I'm connecting to a SQL Server database using the sqljdbc driver.  
> I've given
> my Solr instance 1.5 GB of memory. I have set the dataSource  
> batchSize to
> 10000. My SQL query is "select top XXX field1, ... from table1". I  
> have
> about 40 fields in my Solr schema.
>
> I thought the DataImportHandler would stream data from the DB rather  
> than
> loading it all into memory at once. Is that not the case? Any  
> thoughts on
> how to get around this (aside from getting a machine with more  
> memory)?
>
> -- 
> View this message in context: http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p18102644.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

--------------------------
Grant Ingersoll
http://www.lucidimagination.com

Lucene Helpful Hints:
http://wiki.apache.org/lucene-java/BasicsOfPerformance
http://wiki.apache.org/lucene-java/LuceneFAQ








Re: DataImportHandler running out of memory

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@gmail.com>.
it is batchSize="-1" not fetchSize. Or keep it to a very small value.
--Noble

On Wed, Jun 25, 2008 at 9:31 AM, Noble Paul നോബിള്‍ नोब्ळ्
<no...@gmail.com> wrote:
> DIH streams rows one by one.
> set the fetchSize="-1" this might help. It may make the indexing a bit
> slower but memory consumption would be low.
> The memory is consumed by the jdbc driver. try tuning the -Xmx value for the VM
> --Noble
>
> On Wed, Jun 25, 2008 at 8:05 AM, Shalin Shekhar Mangar
> <sh...@gmail.com> wrote:
>> Setting the batchSize to 10000 would mean that the Jdbc driver will keep
>> 10000 rows in memory *for each entity* which uses that data source (if
>> correctly implemented by the driver). Not sure how well the Sql Server
>> driver implements this. Also keep in mind that Solr also needs memory to
>> index documents. You can probably try setting the batch size to a lower
>> value.
>>
>> The regular memory tuning stuff should apply here too -- try disabling
>> autoCommit and turn-off autowarming and see if it helps.
>>
>> On Wed, Jun 25, 2008 at 5:53 AM, wojtekpia <wo...@hotmail.com> wrote:
>>
>>>
>>> I'm trying to load ~10 million records into Solr using the
>>> DataImportHandler.
>>> I'm running out of memory (java.lang.OutOfMemoryError: Java heap space) as
>>> soon as I try loading more than about 5 million records.
>>>
>>> Here's my configuration:
>>> I'm connecting to a SQL Server database using the sqljdbc driver. I've
>>> given
>>> my Solr instance 1.5 GB of memory. I have set the dataSource batchSize to
>>> 10000. My SQL query is "select top XXX field1, ... from table1". I have
>>> about 40 fields in my Solr schema.
>>>
>>> I thought the DataImportHandler would stream data from the DB rather than
>>> loading it all into memory at once. Is that not the case? Any thoughts on
>>> how to get around this (aside from getting a machine with more memory)?
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p18102644.html
>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>> --
>> Regards,
>> Shalin Shekhar Mangar.
>>
>
>
>
> --
> --Noble Paul
>



-- 
--Noble Paul

Re: DataImportHandler running out of memory

Posted by sunnyfr <jo...@gmail.com>.
Hi,

I tried batchSize =-1 but when I'm doing that I will use all mysql's memory
and it's a problem for mysql's database.

:s


Noble Paul നോബിള്‍ नोब्ळ् wrote:
> 
> I've moved the FAQ to a new Page
> http://wiki.apache.org/solr/DataImportHandlerFaq
> The DIH page is too big and editing has become harder
> 
> On Thu, Jun 26, 2008 at 6:07 PM, Shalin Shekhar Mangar
> <sh...@gmail.com> wrote:
>> I've added a FAQ section to DataImportHandler wiki page which captures
>> question on out of memory exception with both MySQL and MS SQL Server
>> drivers.
>>
>> http://wiki.apache.org/solr/DataImportHandler#faq
>>
>> On Thu, Jun 26, 2008 at 9:36 AM, Noble Paul നോബിള്‍ नोब्ळ्
>> <no...@gmail.com> wrote:
>>> We must document this information in the wiki.  We never had a chance
>>> to play w/ ms sql server
>>> --Noble
>>>
>>> On Thu, Jun 26, 2008 at 12:38 AM, wojtekpia <wo...@hotmail.com>
>>> wrote:
>>>>
>>>> It looks like that was the problem. With responseBuffering=adaptive,
>>>> I'm able
>>>> to load all my data using the sqljdbc driver.
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p18119732.html
>>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> --Noble Paul
>>>
>>
>>
>>
>> --
>> Regards,
>> Shalin Shekhar Mangar.
>>
> 
> 
> 
> -- 
> --Noble Paul
> 
> 

-- 
View this message in context: http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p20305039.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: DataImportHandler running out of memory

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@gmail.com>.
I've moved the FAQ to a new Page
http://wiki.apache.org/solr/DataImportHandlerFaq
The DIH page is too big and editing has become harder

On Thu, Jun 26, 2008 at 6:07 PM, Shalin Shekhar Mangar
<sh...@gmail.com> wrote:
> I've added a FAQ section to DataImportHandler wiki page which captures
> question on out of memory exception with both MySQL and MS SQL Server
> drivers.
>
> http://wiki.apache.org/solr/DataImportHandler#faq
>
> On Thu, Jun 26, 2008 at 9:36 AM, Noble Paul നോബിള്‍ नोब्ळ्
> <no...@gmail.com> wrote:
>> We must document this information in the wiki.  We never had a chance
>> to play w/ ms sql server
>> --Noble
>>
>> On Thu, Jun 26, 2008 at 12:38 AM, wojtekpia <wo...@hotmail.com> wrote:
>>>
>>> It looks like that was the problem. With responseBuffering=adaptive, I'm able
>>> to load all my data using the sqljdbc driver.
>>> --
>>> View this message in context: http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p18119732.html
>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> --Noble Paul
>>
>
>
>
> --
> Regards,
> Shalin Shekhar Mangar.
>



-- 
--Noble Paul

Re: DataImportHandler running out of memory

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
I've added a FAQ section to DataImportHandler wiki page which captures
question on out of memory exception with both MySQL and MS SQL Server
drivers.

http://wiki.apache.org/solr/DataImportHandler#faq

On Thu, Jun 26, 2008 at 9:36 AM, Noble Paul നോബിള്‍ नोब्ळ्
<no...@gmail.com> wrote:
> We must document this information in the wiki.  We never had a chance
> to play w/ ms sql server
> --Noble
>
> On Thu, Jun 26, 2008 at 12:38 AM, wojtekpia <wo...@hotmail.com> wrote:
>>
>> It looks like that was the problem. With responseBuffering=adaptive, I'm able
>> to load all my data using the sqljdbc driver.
>> --
>> View this message in context: http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p18119732.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> --Noble Paul
>



-- 
Regards,
Shalin Shekhar Mangar.

Re: DataImportHandler running out of memory

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@gmail.com>.
We must document this information in the wiki.  We never had a chance
to play w/ ms sql server
--Noble

On Thu, Jun 26, 2008 at 12:38 AM, wojtekpia <wo...@hotmail.com> wrote:
>
> It looks like that was the problem. With responseBuffering=adaptive, I'm able
> to load all my data using the sqljdbc driver.
> --
> View this message in context: http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p18119732.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>



-- 
--Noble Paul

Re: DataImportHandler running out of memory

Posted by wojtekpia <wo...@hotmail.com>.
It looks like that was the problem. With responseBuffering=adaptive, I'm able
to load all my data using the sqljdbc driver.
-- 
View this message in context: http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p18119732.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: DataImportHandler running out of memory

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
Hi,

I don't think the problem is within DataImportHandler since it just streams
resultset. The fetchSize is just passed as a parameter passed to
Statement#setFetchSize() and the Jdbc driver is supposed to honor it and
keep only that many rows in memory.

From what I could find about the Sql Server driver -- there's a connection
property called responseBuffering whose default value is "full" which causes
the entire result set is fetched. See
http://msdn.microsoft.com/en-us/library/ms378988.aspx for more details. You
can set connection properties like this directly in the jdbc url specified
in DataImportHandler's dataSource configuration.

On Wed, Jun 25, 2008 at 10:17 PM, wojtekpia <wo...@hotmail.com> wrote:

>
> I'm trying with batchSize=-1 now. So far it seems to be working, but very
> slowly. I will update when it completes or crashes.
>
> Even with a batchSize of 100 I was running out of memory.
>
> I'm running on a 32-bit Windows machine. I've set the -Xmx to 1.5 GB - I
> believe that's the maximum for my environment.
>
> The batchSize parameter doesn't seem to control what happens... when I
> select top 5,000,000 with a batchSize of 10,000, it works. When I select
> top
> 10,000,000 with the same batchSize, it runs out of memory.
>
> Also, I'm using the 469 patch posted on 2008-06-11 08:41 AM.
>
>
> Noble Paul നോബിള്‍ नोब्ळ् wrote:
> >
> > DIH streams rows one by one.
> > set the fetchSize="-1" this might help. It may make the indexing a bit
> > slower but memory consumption would be low.
> > The memory is consumed by the jdbc driver. try tuning the -Xmx value for
> > the VM
> > --Noble
> >
> > On Wed, Jun 25, 2008 at 8:05 AM, Shalin Shekhar Mangar
> > <sh...@gmail.com> wrote:
> >> Setting the batchSize to 10000 would mean that the Jdbc driver will keep
> >> 10000 rows in memory *for each entity* which uses that data source (if
> >> correctly implemented by the driver). Not sure how well the Sql Server
> >> driver implements this. Also keep in mind that Solr also needs memory to
> >> index documents. You can probably try setting the batch size to a lower
> >> value.
> >>
> >> The regular memory tuning stuff should apply here too -- try disabling
> >> autoCommit and turn-off autowarming and see if it helps.
> >>
> >> On Wed, Jun 25, 2008 at 5:53 AM, wojtekpia <wo...@hotmail.com>
> wrote:
> >>
> >>>
> >>> I'm trying to load ~10 million records into Solr using the
> >>> DataImportHandler.
> >>> I'm running out of memory (java.lang.OutOfMemoryError: Java heap space)
> >>> as
> >>> soon as I try loading more than about 5 million records.
> >>>
> >>> Here's my configuration:
> >>> I'm connecting to a SQL Server database using the sqljdbc driver. I've
> >>> given
> >>> my Solr instance 1.5 GB of memory. I have set the dataSource batchSize
> >>> to
> >>> 10000. My SQL query is "select top XXX field1, ... from table1". I have
> >>> about 40 fields in my Solr schema.
> >>>
> >>> I thought the DataImportHandler would stream data from the DB rather
> >>> than
> >>> loading it all into memory at once. Is that not the case? Any thoughts
> >>> on
> >>> how to get around this (aside from getting a machine with more memory)?
> >>>
> >>> --
> >>> View this message in context:
> >>>
> http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p18102644.html
> >>> Sent from the Solr - User mailing list archive at Nabble.com.
> >>>
> >>>
> >>
> >>
> >> --
> >> Regards,
> >> Shalin Shekhar Mangar.
> >>
> >
> >
> >
> > --
> > --Noble Paul
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p18115900.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>


-- 
Regards,
Shalin Shekhar Mangar.

Re: DataImportHandler running out of memory

Posted by wojtekpia <wo...@hotmail.com>.
I'm trying with batchSize=-1 now. So far it seems to be working, but very
slowly. I will update when it completes or crashes.

Even with a batchSize of 100 I was running out of memory.

I'm running on a 32-bit Windows machine. I've set the -Xmx to 1.5 GB - I
believe that's the maximum for my environment.

The batchSize parameter doesn't seem to control what happens... when I
select top 5,000,000 with a batchSize of 10,000, it works. When I select top
10,000,000 with the same batchSize, it runs out of memory.

Also, I'm using the 469 patch posted on 2008-06-11 08:41 AM.


Noble Paul നോബിള്‍ नोब्ळ् wrote:
> 
> DIH streams rows one by one.
> set the fetchSize="-1" this might help. It may make the indexing a bit
> slower but memory consumption would be low.
> The memory is consumed by the jdbc driver. try tuning the -Xmx value for
> the VM
> --Noble
> 
> On Wed, Jun 25, 2008 at 8:05 AM, Shalin Shekhar Mangar
> <sh...@gmail.com> wrote:
>> Setting the batchSize to 10000 would mean that the Jdbc driver will keep
>> 10000 rows in memory *for each entity* which uses that data source (if
>> correctly implemented by the driver). Not sure how well the Sql Server
>> driver implements this. Also keep in mind that Solr also needs memory to
>> index documents. You can probably try setting the batch size to a lower
>> value.
>>
>> The regular memory tuning stuff should apply here too -- try disabling
>> autoCommit and turn-off autowarming and see if it helps.
>>
>> On Wed, Jun 25, 2008 at 5:53 AM, wojtekpia <wo...@hotmail.com> wrote:
>>
>>>
>>> I'm trying to load ~10 million records into Solr using the
>>> DataImportHandler.
>>> I'm running out of memory (java.lang.OutOfMemoryError: Java heap space)
>>> as
>>> soon as I try loading more than about 5 million records.
>>>
>>> Here's my configuration:
>>> I'm connecting to a SQL Server database using the sqljdbc driver. I've
>>> given
>>> my Solr instance 1.5 GB of memory. I have set the dataSource batchSize
>>> to
>>> 10000. My SQL query is "select top XXX field1, ... from table1". I have
>>> about 40 fields in my Solr schema.
>>>
>>> I thought the DataImportHandler would stream data from the DB rather
>>> than
>>> loading it all into memory at once. Is that not the case? Any thoughts
>>> on
>>> how to get around this (aside from getting a machine with more memory)?
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p18102644.html
>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>> --
>> Regards,
>> Shalin Shekhar Mangar.
>>
> 
> 
> 
> -- 
> --Noble Paul
> 
> 

-- 
View this message in context: http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p18115900.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: DataImportHandler running out of memory

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@gmail.com>.
DIH streams rows one by one.
set the fetchSize="-1" this might help. It may make the indexing a bit
slower but memory consumption would be low.
The memory is consumed by the jdbc driver. try tuning the -Xmx value for the VM
--Noble

On Wed, Jun 25, 2008 at 8:05 AM, Shalin Shekhar Mangar
<sh...@gmail.com> wrote:
> Setting the batchSize to 10000 would mean that the Jdbc driver will keep
> 10000 rows in memory *for each entity* which uses that data source (if
> correctly implemented by the driver). Not sure how well the Sql Server
> driver implements this. Also keep in mind that Solr also needs memory to
> index documents. You can probably try setting the batch size to a lower
> value.
>
> The regular memory tuning stuff should apply here too -- try disabling
> autoCommit and turn-off autowarming and see if it helps.
>
> On Wed, Jun 25, 2008 at 5:53 AM, wojtekpia <wo...@hotmail.com> wrote:
>
>>
>> I'm trying to load ~10 million records into Solr using the
>> DataImportHandler.
>> I'm running out of memory (java.lang.OutOfMemoryError: Java heap space) as
>> soon as I try loading more than about 5 million records.
>>
>> Here's my configuration:
>> I'm connecting to a SQL Server database using the sqljdbc driver. I've
>> given
>> my Solr instance 1.5 GB of memory. I have set the dataSource batchSize to
>> 10000. My SQL query is "select top XXX field1, ... from table1". I have
>> about 40 fields in my Solr schema.
>>
>> I thought the DataImportHandler would stream data from the DB rather than
>> loading it all into memory at once. Is that not the case? Any thoughts on
>> how to get around this (aside from getting a machine with more memory)?
>>
>> --
>> View this message in context:
>> http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p18102644.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>>
>
>
> --
> Regards,
> Shalin Shekhar Mangar.
>



-- 
--Noble Paul

Re: DataImportHandler running out of memory

Posted by Shawn Heisey <so...@elyograg.org>.
On 2/20/2012 6:49 AM, v_shan wrote:
> DIH still running out of memory for me, with Full Import on a database of
> size 1.5 GB.
>
> Solr version: 3_5_0
>
> Note that I have already added batchSize="-1" but getting same error.

A few questions:

- How much memory have you given to the JVM running this Solr instance?
- How much memory does your server have?
- What is the size of all your index cores, and how many documents are 
in them?
- How large are your Solr caches (filterCache, documentCache, 
queryResultCache)?
- What is your ramBufferSize set to in the indexDefaults section?

Thanks,
Shawn


Re: DataImportHandler running out of memory

Posted by v_shan <va...@gmail.com>.
DIH still running out of memory for me, with Full Import on a database of
size 1.5 GB.

Solr version: 3_5_0

Note that I have already added batchSize="-1" but getting same error. 
Sharing my DIH config below.

============================================
<dataConfig>
	<dataSource type="JdbcDataSource"
    name="jdbc"
   driver="com.mysql.jdbc.Driver"
   url="jdbc:mysql://localhost:3306/ib"
   user="root" 
   password="root"
   batchSize="-1"
   />
	<document name="content">
        <entity 
            name="issue" 
            dataSource="jdbc"
            transformer="RegexTransformer,DateFormatTransformer,
TemplateTransformer"
            pk="id"
            query="
                select
                    ib_issue.`_id` as id,
                    ib_issue.`_issue_title` as issueTitle,
                    ib_issue.`_issue_descr` as issueDescr,
                    createdBy.`_name` as issueCreatedByName,
                    createdBy.`_email` as issueCreatedByEmail
                from
                    `ib_issue` 
                    inner join `ib_user` as createdBy 
                        on createdBy.`_id` = ib_issue.`_created_by_user_id`                     
                group by ib_issue.`_id` "
            >
        </entity>
    </document>
</dataConfig>


Please find the error trace below
===================================
2012-02-20 19:04:40.531:INFO::Started SocketConnector@0.0.0.0:8983
Feb 20, 2012 7:04:57 PM org.apache.solr.core.SolrCore execute
INFO: [] webapp=/solr path=/select params={command=status&qt=/dih_ib_jdbc}
status=0 QTime=0
Feb 20, 2012 7:04:58 PM org.apache.solr.core.SolrCore execute
INFO: [] webapp=/solr path=/select
params={command=show-config&qt=/dih_ib_jdbc} status=0 QTime=0
Feb 20, 2012 7:05:30 PM org.apache.solr.handler.dataimport.DataImporter
doFullImport
INFO: Starting Full Import
Feb 20, 2012 7:05:30 PM org.apache.solr.core.SolrCore execute
INFO: [] webapp=/solr path=/dih_ib_jdbc params={command=full-import}
status=0 QTime=0
Feb 20, 2012 7:05:30 PM org.apache.solr.handler.dataimport.SolrWriter
readIndexerProperties
INFO: Read dih_ib_jdbc.properties
Feb 20, 2012 7:05:30 PM org.apache.solr.update.DirectUpdateHandler2
deleteAll
INFO: [] REMOVING ALL DOCUMENTS FROM INDEX
Feb 20, 2012 7:05:30 PM org.apache.solr.core.SolrDeletionPolicy onInit
INFO: SolrDeletionPolicy.onInit: commits:num=1
       
commit{dir=E:\workspace\solr_3_5_0\example\solr\data\index,segFN=segments_1,version=1329744880204,generation=1,filenames=[segments_1]
Feb 20, 2012 7:05:30 PM org.apache.solr.core.SolrDeletionPolicy
updateCommits
INFO: newest commit = 1329744880204
Feb 20, 2012 7:05:30 PM org.apache.solr.handler.dataimport.JdbcDataSource$1
call
INFO: Creating a connection for entity issue with URL:
jdbc:mysql://localhost:3306/issueburner
Feb 20, 2012 7:05:30 PM org.apache.solr.handler.dataimport.JdbcDataSource$1
call
INFO: Time taken for getConnection(): 172
Feb 20, 2012 7:07:45 PM org.apache.solr.common.SolrException log
SEVERE: Full Import
failed:org.apache.solr.handler.dataimport.DataImportHandlerException:
java.lang.OutOfMemoryError: Java heap space
        at
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:669)
        at
org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:268)
        at
org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:187)
        at
org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:359)
        at
org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:427)
        at
org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:408)
Caused by: java.lang.OutOfMemoryError: Java heap space
        at
org.apache.lucene.util.UnicodeUtil.UTF16toUTF8(UnicodeUtil.java:377)
        at
org.apache.lucene.store.DataOutput.writeString(DataOutput.java:103)
        at
org.apache.lucene.index.FieldsWriter.writeField(FieldsWriter.java:200)
        at
org.apache.lucene.index.StoredFieldsWriterPerThread.addField(StoredFieldsWriterPerThread.java:58)
        at
org.apache.lucene.index.DocFieldProcessorPerThread.processDocument(DocFieldProcessorPerThread.java:265)
        at
org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:766)
        at
org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:2327)
        at
org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:2299)
        at
org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:240)
        at
org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:61)
        at
org.apache.solr.update.processor.LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:115)
        at
org.apache.solr.handler.dataimport.SolrWriter.upload(SolrWriter.java:73)
        at
org.apache.solr.handler.dataimport.DataImportHandler$1.upload(DataImportHandler.java:293)
        at
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:636)
        ... 5 more

Feb 20, 2012 7:07:45 PM org.apache.solr.update.DirectUpdateHandler2 rollback
INFO: start rollback
Feb 20, 2012 7:07:45 PM org.apache.solr.update.DirectUpdateHandler2 rollback

--
View this message in context: http://lucene.472066.n3.nabble.com/DataImportHandler-running-out-of-memory-tp490797p3760755.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: DataImportHandler running out of memory

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@gmail.com>.
The latest patch sets fetchSize as Integer.MIN_VALUE if -1 is passed.
It is added specifically for mysql driver
--Noble

On Wed, Jun 25, 2008 at 4:35 PM, Grant Ingersoll <gs...@apache.org> wrote:
> I think it's a bit different.  I ran into this exact problem about two weeks
> ago on a 13 million record DB.  MySQL doesn't honor the fetch size for it's
> v5 JDBC driver.
>
> See
> http://www.databasesandlife.com/reading-row-by-row-into-java-from-mysql/ or
> do a search for MySQL fetch size.
>
> You actually have to do setFetchSize(Integer.MIN_VALUE) (-1 doesn't work) in
> order to get streaming in MySQL.
>
> -Grant
>
>
> On Jun 24, 2008, at 10:35 PM, Shalin Shekhar Mangar wrote:
>
>> Setting the batchSize to 10000 would mean that the Jdbc driver will keep
>> 10000 rows in memory *for each entity* which uses that data source (if
>> correctly implemented by the driver). Not sure how well the Sql Server
>> driver implements this. Also keep in mind that Solr also needs memory to
>> index documents. You can probably try setting the batch size to a lower
>> value.
>>
>> The regular memory tuning stuff should apply here too -- try disabling
>> autoCommit and turn-off autowarming and see if it helps.
>>
>> On Wed, Jun 25, 2008 at 5:53 AM, wojtekpia <wo...@hotmail.com> wrote:
>>
>>>
>>> I'm trying to load ~10 million records into Solr using the
>>> DataImportHandler.
>>> I'm running out of memory (java.lang.OutOfMemoryError: Java heap space)
>>> as
>>> soon as I try loading more than about 5 million records.
>>>
>>> Here's my configuration:
>>> I'm connecting to a SQL Server database using the sqljdbc driver. I've
>>> given
>>> my Solr instance 1.5 GB of memory. I have set the dataSource batchSize to
>>> 10000. My SQL query is "select top XXX field1, ... from table1". I have
>>> about 40 fields in my Solr schema.
>>>
>>> I thought the DataImportHandler would stream data from the DB rather than
>>> loading it all into memory at once. Is that not the case? Any thoughts on
>>> how to get around this (aside from getting a machine with more memory)?
>>>
>>> --
>>> View this message in context:
>>>
>>> http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p18102644.html
>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>> --
>> Regards,
>> Shalin Shekhar Mangar.
>
> --------------------------
> Grant Ingersoll
> http://www.lucidimagination.com
>
> Lucene Helpful Hints:
> http://wiki.apache.org/lucene-java/BasicsOfPerformance
> http://wiki.apache.org/lucene-java/LuceneFAQ

Re: DataImportHandler running out of memory

Posted by sunnyfr <jo...@gmail.com>.
Hi Grant,

How did you finally managed it ???? 
I've the same problem with less data, 8,5M, if I put a batchsize -1, I will
slow down a lot the database which is not that good for the website and
stack request.
What did you do you ??? 

Thanks,


Grant Ingersoll-6 wrote:
> 
> I think it's a bit different.  I ran into this exact problem about two  
> weeks ago on a 13 million record DB.  MySQL doesn't honor the fetch  
> size for it's v5 JDBC driver.
> 
> See
> http://www.databasesandlife.com/reading-row-by-row-into-java-from-mysql/ 
>   or do a search for MySQL fetch size.
> 
> You actually have to do setFetchSize(Integer.MIN_VALUE) (-1 doesn't  
> work) in order to get streaming in MySQL.
> 
> -Grant
> 
> 
> On Jun 24, 2008, at 10:35 PM, Shalin Shekhar Mangar wrote:
> 
>> Setting the batchSize to 10000 would mean that the Jdbc driver will  
>> keep
>> 10000 rows in memory *for each entity* which uses that data source (if
>> correctly implemented by the driver). Not sure how well the Sql Server
>> driver implements this. Also keep in mind that Solr also needs  
>> memory to
>> index documents. You can probably try setting the batch size to a  
>> lower
>> value.
>>
>> The regular memory tuning stuff should apply here too -- try disabling
>> autoCommit and turn-off autowarming and see if it helps.
>>
>> On Wed, Jun 25, 2008 at 5:53 AM, wojtekpia <wo...@hotmail.com>  
>> wrote:
>>
>>>
>>> I'm trying to load ~10 million records into Solr using the
>>> DataImportHandler.
>>> I'm running out of memory (java.lang.OutOfMemoryError: Java heap  
>>> space) as
>>> soon as I try loading more than about 5 million records.
>>>
>>> Here's my configuration:
>>> I'm connecting to a SQL Server database using the sqljdbc driver.  
>>> I've
>>> given
>>> my Solr instance 1.5 GB of memory. I have set the dataSource  
>>> batchSize to
>>> 10000. My SQL query is "select top XXX field1, ... from table1". I  
>>> have
>>> about 40 fields in my Solr schema.
>>>
>>> I thought the DataImportHandler would stream data from the DB  
>>> rather than
>>> loading it all into memory at once. Is that not the case? Any  
>>> thoughts on
>>> how to get around this (aside from getting a machine with more  
>>> memory)?
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p18102644.html
>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>> -- 
>> Regards,
>> Shalin Shekhar Mangar.
> 
> --------------------------
> Grant Ingersoll
> http://www.lucidimagination.com
> 
> Lucene Helpful Hints:
> http://wiki.apache.org/lucene-java/BasicsOfPerformance
> http://wiki.apache.org/lucene-java/LuceneFAQ
> 
> 
> 
> 
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p20263146.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: DataImportHandler running out of memory

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
The OP is actually using Sql Server (not MySql) as per his mail.

On Wed, Jun 25, 2008 at 4:40 PM, Grant Ingersoll <gs...@apache.org>
wrote:

> I'm assuming, of course, that the DIH doesn't automatically modify the SQL
> statement according to the batch size.
>
> -Grant
>
>
> On Jun 25, 2008, at 7:05 AM, Grant Ingersoll wrote:
>
>  I think it's a bit different.  I ran into this exact problem about two
>> weeks ago on a 13 million record DB.  MySQL doesn't honor the fetch size for
>> it's v5 JDBC driver.
>>
>> See
>> http://www.databasesandlife.com/reading-row-by-row-into-java-from-mysql/ or
>> do a search for MySQL fetch size.
>>
>> You actually have to do setFetchSize(Integer.MIN_VALUE) (-1 doesn't work)
>> in order to get streaming in MySQL.
>>
>> -Grant
>>
>>
>> On Jun 24, 2008, at 10:35 PM, Shalin Shekhar Mangar wrote:
>>
>>  Setting the batchSize to 10000 would mean that the Jdbc driver will keep
>>> 10000 rows in memory *for each entity* which uses that data source (if
>>> correctly implemented by the driver). Not sure how well the Sql Server
>>> driver implements this. Also keep in mind that Solr also needs memory to
>>> index documents. You can probably try setting the batch size to a lower
>>> value.
>>>
>>> The regular memory tuning stuff should apply here too -- try disabling
>>> autoCommit and turn-off autowarming and see if it helps.
>>>
>>> On Wed, Jun 25, 2008 at 5:53 AM, wojtekpia <wo...@hotmail.com> wrote:
>>>
>>>
>>>> I'm trying to load ~10 million records into Solr using the
>>>> DataImportHandler.
>>>> I'm running out of memory (java.lang.OutOfMemoryError: Java heap space)
>>>> as
>>>> soon as I try loading more than about 5 million records.
>>>>
>>>> Here's my configuration:
>>>> I'm connecting to a SQL Server database using the sqljdbc driver. I've
>>>> given
>>>> my Solr instance 1.5 GB of memory. I have set the dataSource batchSize
>>>> to
>>>> 10000. My SQL query is "select top XXX field1, ... from table1". I have
>>>> about 40 fields in my Solr schema.
>>>>
>>>> I thought the DataImportHandler would stream data from the DB rather
>>>> than
>>>> loading it all into memory at once. Is that not the case? Any thoughts
>>>> on
>>>> how to get around this (aside from getting a machine with more memory)?
>>>>
>>>> --
>>>> View this message in context:
>>>>
>>>> http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p18102644.html
>>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>>
>>>
>>> --
>>> Regards,
>>> Shalin Shekhar Mangar.
>>>
>>
>> --------------------------
>> Grant Ingersoll
>> http://www.lucidimagination.com
>>
>> Lucene Helpful Hints:
>> http://wiki.apache.org/lucene-java/BasicsOfPerformance
>> http://wiki.apache.org/lucene-java/LuceneFAQ
>>
>>
>>
>>
>>
>>
>>
>>
> --------------------------
> Grant Ingersoll
> http://www.lucidimagination.com
>
> Lucene Helpful Hints:
> http://wiki.apache.org/lucene-java/BasicsOfPerformance
> http://wiki.apache.org/lucene-java/LuceneFAQ
>
>
>
>
>
>
>
>


-- 
Regards,
Shalin Shekhar Mangar.

Re: DataImportHandler running out of memory

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@gmail.com>.
DIH does not modify SQL. This value is used as a connection property
--Noble

On Wed, Jun 25, 2008 at 4:40 PM, Grant Ingersoll <gs...@apache.org> wrote:
> I'm assuming, of course, that the DIH doesn't automatically modify the SQL
> statement according to the batch size.
>
> -Grant
>
> On Jun 25, 2008, at 7:05 AM, Grant Ingersoll wrote:
>
>> I think it's a bit different.  I ran into this exact problem about two
>> weeks ago on a 13 million record DB.  MySQL doesn't honor the fetch size for
>> it's v5 JDBC driver.
>>
>> See
>> http://www.databasesandlife.com/reading-row-by-row-into-java-from-mysql/ or
>> do a search for MySQL fetch size.
>>
>> You actually have to do setFetchSize(Integer.MIN_VALUE) (-1 doesn't work)
>> in order to get streaming in MySQL.
>>
>> -Grant
>>
>>
>> On Jun 24, 2008, at 10:35 PM, Shalin Shekhar Mangar wrote:
>>
>>> Setting the batchSize to 10000 would mean that the Jdbc driver will keep
>>> 10000 rows in memory *for each entity* which uses that data source (if
>>> correctly implemented by the driver). Not sure how well the Sql Server
>>> driver implements this. Also keep in mind that Solr also needs memory to
>>> index documents. You can probably try setting the batch size to a lower
>>> value.
>>>
>>> The regular memory tuning stuff should apply here too -- try disabling
>>> autoCommit and turn-off autowarming and see if it helps.
>>>
>>> On Wed, Jun 25, 2008 at 5:53 AM, wojtekpia <wo...@hotmail.com> wrote:
>>>
>>>>
>>>> I'm trying to load ~10 million records into Solr using the
>>>> DataImportHandler.
>>>> I'm running out of memory (java.lang.OutOfMemoryError: Java heap space)
>>>> as
>>>> soon as I try loading more than about 5 million records.
>>>>
>>>> Here's my configuration:
>>>> I'm connecting to a SQL Server database using the sqljdbc driver. I've
>>>> given
>>>> my Solr instance 1.5 GB of memory. I have set the dataSource batchSize
>>>> to
>>>> 10000. My SQL query is "select top XXX field1, ... from table1". I have
>>>> about 40 fields in my Solr schema.
>>>>
>>>> I thought the DataImportHandler would stream data from the DB rather
>>>> than
>>>> loading it all into memory at once. Is that not the case? Any thoughts
>>>> on
>>>> how to get around this (aside from getting a machine with more memory)?
>>>>
>>>> --
>>>> View this message in context:
>>>>
>>>> http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p18102644.html
>>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>> --
>>> Regards,
>>> Shalin Shekhar Mangar.
>>
>> --------------------------
>> Grant Ingersoll
>> http://www.lucidimagination.com
>>
>> Lucene Helpful Hints:
>> http://wiki.apache.org/lucene-java/BasicsOfPerformance
>> http://wiki.apache.org/lucene-java/LuceneFAQ
>>
>>
>>
>>
>>
>>
>>
>
> --------------------------
> Grant Ingersoll
> http://www.lucidimagination.com
>
> Lucene Helpful Hints:
> http://wiki.apache.org/lucene-java/BasicsOfPerformance
> http://wiki.apache.org/lucene-java/LuceneFAQ
>
>
>
>
>
>
>
>



-- 
--Noble Paul

Re: DataImportHandler running out of memory

Posted by Grant Ingersoll <gs...@apache.org>.
I'm assuming, of course, that the DIH doesn't automatically modify the  
SQL statement according to the batch size.

-Grant

On Jun 25, 2008, at 7:05 AM, Grant Ingersoll wrote:

> I think it's a bit different.  I ran into this exact problem about  
> two weeks ago on a 13 million record DB.  MySQL doesn't honor the  
> fetch size for it's v5 JDBC driver.
>
> See http://www.databasesandlife.com/reading-row-by-row-into-java-from-mysql/ 
>  or do a search for MySQL fetch size.
>
> You actually have to do setFetchSize(Integer.MIN_VALUE) (-1 doesn't  
> work) in order to get streaming in MySQL.
>
> -Grant
>
>
> On Jun 24, 2008, at 10:35 PM, Shalin Shekhar Mangar wrote:
>
>> Setting the batchSize to 10000 would mean that the Jdbc driver will  
>> keep
>> 10000 rows in memory *for each entity* which uses that data source  
>> (if
>> correctly implemented by the driver). Not sure how well the Sql  
>> Server
>> driver implements this. Also keep in mind that Solr also needs  
>> memory to
>> index documents. You can probably try setting the batch size to a  
>> lower
>> value.
>>
>> The regular memory tuning stuff should apply here too -- try  
>> disabling
>> autoCommit and turn-off autowarming and see if it helps.
>>
>> On Wed, Jun 25, 2008 at 5:53 AM, wojtekpia <wo...@hotmail.com>  
>> wrote:
>>
>>>
>>> I'm trying to load ~10 million records into Solr using the
>>> DataImportHandler.
>>> I'm running out of memory (java.lang.OutOfMemoryError: Java heap  
>>> space) as
>>> soon as I try loading more than about 5 million records.
>>>
>>> Here's my configuration:
>>> I'm connecting to a SQL Server database using the sqljdbc driver.  
>>> I've
>>> given
>>> my Solr instance 1.5 GB of memory. I have set the dataSource  
>>> batchSize to
>>> 10000. My SQL query is "select top XXX field1, ... from table1". I  
>>> have
>>> about 40 fields in my Solr schema.
>>>
>>> I thought the DataImportHandler would stream data from the DB  
>>> rather than
>>> loading it all into memory at once. Is that not the case? Any  
>>> thoughts on
>>> how to get around this (aside from getting a machine with more  
>>> memory)?
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p18102644.html
>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>> -- 
>> Regards,
>> Shalin Shekhar Mangar.
>
> --------------------------
> Grant Ingersoll
> http://www.lucidimagination.com
>
> Lucene Helpful Hints:
> http://wiki.apache.org/lucene-java/BasicsOfPerformance
> http://wiki.apache.org/lucene-java/LuceneFAQ
>
>
>
>
>
>
>

--------------------------
Grant Ingersoll
http://www.lucidimagination.com

Lucene Helpful Hints:
http://wiki.apache.org/lucene-java/BasicsOfPerformance
http://wiki.apache.org/lucene-java/LuceneFAQ








Re: DataImportHandler running out of memory

Posted by Grant Ingersoll <gs...@apache.org>.
I think it's a bit different.  I ran into this exact problem about two  
weeks ago on a 13 million record DB.  MySQL doesn't honor the fetch  
size for it's v5 JDBC driver.

See http://www.databasesandlife.com/reading-row-by-row-into-java-from-mysql/ 
  or do a search for MySQL fetch size.

You actually have to do setFetchSize(Integer.MIN_VALUE) (-1 doesn't  
work) in order to get streaming in MySQL.

-Grant


On Jun 24, 2008, at 10:35 PM, Shalin Shekhar Mangar wrote:

> Setting the batchSize to 10000 would mean that the Jdbc driver will  
> keep
> 10000 rows in memory *for each entity* which uses that data source (if
> correctly implemented by the driver). Not sure how well the Sql Server
> driver implements this. Also keep in mind that Solr also needs  
> memory to
> index documents. You can probably try setting the batch size to a  
> lower
> value.
>
> The regular memory tuning stuff should apply here too -- try disabling
> autoCommit and turn-off autowarming and see if it helps.
>
> On Wed, Jun 25, 2008 at 5:53 AM, wojtekpia <wo...@hotmail.com>  
> wrote:
>
>>
>> I'm trying to load ~10 million records into Solr using the
>> DataImportHandler.
>> I'm running out of memory (java.lang.OutOfMemoryError: Java heap  
>> space) as
>> soon as I try loading more than about 5 million records.
>>
>> Here's my configuration:
>> I'm connecting to a SQL Server database using the sqljdbc driver.  
>> I've
>> given
>> my Solr instance 1.5 GB of memory. I have set the dataSource  
>> batchSize to
>> 10000. My SQL query is "select top XXX field1, ... from table1". I  
>> have
>> about 40 fields in my Solr schema.
>>
>> I thought the DataImportHandler would stream data from the DB  
>> rather than
>> loading it all into memory at once. Is that not the case? Any  
>> thoughts on
>> how to get around this (aside from getting a machine with more  
>> memory)?
>>
>> --
>> View this message in context:
>> http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p18102644.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>>
>
>
> -- 
> Regards,
> Shalin Shekhar Mangar.

--------------------------
Grant Ingersoll
http://www.lucidimagination.com

Lucene Helpful Hints:
http://wiki.apache.org/lucene-java/BasicsOfPerformance
http://wiki.apache.org/lucene-java/LuceneFAQ








Re: DataImportHandler running out of memory

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
Setting the batchSize to 10000 would mean that the Jdbc driver will keep
10000 rows in memory *for each entity* which uses that data source (if
correctly implemented by the driver). Not sure how well the Sql Server
driver implements this. Also keep in mind that Solr also needs memory to
index documents. You can probably try setting the batch size to a lower
value.

The regular memory tuning stuff should apply here too -- try disabling
autoCommit and turn-off autowarming and see if it helps.

On Wed, Jun 25, 2008 at 5:53 AM, wojtekpia <wo...@hotmail.com> wrote:

>
> I'm trying to load ~10 million records into Solr using the
> DataImportHandler.
> I'm running out of memory (java.lang.OutOfMemoryError: Java heap space) as
> soon as I try loading more than about 5 million records.
>
> Here's my configuration:
> I'm connecting to a SQL Server database using the sqljdbc driver. I've
> given
> my Solr instance 1.5 GB of memory. I have set the dataSource batchSize to
> 10000. My SQL query is "select top XXX field1, ... from table1". I have
> about 40 fields in my Solr schema.
>
> I thought the DataImportHandler would stream data from the DB rather than
> loading it all into memory at once. Is that not the case? Any thoughts on
> how to get around this (aside from getting a machine with more memory)?
>
> --
> View this message in context:
> http://www.nabble.com/DataImportHandler-running-out-of-memory-tp18102644p18102644.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>


-- 
Regards,
Shalin Shekhar Mangar.