Surveying Database Internals
MONGODB INTERNALS
MongoDB Wire Protocol
MongoDB wire protocol operations:
A standard message header has the following �properties:�
Inserting a Document
Querying a Collection�
MongoDB Database Files
MEMBASE ARCHITECTURE
Membase consists of the following components:
HYPERTABLE UNDER THE HOOD
Bloom Filter
APACHE CASSANDRA
Based on Gossip and Anti-entropy
Fast Writes
Hinted Handof
BERKELEY DB
Storage Configuration
Using MYSQL as NOSQL
with increased data, several expensive actions:
Using Memcached with MySQL is beneficial but the architecture has its drawbacks:
Handler Socket
MOSTLY IMMUTABLE DATA STORES
Polyglot Persistence at Facebook
Data Warehousing and Business Intelligence
WEB FRAMEWORKS AND NOSQL
gem install rails
gem install mongo_mapper
Using Django with NoSQL
Using Spring Data
MIGRATING FROM RDBMS TO NOSQL
Using Django with NoSQL
# models.py:
class MyModel(models.Model): //Model instance reference
name = models.CharField(max_length=64)
lowercase_name = models.CharField(max_length=64, editable=False)
last_modified = models.DateTimeField(auto_now=True)
// set the time when someone modified his feedback
month_last_modified = models.IntegerField(editable=False)
def save(self, *args, **kwargs):
// *args is used to pass an arbitrary number of arguments to a function
//kwargs is keyword arguments
// self ---- reference object
self.lowercase_name = self.name.lower()
self.month_last_modified = self.last_modified.month
super(MyModel, self).save(*args, **kwargs)
def run_query(name, month):
MyModel.objects.filter(lowercase_name=name.lower(),
month_last_modified=month) //filter---used for querying
Spring code
<?xml version=”1.0” encoding=”UTF-8”?> // encoding is converting to binary
xmlns=”http://maven.apache.org/POM/4.0.0” //The namespace can be defined by an xmlns attribute
……………………….
<!-- Spring -->
<dependency>
<groupId> springframework </groupId>
<artifactId> spring-context </artifactId> // artifactId attribute in Apache Maven …name
<version>${org.springframework-version}</version>
//Java platform that provides comprehensive infrastructure support for developing Java applications
.
<exclusions> //exclude dependancy
<span class=”hiddenSpellError” “> SLF4j </span> -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency> //Spring container “injects” objects into other objects ..
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>