Hi Andrey,
I got success in writing the working code for async select and it worked as
expected. Thanks for your suggestion. I am attaching java program to this
thread so that any newbie can refer it for there work.
About the error which was saying that cannot access the database , what I
have observer that if this error occur then shutdown the server and restart
it , it will work fine.
Because of my program , opened the db at starting of the program and when
any error comes in between of the program then the db is locked as the
db.close(); command didnt ran as the program terminated before that.
Thank you.
--Shivanandan Gupta
On Tuesday, 24 February 2015 17:56:26 UTC+5:30, Shivanandan Gupta wrote:
>
> Hi Andrey,
>
> I tried Asynchronous select query using java but while connecting to the
> db it throwing exception given below, I am attaching the code which I used.
>
> C:\Program Files\Java\jdk1.8.0_31\bin>java Async_query
> Feb 24, 2015 12:20:19 PM com.orientechnologies.common.log.OLogManager log
> INFO: OrientDB auto-config DISKCACHE=224MB (heap=13,890MB os=62,499MB
> disk=448MB)
> Exception in thread "main"
> com.orientechnologies.orient.core.exception.OStorageException: Cannot open
> local storage 'localhost:2480/GratefulDeadConcerts' with mode=rw
> at
> com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:214)
> at
> com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:243)
> at Async_query.main(Async_query.java:18)
> Caused by: com.orientechnologies.orient.core.exception.OStorageException:
> Cannot open the storage 'GratefulDeadConcerts' because it does not exist in
> path: localhost:2480/GratefulDeadConcerts
> at
> com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:159)
> ... 2 more
>
>
> Thanks,
> --Shivanandan Gupta
>
> On Monday, 23 February 2015 12:44:10 UTC+5:30, Shivanandan Gupta wrote:
>>
>> Thanks Andrey for your suggestion I will try this out.
>>
>> -- Shivanandan Gupta
>>
>> On Monday, 23 February 2015 12:33:39 UTC+5:30, Andrey Lomakin wrote:
>>>
>>> HI,
>>> Did you consider asynchronous SQL queries ?
>>> When all results are sent on the fly to the client and do not collected
>>> on server side.
>>>
>>> On Fri, Feb 20, 2015 at 10:30 AM, Shivanandan Gupta <
>>> [email protected]> wrote:
>>>
>>>> Hi All,
>>>>
>>>> I am trying to select 100,000 records from a class (class is having
>>>> 1,000,000 records and each record is having 74 properties) but I am
>>>> getting out of memory GC overhead limit exceeded error. My normal query
>>>> will be to select 1,000,000 records from the class and the class will have
>>>> 70+ properties.
>>>>
>>>> memory configuration used is given below in server.bat file
>>>>
>>>> rem ORIENTDB MAXIMUM HEAP. USE SYNTAX -Xmx<memory>, WHERE <memory> HAS
>>>> THE TOTAL MEMORY AND SIZE UNIT. EXAMPLE: -Xmx512m
>>>> set MAXHEAP=-Xmx6g
>>>> rem ORIENTDB MAXIMUM DISKCACHE IN MB, EXAMPLE 8192 FOR 8GB
>>>> set MAXDISKCACHE=-Dstorage.diskCache.bufferSize=40960
>>>>
>>>>
>>>>
>>>> query executed is "select from abcd limit 100000"
>>>>
>>>> 2015-02-20 08:10:06:775 INFO {db=eigenin1} [TIP] Query 'select from
>>>> s_asset limit 100000' returned a result set with more than 10000 records.
>>>> Reduce it to improve performance and reduce RAM used
>>>> [OProfiler]java.lang.OutOfMemoryError: GC overhead limit exceeded
>>>> Dumping heap to java_pid3952.hprof ...
>>>> Dump file is incomplete: No space left on device
>>>>
>>>> 2015-02-20 08:14:36:759 INFO {db=eigenin1} [TIP] Query 'select from
>>>> s_asset limit 20000' returned a result set with more than 10000 records.
>>>> Reduce it to improve performance and reduce RAM used [OProfiler]
>>>> 2015-02-20 08:16:48:239 INFO {db=eigenin1} [TIP] Query 'select from
>>>> s_asset limit 30000' returned a result set with more than 10000 records.
>>>> Reduce it to improve performance and reduce RAM used [OProfiler]
>>>>
>>>> Thanks,
>>>> Shivanandan Gupta
>>>>
>>>> --
>>>>
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "OrientDB" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> Best regards,
>>> Andrey Lomakin.
>>>
>>>
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
import com.orientechnologies.orient.test.*;
import com.orientechnologies.orient.core.db.document.*;
import com.orientechnologies.orient.core.sql.query.*;
import com.orientechnologies.orient.core.command.*;
import com.orientechnologies.orient.core.record.impl.*;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
import com.googlecode.concurrentlinkedhashmap.*;
import javax.annotation.concurrent.GuardedBy;
class Async_query {
public static void main(final String[] args) throws Exception {
ODatabaseDocumentTx db = new ODatabaseDocumentTx("plocal:D:\\orientdb-community-2.0.1\\orientdb-community-2.0.1\\databases\\eigen");
db.open("admin","admin");
try {
db.begin();
// YOUR CODE
System.out.println("Program is Started");
Date date = new Date();
System.out.println("Start Time is "+ date);
List<ODocument> result = db.command(
new OSQLAsynchQuery<ODocument>("select from s_asset limit 1000000",
new OCommandResultListener() {
int resultCount = 0;
@Override
public boolean result(Object iRecord) {
resultCount++;
ODocument doc = (ODocument) iRecord;
// DO SOMETHING WITH THE DOCUMENT
// System.out.println("Program in Select Successful");
System.out.println(doc);
return resultCount > 1000000 ? false : true;
}
@Override
public void end() {
}
})).execute();
db.commit();
Date date1 = new Date();
System.out.println("Program Start time is "+date+" And End Time is "+ date1);
// System.out.println(result.size());
// for(ODocument doc : result){
// System.out.println("Program is in result SOP");
// System.out.println(doc);
// }
} finally {
db.close();
}
}
}