I am using the embedded, plocal database.
I insert about 1000 documents before I see insertion time start to
increase, although I want to insert much more than that. I'm not passing
anything to JVM arguments so I'm using default OrientDB configuration for
memory. One thing I should note, I don't know what thread will call my API
so re-use/open a connection from the OPartitionedDatabasePool every time an
insert is performed (not sure if that matters).
Essentially, I do this...
public void writeLogEntry(ODocument log, String message, Date timestamp, int
entrySize)
{
// get connection from OPartitionedDatabasePool...
ODatabaseDocumentTx db = this.dataCore.getDbConnection();
db.begin();
ODocument logEntryDocument = new ODocument("log_item");
// Set the log event fields for the new log event.
logEntryDocument.field("timestamp", timestamp);
logEntryDocument.field("message", message);
logEntryDocument.save();
long currentLogSize = log.field("log_size");
// Update the log size by adding the size of the log event.
log.field("log_size", (currentLogSize + entrySize));
// Add the log entry to the LINKSET in the log
Set<OIdentifiable> logEntries = log.field("log_events");
logEntries.add(logEntryDocument.getIdentity());
log.save();
db.commit();
}
On Monday, September 14, 2015 at 8:42:09 AM UTC-7, Enrico Risa wrote:
>
> Hi Bryan
>
> Are you inserting through plocal?
>
> how many records do you have to insert?
>
> After how many records do you see the slow down?
>
> Did you check the memory of your inserting batch?
>
>
> Enrico
>
> 2015-09-14 17:37 GMT+02:00 Bryan <[email protected] <javascript:>>:
>
>> Okay, I created issue #4965
>> <https://github.com/orientechnologies/orientdb/issues/4965>.
>>
>> What about the 2nd issue I have? Is there some reason inserting things
>> keeps getting slower and slower until I restart OrientDB?
>>
>> On Friday, September 11, 2015 at 10:50:49 AM UTC-7, Bryan wrote:
>>>
>>> Hi all,
>>>
>>> I have been experimenting with an OrientDB setup (version 2.1.0 - plocal
>>> connection) and noticed a very large difference in performance when passing
>>> in an OClass parameter to a LINKSET vs leaving it out.
>>> Example:
>>>
>>> OClass logItem = schema.createClass("log_item");
>>> logItem.createProperty("timestamp", OType.DATETIME);
>>> logItem.createProperty("message", OType.STRING);
>>>
>>> OClass log = schema.createClass("log");
>>> log.createProperty("name", OType.STRING);
>>>
>>> and
>>>
>>> log.createProperty("log_items", OType.LINKSET, logItem);
>>> VS
>>> log.createProperty("log_items", OType.LINKSET);
>>>
>>> I tested inserting 1 log and 1000 log items into the log.
>>> i.e.
>>> // log = Get the log...
>>> ODocument logItem = new ODocument("log_item");
>>> logItem.field("timestamp", new Date());
>>> logItem.field("message", "Hello World");
>>> logItem.save();
>>>
>>>
>>> Set<OIdentifiable> logItems = log.field("log_items");
>>> logItems.add(logItem.getIdentity());
>>> log.save();
>>>
>>>
>>> WITH OClass param => 38.8 seconds
>>> WITHOUT OClass param => 1.5 seconds
>>>
>>> So really I have 2 questions:
>>> 1) Why are updates so much faster when I DON'T add the OClass parameter.
>>> Is there a reason why I want to leave it in?
>>>
>>> 2) I'm experiencing decrease in insertion speed as the number of
>>> documents grows. If I shutdown OrientDB and start again I see speed go up
>>> temporarily until I insert more records and it continues to slow down...
>>> I've tried committing after every ".save()". Am I missing something?
>>>
>>> Thanks!
>>>
>> --
>>
>> ---
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
---
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.