Showing posts with label orientdb. Show all posts
Showing posts with label orientdb. Show all posts

Friday, 20 December 2013

OrientDB: working with types

London, December 20th 2013

OrientDB Team is working on SQL language to provide more powerful functions to works against types. Since OrientDB can work in schema-less mode, it's hard to know the real type of a value. For example when you work with numbers, you could have different type stored. How to know if a number is a Long or an Integer?

.type() method (since 2.0)

Here comes the new type() method (all these methods are available on 2.0-SNAPSHOT, "develop" branch), that returns the OrientDB type of a value. Let's try it against the ROLES property of OUser class.

select roles.type() from ouser


@rid@versionroles
#-2:10LINKSET
It's an LINKSET!

NOTE: .type() method works on the SQL pipeline, so it doesn't access to the stored type, but the type loaded in memory and in case of SET, LIST and MAP sometimes can't distinguish between EMBEDDED types and LINK types.

.javaType() method (since 2.0)

When you want to know the respective Java class, you can use the method .javaType(), example:

select roles.javaType() from ouser

@rid@versionroles
#-2:10com.orientechnologies.orient.core.type.tree.OMVRBTreeRIDSet
Now we can access to the type it would be cool to convert values at the fly. OrientDB already has few methods to to this:
  • asBoolean()
  • asDate()
  • asDateTime()
  • asDecimal()
  • asFloat()
  • asInteger()
  • asList()
  • asLong()
  • asSet()
  • asString()
But we've implemented a generic convert(<type>) method to convert values dynamically.

.convert(<type>) method (since 2.0)



convert() accepts as unique, mandatory, parameter the OrientDB type (OType enumeration) or any Java type recognized by OrientDB. Example using the STRING OrientDB type:

select roles.convert(STRING) from ouser

@rid@versionroles
#-2:10[#4:0=#4:0]
And the same using the Java type:

select roles.convert(java.lang.String) from ouser


@rid@versionroles
#-2:10[#4:0=#4:0]
Since the type is an EMBEDDEDSET, the more interesting thing is converting into a list to get the first value. Example:


select roles.convert(EMBEDDEDLIST)[0] from ouser

@rid@versionroles
#-2:10#4:0

Happy Christmas!

Luca Garulli
CEO at Orient Technologies
the Company behind OrientDB
http://about.me/luca.garulli

Thursday, 19 December 2013

OrientDB: improved SQL filtering

London, December 19th 2013


The more developers use OrientDB, the more use case we receive. One of the most wanted requirements is improving filtering of results, specially on traversing.

The OrientDB SQL dialect is powerful enough to mix SELECT and TRAVERSE to create very complex queries, but sometimes such queries are pretty big and hard to read.

For this reason we developed the pipeline filtering using brackets, by extending current SQL engine.

Examples

Example 1: Get the first friend of mine

You can get it by using:

select expand( out ) from (
  select out('Friend') from Profile where name = 'Luca'
) limit 1
     
But now you can also do this:

select out('Friend')[0] from Profile where name = 'Luca'

Much easier and faster on execution!

Example 2: from GratefulDeadConcerts database traverse all the out() connection and get the first song called 'MONA'

select from (
  select expand( out() ) from V
) where name = 'MONA' and type = 'song' limit 1

@rid@version@classnamein_followed_bysong_typeperformancestypeout_followed_byout_sung_byout_written_by
#9:619VMONA[2]cover1song[2][1][1]
Executed in 0.455 seconds.

Now let's use the new way:

select expand( out()[name='MONA'][type='song'] ) from V

@rid@version@classnamein_followed_bysong_typeperformancestypeout_followed_byout_sung_byout_written_by
#9:619VMONA[2]cover1song[2][1][1]
Executed in 0.106 seconds.

Note last execution, in this case, is 4x faster!

Squared brackets [] allow to:
- filtering by one index, example out()[0]
- filtering by multiple indexes, example out()[0,2,4]
- filtering by ranges, example out()[0-9]
- filtering by equal conditions (only equals is supported), example out()[@class = 'Person']

Brackets [] can be chained, in this case it's like filtering by AND operator. Look at the Example 2.

For more information about the issue: https://github.com/orientechnologies/orientdb/issues/1888

This is available in "develop" branch right now and will be part of next release.


Luca Garulli
CEO at Orient Technologies
the Company behind OrientDB

Thursday, 21 November 2013

Released OrientDB v 1.6.1: bugs fixed and some improvements in performance

Orient Technologies has released OrientDB v1.6.1. This is a hot-fix for v1.6 so this email will be shorter than usual.


