Ehsan Ghanbari

Experience, DotNet, Solutions

BrightstarDB and its different targets

I was looking for NoSQL databases in Wikipedia, in Graph databases section I saw an open source data storage written in Dot Net. After exploring the source code I found that it would be so cool. This library seems to be easier than Neo4J to getting started. I don't know exactly how graph database work and also how BrightstarDB works.





In the above picture, the two feature marked with a circular was kind of interesting for me as I've read a lot about NoSQL databases. With BrightstarDB, you can work objects just like Entity Framework with the flexibility of NoSQL databases. It helps you to build .net Domain model and persist the objects into the BrightstarDB. And overall it's been optimized for high performance when working objects.

Rather than entity framework and LINQ, it supports for developing windows phone, windows 7 and 8. you can have isolated storage for these platforms and Operating systems. I'm writing a sample application via BrightstarDB, I will try to write a blog post as my first post about BrightstarDB in a few days.




A quick look at LMDB situation in NoSQL world

A comparison in  encouraged me to write about LMDB situation within NoSQL databases. LMDB is a key/value NoSQL database and this is A comparison of popular NoSQL databases.




There is another comparison in here if you are interested in to read more. One of the great features of LMDB is that it's a memory-mapped file like LevelDB (I think so!) and it makes the reading performance more and more. If you refer the above link I mentioned, you can see the complete list of LMDB Capabilities:

  1. Ordered-map interface (keys are always sorted, supports range lookups)
  2. Fully transactional, full ACID semantics with MVCC.
  3. Reader/writer transactions: readers don't block writers and writers don't block readers. Writers are fully serialized, so writes are always deadlock-free.
  4. Read transactions are extremely cheap and can be performed using no mallocs or any other blocking calls.
  5. Supports multi-thread and multi-process concurrency, environments may be opened by multiple processes on the same host.
  6. Multiple sub-databases may be created with transactions covering all sub-databases.
  7. Memory-mapped, allowing for zero-copy lookup and iteration.
  8. Maintenance-free, no external processor background cleanup/compaction required.
  9. No application-level caching. LMDB fully exploits the operating system's buffer cache.
  10. 32KB of object code and 6KLOC of C.
  11. Licensed under the OpenLDAP Public License

LMDB also supports multiple platforms and OS such as Linux, Mac OS, and windows (I've just heard about this one and haven't tested yet). LMDB is one of the fastest databases because it is in-process and runs just like other apps in the memory. I've not enough experience about working with key/value NoSQL databases but it seems that all of the above claims are true!

Document store NoSQL Databases

Document-oriented databases AKA Semi-structured data are designed for managing, storing and retrieving the document orientation databases. Document data stores are kinds of NoSQL databases.  There is no any kind of schema and limitation of fixed table fields and relations of traditional RDBMS databases in Document Store Databases. these databases store documents into a database. You can imagine the document a JSON document (a self-contained data in every document). There is no limitation for fields of these documents, they are completely dynamic and could be modified easily. Document store databases store the data in documents but in a standard encoded formats such as JSON, YAML or XML. These documents are not in a regular form as in relational databases, you can't see any kind of Schema, Primary key, table or relations!


This is a sample of JSON document contained FirstName and Email :


      FirstName: "Ehsan",
      Email: "[email protected]"


And this is another JSON document for the same person but in another document with a different structure: 


     LastName : "Ghanbari",
     Age: "24",
     Cell: "+989193782914",
     Email: "[email protected]",


Both of the documents are my personal information in different formats. As you can see there is no any convention and defined rule for sorting and styling of the data. Where you have to put the same data in the relational database that you have defined before with different kinds of joins and relations. Documents are addressed in the documents via a unique key, this key could be GUID, string, URL or a path.  Document databases are a class of storage systems which save the whole object hierarchy to disk and retrieve the same without the use of relational tables. To aid the searching in such databases most Document store databases have a map function which extracts the data needed and saves that as a "view" for later browsing and searching. These databases do away with the notion of transactions and locking mechanism in the traditional sense and offer high data through-put and "eventually consistent" data views. There are lots of document store databases such as BaseX, ClusterPoint, CouchDB, FleetDB, MongoDB, RavenDB and … Document databases generally have very powerful query engines and indexing features that make it easy and fast to execute many different optimized queries. 



