strategy advice: distribution/replication means each server get full (#TB !) copy of dbase ?
OrientDB Version, operating system, or hardware.
- v2.2.5
Operating System
- [x] Linux
- [ ] MacOSX
- [ ] Windows
- [ ] Other Unix
- [ ] Other, name?
Expected behavior and actual behavior
Our dbase is growing into several TB filesystem size. We have 6 identical servers, spread over 2 datacenters, 3 servers per datacenter. When I want redundancy, and distribution of workload, among these 6 servers, what is the best strategy? I want to avoid that the full database size gets copied, and synchronised, between all 6 servers. What I think would be more beneficial, is that clusters are spread accross the 6 servers, with for example 3 copies of each cluster (2 in same DC, 1 in alternate DC). Is that a good strategy to achieve maximum performance (parallel workloads) and space optimisation ? If so, how to configure OrientDB for this ?
Steps to reproduce the problem
If you have data-centers, the Enterprise Edition is suggested, because it supports them: http://orientdb.com/docs/last/Data-Centers.html. In this way you can keep the writeQuorum to the majority IN the data centers, rather than all the servers that in your case is 6 and N/2+1 = 4 servers (as majority).
If you have TB of database and it's growing, maybe sharding is a better strategy. What kind of workload do you have? Mostly read than write? How many read/write per second do you want to achieve? Are you using graph, document or mixed API?
Someone commencted indeed in another topic that different classes can be created for the same data, with then a specific class per range of that data (eg all records for a same day in the same class, records for other day in another class, etc)
This is an interesting suggestion, but the mechanism of OrientDB for distributed processing is described with entire databases, which get copied entirely between the servers that participate in the distributed config for such database. I am hesitating to believe that this mechanism of replicating entire databases is scalable for truely BIG databases (multiple TBs, and more).
I analysed the documentation about the sharding, where the per-database config file can specify on which servers specific clusters should be replicated/distributed. That seems a very applicable way of working which I would like to test, but : we want to keep the ease of working to cleanup old records from the class , by simply doing a DROP CLUSTER of one entire cluster, which therefor needs to be created with some date-range criteria (all data of a same date or date+hour reside in the same cluster). This implies that we will need to create many clusters, we will of course use some naming convention. And these clusters will need to be created for several (nearly all) of our classes.
So, referring to the documented config file for sharding, "distributed-db-config.json", there will need to be all these many clusters included in the config file, each one (of the cluster names) with a specification of which servers must hold that cluster. -> can this config file contain cluster-name patterns ? For example, I could specify all clusters whose name is ending on a particular digit (10 possible combinations) in the config file, such as
"clustername___5": { "servers": [ "serverA", "serverB", "serverC" ] }, "clustername___6": { "servers": [ "serverD", "serverE", "serverF" ] }, ...
You could also theoretically set the database to one cluster per class with
ALTER DATABASE MINIMUMCLUSTERS 1
And then add your "time based" clusters to the class manually yourself.
@lvca - It would also be cool, if the clusters per class setting would be at class level. That would offer the best flexibility.
Scott
Scott, thx for this info, it sounds something we will need to set indeed in order to be sure we can make the clusters (per class) ourselves (with convenient filenames, and applicable sharding-config). And yes it would be ideal if we can set this on a per-class level, instead of one setting for the entire database.
Remains the question if the interpretation of the sharding-config file supports cluster-name patterns, like I described above. I guess so (altough not sure) because the template contains the asterisk:
... "clusters": { "internal": { }, "*": { "servers": ["<NEW_NODE>"] } }
I was studying in detail the 'sharding' configs of OrientDB, and found this remark under the "Cluster Locality" section of "http://orientdb.com/docs/last/Distributed-Sharding.html" :
OrientDB automatically creates a new cluster per each class as soon as a node joins the distributed cluster. These cluster names have the node name as suffix:
Does this mean that, in distributed mode, I cannot create clusters myself and give them a naming-convention which allows my INSERT or SELECT statement to specify one particular cluster only ?
Being you can rename clusters, I don't think there is an issue with what you want to do. The section of the docs you referred to is simply the standard operation of ODB. And, as of 2.2.0, ODB creates multiple clusters per class. So, you'll have to make ammends for that.
On a side note, reading the docs (again).....
The whole distribution part of ODB needs an overhaul from a terminology standpoint. Cluster is simply the wrong word. It should be "shard". When ODB creates a class, it creates multiple shards. That is how it should read.
And currently, according to the limitations, sharding is a user-land responsibility.
The "mix-up" of the term cluster with shard is even evident in the limitations section.
Selecting the right shard (cluster) is up to the application.
Hopefully this will be addressed in 3.0 too. I am crossing my fingers. :smile:
Scott
That's right, the cluster is like a shard. In v2.2 we don't use the server name as suffix anymore, but if you want a cluster (shard) is stick to a server, you can use the "owner" tag in the json configuration.
@lvca - does that mean the docs needs some additional work? There is no mention of an "owner" tag, nor how such a tag can be used to shard with. At least I couldn't find anything.
Scott
This was already documented: http://orientdb.com/docs/2.2/Distributed-Architecture.html#static-owner. I've just added it also in the http://orientdb.com/docs/2.2/Distributed-Configuration.html.
Would using the static owner then mean high availability is no longer possible?
Scott
If the owner server is down, no new records can be created on that cluster. However, usually the cluster is selected by OrientDB, not the user. In this cases, OrientDB will simply select another available cluster.
But in the case you want to write to the cluster "Log_15_08_2016" and it's not available, I think it's right an error is provided.
Ok. I get it. So, in the case where a user wants to be selective of clusters, then they will be giving up HA to get that ability. If they aren't specific about the cluster, ODB will carry on happily, despite a node dropping offline, and HA is still upheld.
Yes, I'd say an error on writes to distinctly targeted clusters, when the node with the owning cluster is down, would be a good idea, if it isn't already the case. :smile:
Scott
Is this confirmed ? "So, in the case where a user wants to be selective of clusters, then they will be giving up HA to get that ability" because every cluster has only a single 'owner' server ?
We need to be selective of the clusters in which we insert some records and from which we query records, in order to
- have control over the replication-level of the big database, to avoid that the full database size gets copied, and synchronised, between all servers which are part of a distributed setup. Instead we want that clusters are spread accross all the servers, but with for example 3 copies of each cluster (2 in same DC, 1 in alternate DC)
- take backups (or restores) selectively on a per-cluster basis (old clusters do not change anymore, so do not need backups anymore; backups needed only of clusters with 'recent' data)
That is what I am trying to get at. The mix between ODB controlling clusters and the user controlling clusters isn't totally clear to me. What are the advantages and disadvantages?
Scott
Even more : if there is a concept required of 'owning' server for each cluster in a distributed setup, then what is the advantage of having your clusters distributed over multiple servers ? The mechanisms behind this concept are not very clear to me, how they would still allow to
- distribute queries that span a single cluster, to be distributed over multiple servers (each one doing part of the work of the query)
- keep the clusters accessible in all cases (HA) for INSERT as well as SELECT
Hi guys,
If you don't specify the owner, OrientDB will take care to reassign it to an available server from the servers list. So this is the default and fail over works. But if you want a server is the sticky owner, it's your choice.
@lvca We have 6 servers, and I want to avoid that the entire multie-TB database gets replicated on each and every server (too much traffic). Therefor I think of defining data-clusters upfront with a naming convention, that I can use in the "distributed-db-config.json" file to assign alternating (round-robin alike) sets of 3 servernames per cluster-name patterns: For example, for clusters that will be assigned to a class "classXX", all the clusters will have names ending on "_0" , "_1", "_2", "_3", "_4" or "_5" :
... "classXX_cl__0": { "servers": [ "serverA", "serverB", "serverC" ] }, "classXX_cl__1": { "servers": [ "serverB", "serverC", "serverD" ] }, "classXX_cl__2": { "servers": [ "serverC", "serverD", "serverE" ] }, "classXX_cl__3": { "servers": [ "serverD", "serverE", "serverF" ] }, "classXX_cl__4": { "servers": [ "serverE", "serverF", "serverA" ] }, "classXX_cl__5": { "servers": [ "serverF", "serverA", "serverB" ] }, ...
With the 6 servers, I can thus make 6 such groups of clusters that each have 3 servers assigned.
To identify in which cluster we will store our time-based records (they all carry some date/time attribute), that last digit of the cluster-name can be determined from the hour in the record, modulo 6 : 24 hours in a day, hence 6 possible results from MODULO(hour,6)
I am thinking of creating clusters for each class, per day, and per MODULO(hour,6) : for example (for Aug-19 2016):
classXX_cl20160819_0 , classXX_cl20160819_1, classXX_cl20160819_2, classXX_cl20160819_3, classXX_cl20160819_4 and classXX_cl20160819_5
I will then use a INSERT INTO classXX_cl20160819_1 statement to store all records with date 20160819 and hour 01am, 07am, 1pm, 7pm
So far so good.
The only thing I don't know how to realize, is how to connect client programs via the RESP-API to this OrientDB setup, in a way that the clients can reach all data:
- with a connection to "serverA", all clusters with names ending on "__0", "__4" and "*_5" can be accessed
- with a connection to "serverD", all clusters with names ending on "__1", "__2" and "*_3" can be accessed
Right ?
So each client should make 2 connections in order to be able to access all of the clusters ?
What if for example "serverA" fails? To which server shall the client then connect ?
This is also where I was heading here. https://groups.google.com/forum/#!topic/orient-database/lBDvEonG32I
Scott
@rdelangh your design looks good to me and actually most of it will be automatic with OrientDB v3.0 and auto-sharding ;-)
About the connection, don't worry: whatever server you're connected, OrientDB will forward the command to the right ones to retrieve the data you requested. So you can be connected to any node and if the cluster/record is not on the local server, a map-reduce request will be sent to the involved servers. It's all hidden to you, you just write SQL.
About the connection, don't worry: whatever server you're connected, OrientDB will forward the command to the right ones to retrieve the data you requested. So you can be connected to any node and if the cluster/record is not on the local server, a map-reduce request will be sent to the involved servers. It's all hidden to you, you just write SQL.
Ahh..that is the piece of the puzzle that was missing in my mind. :+1:
Scott