What's new
  • Starting from 1.6.1 OrientDB is distributed in 2 ways:
    • TAR.GZ for Linux, MacOSX and Unix in general
    • ZIP for Windows users
  • Studio plugin is bundled in server/plugins directory
  • The build process now generates a 100% complete OrientDB installation, so get the source code from GitHub (https://github.com/orientechnologies/orientdb/tree/develop) and execute "ant clean install". Now the GratefulDeadConcerts database is automatically generated.
  • We've improved performance with SBTree indexes and plocal in general

Next Online course

Do you wish to attendee a OrientDB course, but you can't get 2 entire days off? Well, we've created a new format for the Online course, the "A week in Graphs" course. about 2 hours each day for 5 days. Apply now to the December edition to get the Early Bird price:


Have fun with Graphs,

Luca Garulli
CEO at Orient Technologies
the Company behind OrientDB

Tuesday, 5 November 2013

OrientDB becomes Distributed using Hazelcast, Leading Open Source In-Memory Data Grid

OrientDB becomes Distributed using Hazelcast, Leading Open Source In-Memory Data Grid
Elastic Distributed scalability added to OrientDB, a Graph Database that support hybrid Document Database features
London, UK – Orient Technologies (http://www.orientechnologies.com/) and Hazelcast (http://www.hazelcast.com) today announced that OrientDB has gained a multi-master replication feature powered by Hazelcast.
Clustering multiple server nodes is the most significant feature of OrientDB 1.6. Databases can be replicated across heterogeneous server nodes in multi-master mode achieving the best of scalability and performance.
“I think one of the added value of OrientDB against all the NoSQL products is the usage of Hazelcast while most of the others use Yahoo ZooKeeper to manage the cluster (discovery, split brain network, etc) and something else for the transport layer.” said Luca Garulli, CEO of Orient Technologies. “With ZooKeeper configuration is a nightmare, while Hazelcast let you to add OrientDB servers with ZERO configuration. This has been a big advantage for our clients and everything is much more ‘elastic’, specially when deployed on the Cloud. We’ve used Hazelcast not only for the auto-discovery, but also for the transport layer. Thanks to this new architecture all our clients can scale up horizontally by adding new servers without stopping or reconfigure the cluster”.
“We are amazed by the speed with which OrientDB has adopted Hazelcast and we are delighted to see such excellent technologists teaming up with Hazelcast.” said Talip Ozturk, CEO of Hazelcast. “We work hard to make the best open source in-memory data grid on the market and are happy to see it being used in this way.”
Both Hazelcast and Orient Technologies are providing professional open source support to their respective projects under the Apache software license.
About Orient Technologies
Orient Technologies is the company behind the NoSQL project OrientDB, the Graph Database with a hybrid model taken from both the Document Database and Object Orientation worlds. OrientDB is FREE for any purpose even commercial because is released under the Apache2 License. Orient Technologies offers commercial services against OrientDB for companies who want supporttraining and consulting.
About Hazelcast
Hazelcast (www.hazelcast.com) develops, distributes and supports the leading open source in-memory data grid. The product, also called Hazelcast, is a free open source download under the Apache license that any developer can include in minutes to enable them to build elegantly simple mission-critical, transactional, and terascale in-memory applications. The company provides commercially licensed Enterprise editions, Hazelcast Management Console and professional open source training, development support and deployment support. The company is privately held and headquartered in Palo Alto, California.
Keywords: Hazelcast, In-memory data grid, Document Database, Object Database, In-memory Database, computing, big data, NoSQL, grid computing, Apache License, Open Source

Thursday, 31 October 2013

Orient Technologies has a Halloween Treat for you: OrientDB v1.6!

Happy Halloween! Trick or Treat?

Orient Technologies has just released OrientDB v1.6. 


What's new? First of all we joined the Standard Edition and Graph Edition in just "Community Edition". By default it contains all the components to use OrientDB as Graph Database. if you want to use it as embedded as pure Document Database just link the needed jars only.

Community Edition

Community Edition means the FREE version of OrientDB with all the features you already knows and something news:
  • SBTree: new index engine with the support for transactions and range queries
  • Distributed: new Architecture based on Hazelcast, new Distributed Transaction support across nodes, new Database Sharding feature
  • Studio: total rewriting in a new tool hosted on separate project
  • HTTP: execute commands in batch mode, partial document updates, JSON as return of create and update documents, management of multi databases in the same connection
  • Scripts: new "Orient" variable to get database instances, new switchUser() API to change current user
  • Plugins: new hot deployment plugin as folders, zip and jar files
  • SQL: new target "metadata" to retrieve schema and indexes
  • Console: new silent mode
  • Many features and performance improvements on plocal and hash indexes
  • Bug fixing


This Edition is commercial licensed and it's based on Community Edition with additional features like:
  • Workbench, as a centralized cockpit to manage multiple servers
  • SQL Profiler, to tune the database based on usage patterns
  • Metric Analyzer, to monitor and analyze metrics
  • Configurable Alerts, to get notified when a node is unreachable or when a metric breaks a configurable threshold
  • Production support available on demand (see below)
Enterprise Edition costs £ 1,000.00 per server/year or £ 500,00 for startups. For more information goto: Enterprise Edition.

Production Support

Starting form v1.6 Orient Technologies gives support only against Enterprise Editions that are tested on multiple platforms and certified. 

If you purchase the Production Support, the Enterprise Edition is FREE.

Hot-fixes

All the pending major/critical issues will be fixed in hot-fix releases (like 1.6.1, 1.6.2, etc.) planned about every week if needed.

Have fun tonight with ghosts and graphs!


Luca Garulli
CEO at Orient Technologies
the Company behind OrientDB


Saturday, 21 September 2013

New OrientDB replication engine and plans for the releasing of v. 1.6.

Hi all,
we're glad to announce in the "develop" branch (1.6.0-SNAPSHOT) the new distirbuted configuration engine that doesn't use Hazelcast's Executor Service but rather Queues. This made the entire work easier (we dropped 50% of code of previous implementation) achieving better performances.
This is the new configuration in orientdb-dserver-config.xml:
<handler
    class="com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin">
    <parameters>
        <parameter value="europe0" name="nodeName" />
        <parameter value="true" name="enabled" />
        <parameter value="hazelcast-0.xml" name="configuration.hazelcast" />
        <parameter name="conflict.resolver.impl"
            value="com.orientechnologies.orient.server.distributed.conflict.ODefaultReplicationConflictResolver" />
        <parameter name="configuration.db.default" value="default-distributed-db-config.json" />

        <parameter name="sharding.strategy.round-robin"
            value="com.orientechnologies.orient.server.hazelcast.sharding.strategy.ORoundRobinPartitioninStrategy" />
    </parameters>
</handler>
As you can see we don't use realignment tasks anymore: when a node comes up it get the pending messages from Hazelcast queue. This is good when a server goes up & down in a reasonable time like for a temporary network failure or an upgrade of a server. In case you plan to stop and restart the server after days you'd need to re-deploy the entire database on the server.
This is the default configuration in the new default-distributed-db-config.json file, put it under $ORIENTDB_HOME/config and remove that contained under the database if any. This configuration comes with only one partition where new joining nodes auto register themselves. So this means all the nodes have the entire database (no partitioning). To achieve better performance avoid to use a writeQuorum bigger than 2. I think having 2 servers that synchronously have the data it's very secure. However all the server in the partition are updated, just the client receives the response when writeQuorum is reached. This is the new default configuration file:
{
    "replication": true,
    "clusters": {
        "internal": {
            "replication": false
        },
        "index": {
            "replication": false
        },
        "ODistributedConflict": {
            "replication": false
        },
        "*": {
            "replication": true,
            "writeQuorum": 2,
            "partitioning": {
                "strategy": "round-robin",
                "default": 0,
                "partitions": [
                    [ "<NEW_NODE>" ]
                ]
            }
        }
    }
}

Partitions contains an array of partitions as node names. The keyword "<NEW_NODE>" means that new node that joins the cluster are automatically added in that partition. 

So if you start X nodes the replication works out of the box. Thanks to the partitioning you can shard your database across multiple nodes avoiding to have a symmetric replica. So you can use your 6 servers as before:

[
  [ "node0", "node1", "node2",  "node3", "node4", "node5" ]
]

or in this way:

[
  [ "node0", "node1", "node2" ],
  [ "node3", "node4", "node5" ]
]

It's like RAID. With this configuration you've 2 partitions (0 and 1) with 3 replica each. So the database is spanned across 2 partitions automatically that means each partition owns about half database. By default we provide the "round-robin" strategy but you can already plug your one to better split the graph following your domain.

This is part of the Sharding feature, so consider it as a preview. It will be available in the next release (1.7 or 2.0).

Furthermore we've introduced variable timeouts that change based on the runtime configuration (number of nodes, type of replicated command, etc.)

We've also introduced new settings to tune the replication engine (OGlobalConfiguration class):

DISTRIBUTED_THREAD_QUEUE_SIZE("distributed.threadQueueSize", "Size of the queue for internal thread dispatching", Integer.class,
      1000),

DISTRIBUTED_CRUD_TASK_TIMEOUT("distributed.crudTaskTimeout", "Maximum timeout in milliseconds to wait for CRUD remote tasks",
      Integer.class, 3000),
  DISTRIBUTED_COMMAND_TASK_TIMEOUT("distributed.commandTaskTimeout",
      "Maximum timeout in milliseconds to wait for Command remote tasks", Integer.class, 5000),

DISTRIBUTED_QUEUE_TIMEOUT("distributed.queueTimeout", "Maximum timeout in milliseconds to wait for the response in replication",
      Integer.class, 3000),
  DISTRIBUTED_SYNCH_RESPONSES_TIMEOUT("distributed.synchResponsesTimeout",
      "Maximum timeout in milliseconds to collect all the synchronous responses from replication", Integer.class, 5000),
  DISTRIBUTED_ASYNCH_RESPONSES_TIMEOUT("distributed.asynchResponsesTimeout",
      "Maximum timeout in milliseconds to collect all the asynchronous responses from replication", Integer.class, 15000),

  DISTRIBUTED_PURGE_RESPONSES_TIMER_DELAY("distributed.purgeResponsesTimerDelay",
      "Maximum timeout in milliseconds to collect all the asynchronous responses from replication", Integer.class, 15000);


I suggest to everybody is using the distributed architecture to upgrade to 1.6.0-SNAPSHOT and:
- update the file orientdb-dserver-config.xml and !
- update the file default-distributed-db-config.json
- remove the previous file default-distributed-db-config.json under the databases/<yourdb> directory

We successfully tested the new engine against 10 servers and 200 connected clients with a writeQuorum=2 (2 synchronous copy before to give the OK to the client).

Next week we'll release OrientDB 1.6, so you've last chance to vote your bugs to be in 1.6 roadmap!


Luca Garulli
CEO at Orient Technologies
the Company behind OrientDB
http://about.me/luca.garulli

Tuesday, 3 September 2013

Release OrientDB 1.5.1 containing hot-fixes for 1.5

London, 3rd September 2013

Orient Technologies has just released the version 1.5.1 of OrientDB Standard and Graph Editions.



URL: https://github.com/orientechnologies/orientdb/releases/tag/1.5.1

Take also a look at the list of all the fixed issues.

First book about OrientDB available from Packt

London, September 2nd 2013

Mr. Claudio Tesoriero is the author of "Getting Started with OrientDB", the new book about OrientDB. Claudio is a certified OrientDB developer that wrote this book for all the developers that want to start working with OrientDB NoSQL database.



Take a look at the Table of Contents:

Chapter 1: Installing OrientDB
    • Standard Edition
    • Graphed Edition
    • Key/Value Edition
    • Enterprise Edition
    • Installing from the latest stable release
      • Installing the Standard Edition
      • Installing the Graphed Edition
    • Compiling from the latest source snapshot
      • Running the test suite
    • Installing as a daemon/service
      • Linux systems
      • Windows systems
    • Summary

      • Configuration
        • orientdb-server-config.xml
        • orientdb-dserver-config.xml
      • The OrientDB console
      • OrientDB data files
      • Classes
        • Abstract classes
      • Security
        • Rules
        • Roles
        • Users
        • Server users
        • Record-level security
      • The OrientDB Studio
        • The Database section
        • The Query section
        • The Document section
        • The Functions section
        • The Graph section
        • The Raw access section
        • The root user
      • Back up / restore
        • Using the console
        • Using the OrientDB Studio
        • Automatic backup
      • Summary

    • Chapter 3: Programming OrientDB
      • Data types
      • Extended SQL
        • Creating a database
        • Creating classes
        • Inserting records
        • Deleting records
        • Reading and updating records
          • Fields
        • Schema-full classes and the mixed-mode schema
        • Relationships
          • One-to-one and one-to-many relationships
          • Many-to-many relationships
          • Traversing the relationships
          • SQL functions
        • The graph database
      • Using the JDBC driver
      • Other language drivers (PHP)
      • The native Java API
        • Opening a connection
          • Connection pools
        • Executing SQL queries
        • Executing SQL commands
        • Create, load, update, and delete a document
        • Object database support
      • RESTful APIs
      • Transactions
        • Transactions within REST calls
      • Summary

      Chapter 4: Performance Tuning

        • Caching
        • General Optimizations
          • The JVM optimization
          • Memory and cache
          • Mapping files
          • Connections
          • Transactions
      • Massive insertions
      • Datafile fragmentation
      • The profiler
      • Query tips
        • The explain command
        • Indexes
        • Looking for @rid values
      • Summary

        Chapter 5: Advanced Features
          • The embedded mode
          • Server-side code
            • Server-side function features
            • Creating a function
            • Usage
              • Java API
              • RESTful calls
            • Special variables
          • Hooks
          • Triggers
          • Gremlin support
            • Gephi
          • Clustering
            • How it works
              • Replication
            • Configuration and setup
          • Sending e-mails through OrientDB
            • Usage
          • Summary