OrientDB Document API best practices

OrientDB is an open source NoSQL Database Managment System, which supports multiple models of operation:
  1. Document Model,
  2. Graph Model
  3. and
  4. Object Model.
We will write here about the Document Model. It is the most low-level of the three models and and can provide great performance if no graph or object model is needed. Nevertheless, using a document-based database requires different programming patterns than the ones you know already from the world of object-oriented programming. We will try to compose some best-practices and programming patterns here to guide you when working with document-based database systems in general and the usage of the OrientDB Document API in particular.

  1. Performance and Threading
    ODocument is not thread save. It is not intended to be accessed by multiple threads at the same time. Accessing the db using multiple instances of ODatabaseDocumentTx nevertheless is thread save.

    Anti-Pattern

    Pattern
    Explanations
    Note that documentDatabase itself is not used. ODocument accesses the document database via a thread-local, static instance of ODatabaseDocumentInternal. Consistently, it is required to set this thread-local instance in each thread that is running on the ODocument class.
  2. To be continued
Share itShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *