Upload
ortus-solutions-corp
View
184
Download
3
Embed Size (px)
Citation preview
WHEN TO USE NOSQL(and when NOT to)
“When the only tool you have is a hammer, everything looks like a nail.” - Maslow’s Law of the Instrument
NoSQL Strengths• Consistent data data representation throughout logic• Fast and flexible for rapid development• Simplicity of serialization and storage makes clustering easy• Object-based query syntax• Native Javascript support (Mongo)
SQL RDBMS Strengths• Relationship management• Schema enforcement• Wide usage and understanding of SQL• Highly configurable roles and permissions, evolved for
enterprise use• Built-in functions, stored procedures, views, etc.
NoSQL Use Cases• Networking applications• CMS/Document/Entity-driven applications• Feedback-driven applications• Data collection & analytics• 3rd party aggregation applications
RDBMS Use Cases• Accounting/Finance/Mathematical Applications• Applications with relationships which enforce other
relationships (e.g. - e-commerce, travel, quality control)
NoSQL NormalizationThe process of mapping data segments from relevant
relationships in to other objects
SHARDINGDistribution of collection segments (and GridFS binary objects)
across a number of servershosts= [
{ serverName='ds012345.mongolab.com', serverPort='12345', username="myUsername", password="my53cUr3P455", authenticationDB="myremotedb" }, //note that we only needed the credentials and the authenticationDB value for the first host entry. //All other hosts must use the same values. { serverName='ds023456.mongolab.com', serverPort='23456', }, { serverName='ds034567.mongolab.com', serverPort='34567', }
]
GRIDFSvar User = getModel("User").load("54e523599b67bde3c7b2f03d");
var ProfilePhoto = getModel("ProfileImages")//Set and normalize our person modelProfilePhoto.set('person.id',Person.get_id())//Load our photo in to GridFSProfilePhoto.loadFile(filePath=expandPath('/includes/tmp/MyProfilePhoto.jpg'),deleteFile=true);ProfilePhoto.create();
var Image = getModel("ProfileImage").load(rc.id);//calling writeImageToBrowser() will flush the image to the browser with headersImage.writeImageToBrowser(argumentCollection=imageArgs);
CBMongoDB• Originally used the CFMongoDB library (uses 2.0 series
driver)• Upgraded in 2015 to use the native Java Driver (current
version 3.2.1)• Designed to provide schema management throughout the
application lifecycle• Automatic normalization• Familiar query syntax