The benefit of using Document Store Databases:

  1. Reading from document database makes a better performance because reading related data from different kinds of joins is so slow.
  2. Documents could be shared between different kinds of nodes. Which allows data to be grouped together more naturally and logically.
  3. You don’t need to translate the business objects or aggregates(DDDesign) to SQL queries! You have the same document in the database as you have in the model.
  4. Replication is much easier in a document database because of having the original document (Not inconsistent domain model) in a database.
  5. You can save any kind of data (Unstructured data) in document databases.
  6. You don’t need to buy an RDBMS license anymore!
  7. Changes to the application can be made anytime (what attracts me!)






What NoSQL Data Bases are all about ?

"Big Data is the driver for NoSQL’s rise, but not the only reason to use NoSQL, Many NoSQL databases are designed to run well on large clusters, which makes them more attractive for large data volumes. But often people select NoSQL due to easier database interaction in their applications. and Big Data, Big Users, and Cloud Computing – are driving the adoption of NoSQL technology. NoSQL databases are Non-relational ,Open-source , Cluster-friendly ,21st century web and schema-less" ~ Martin Fowler

NoSQL doesn't mean "No to SQL" but it stands for "Not only SQL", I mean NoSQL doesn't override SQL anymore and it's just a new kind of databases.NoSQL is a new way of thinking about a database and the biggest difference is that it's not a relational database. Relational databases are no longer answer today's unstructured data. And NoSQL databases are the same that is suitable for handling unstructured and unpredictable and big data with easier management and development. A NoSQL data format is JSON(in document store NoSQL databases ) and a JSON document could be several raw from several tables with different kinds of relations of an RDBMS database. As NoSQL databases have no predefined rules like tables or schema like in relation databases, it is too easier to make any change in NoSQL databases.

What's wrong with RDMS or why there is a need for new different database systems ??

RDBMS databases prefer predictable and structured data and require vertical and horizontal expansion of servers and are becoming more difficult As time goes because of using unstructured data on some websites. you can see in the chart below published by couchBase, using Unstructured data has become more than before and handling these kinds of data by the relational database is little bit pain because RDMBS is designed for structured data!


And also based on martin fowler's presentation about NoSQL , "SQL is designed to run in a big box and a single node system and it doesn't work well with many little boxes", in today world maybe millions of users want to access the same data simultaneously, so it maybe cause some performance issues.



Rather than that imagine a RDMS database that is designed and it is working well, if you wanna to make a change in your database such as adding new fields to a table or adding a new join , it maybe take too much time to achieve, maybe more than a week , but in NoSQL databases you don’t need to do anything in database because data is in document format in this kind of databases.


NoSQL databases Advantages

Easier development and large-scale data and also easier to scale than SQL. There is no need to Join, you don't need to use ORM in the data access layer.NoSQL database doesn't know anything about your data and doesn't matter, it could be text, image, number, movie and anything else. In a more complex data model and when using domain driven design, it's so hard to map aggregate model to relational database and also it causes some kinds of redundant about Value Object (DDD).In relational database data settle In schema and table you have defined before but in NoSQL, you put anything you can in the database!


Based on NoSQL website list of NoSQL Database (Document Store):

MongoDB , RaptorDB , Terrastore , densodb , ThruDB ,JasDB, Clusterpoint Server , Couchbase Server , RavenDB , RethinkDB , NoSQL embedded , MarkLogic ServerEJDB , SisoDB , djondb ,CouchDB , Elasticsearch, SDB




About Me

Ehsan Ghanbari

Hi! my name is Ehsan. I'm a developer, passionate technologist, and fan of clean code. I'm interested in enterprise and large-scale applications architecture and design patterns and I'm spending a lot of my time on architecture subject. Since 2008, I've been as a developer for companies and organizations and I've been focusing on Microsoft ecosystem all the time. During the&nb Read More

Post Tags
Pending Blog Posts
Strategic design
Factory Pattern
time out pattern in ajax
Selectors in Jquery
Peridic pattern
How to query over Icollection<> of a type with linq
How to use PagedList In MVC
Domain driven design VS model driven architecture
What's the DDD-lite?
Using Generic type for type casting in F#