quick clarification about local vs remote

63 views
Skip to first unread message

Krzysztof Baranowski

unread,
Apr 29, 2011, 2:49:03 PM4/29/11
to OrientDB
Hey Luca,

I'm using orientdb through tinkerpop for a web application. In
http://code.google.com/p/orient/wiki/Concepts#Database_URL you mention
that local database "can't be opened by multiple processes", you do
mean processes and not threads, right? Is it safe to use local
connection in a webapp with lots of threads, creating a new
OrientGraph("local:/home/databases/my_database") in manual transaction
mode in each one when I need it?

Chris

Luca Garulli

unread,
Apr 29, 2011, 3:37:25 PM4/29/11
to orient-...@googlegroups.com

Hi, exactly. You can use the same storage by multiple threads just each thread must have own OrientGraph instance.

Lvc@

pieter

unread,
Apr 29, 2011, 3:52:53 PM4/29/11
to orient-...@googlegroups.com
Hi,

Using this pattern, i.e. embedded local, what is the best strategy
regarding transaction times. Is it ok to have long running transactions,
or should the transaction be kept as short as possible, similar to
jdbc.

In JPA we normally had short transactions but kept the session open for
longer periods (i.e. Extended Persistence Context) of time as it
provides caching of already read entities.

So, can one in a conversation (eg. web wizard) use the same graph
instance committing often or not as required but not having to
reinstantiate a Graph instance for every request?

Hope it makes sense.

Thanks
Pieter

Luca Garulli

unread,
Apr 30, 2011, 5:20:01 AM4/30/11
to orient-database
Database instances are lightweights so don't worry to keep them open during long time. Furthermore in this way you can use the db's cache even though OrientDB has 2 levels of cache, so even if you re-create a new database the record/object could be loaded from memory if has been previously loaded.

Lvc@
Reply all
Reply to author
Forward
0 new messages