SlideShare a Scribd company logo
MongoTorino 2013

MongoDB,
Development and You

Mitch Pirtle!
CTO Sounday Music!
www.soundaymusic.com
45 MINUTES?! Let’s get this thing going then.
Speaker Intro
About Me
❖

American, living in Turin!

❖

CTO at Sounday Music!

❖

Mongo Master!

❖

Joomla! Founder!

❖

Contributor to many FOSS!

❖

Family man!

❖

Coach (Giaguari Torino)!

❖

Musician!

❖

Longboarder
Sleeper Check!
Sounday Intro
Sounday in 2013
❖

Growing community of music
professionals!

❖

Integrated with many social
media platforms!

❖

Very large binary files (audio)!

❖

100% UGC!

❖

e.commerce B2C, C2C!

❖

Based in Torino!

❖

Engineering based in Cagliari
The Team
Ok, not really.
The Challenge
The Challenge
❖

“We’re gunning for a grant”!
❖

❖

“It needs to be live soon” !
❖

❖

(zero time)!

“We’re disrupting the industry”!
❖

❖

(no money yet)!

(no requirements)!

“Wanna move to Cagliari?”
Ok, it’s not really that bad.
Well maybe.
Classic Startup Challenges

❖

Limited budget!

❖

Limited staff!

❖

Limited time!

❖

Zero chance for best practices during development
How I felt when accepting the challenge
How it actually looked
The Solution
The Solution
❖

Single, RESTful base platform (web, mobile, partners)!

❖

Document database!

❖

Store media in database for simplicity, portability!

❖

Ability to break out separate services when scale needed!

❖

Tethered cloud for initial deployment
Solution: The application

Lithium
•
•
•
•
•
•
•

Super lightweight PHP framework!
RAD!
MVC!
Promiscuously opinionated!
Post-relational!
Fully leverages PHP 5.3+!
Cherry-picker methodology (mix of
functional, object, aspect, and more)
Solution: The database

MongoDB
•
•
•
•
•

Document database!
GridFS for large binary files!
Scales vertically!
Scales horizontally!
Reduces male pattern baldness
Solution: The approach

Agile, Xtreme
•
•
•
•
•
•
•

Quick, iterative steps!
Constant refactoring!
Captured features during
implementation!
Pair programming!
Local, development and production
environments!
Development and production
environments mirrored!
Dedication to DRY
Sleeper Check!
The Good
Lithium saved our bacon
❖

Extremely quick to get bootstrapped and running a base
platform!

❖

Many libraries available for specific needs!

❖

Natively talks to non-relational databases!

❖

Intelligent code layout, encourages best practices!

❖

Adapters, filters, this stuff is the shizzle
MongoDB saved our bacon, with eggs
❖

Simple document structure made for extremely simple
models!

❖

Better matched with the objects used in our apps!

❖

GridFS made storing media dead simple!

❖

Being schemaless allowed us to iterate rapidly!

❖

After launch, we completely forgot about MongoDB
from an operational standpoint
The Bad
The Bad

❖

Hey remember how easy it is to change your document
schemas?!

❖

Loosely-typed language and database makes for fun!!

❖

Hope you love the command line. (limited tools)
And lest we not forget…
The Ugly
The Ugly
❖

What do you mean, ‘no need for constraints’?!

❖

Hey this GridFS database is freaking ginormous.!

❖

I’ve never seen that happen before.!

❖

What, there’s no more SQL? Then who’s to blame when
something breaks?
What We Learned
❖

Our code was significantly lighter!

❖

This slim codebase is extremely fast!

❖

Smaller codebase == fewer bugs!

❖

GridFS combined with metadata is really powerful!

❖

Atomic documents + working memory = TO INFINITY
AND BEYOND!
What Else We Learned
❖

Shift responsibilities from tools to developers!

❖

Testing and documentation are NOT OPTIONAL!

❖

Define models, even when iterating rapidly in a
schemaless environment!

❖

Consider backup and operational requirements before
you get started
Example Time
User schema, when we started
class Users extends Model {
!
//protected $_schema = array()
!
}
User schema, today
protected $_schema = array(
'_id' => array('type' => 'id'),
'name' => array('type' => 'string'),
'username' => array('type' => 'string'),
'email' => array('type' => 'string'),
'password' => array('type' => 'string'),
'salt' => array('type' => 'string'),
'facebook_id' => array('type' => 'string'),
'date_created' => array('type' => 'date'),
'registration_source' => array('type' => 'string'),
'active' => array('type' => 'boolean', 'default' => false), // to make sure the account is live
'status' => array('type' => 'string'),
'mvadmin' => array('type' => 'boolean', 'default' => false),
'pufadmin' => array('type' => 'boolean', 'default' => false),
'resetadmin' => array('type' => 'boolean', 'default' => false),
'profile' => array('type' => 'string'),
'avatar' => array('type' => 'string'),
'enabled' => array('type' => 'string'),
'address' => array('type' => 'array'),
'vat' => array('type' => 'string'),
'url' => array('type' => 'string'),
'services' => array('type' => 'array'),
'likes' => array('type' => 'array'), // Polymorphic associations
'moderated' => array('type' => 'boolean'),
'follows' => array('type' => 'array'),
'last_login' => array('type' => 'date'),
'edit_time' => array('type' => 'date'),
'last_ip' => array('type' => 'string'),
'login_counter' => array('type' => 'integer'),
'is_legacy' => array('type' => 'boolean'),
'legacy_id' => array('type' => 'integer'),
'partners' => array('type' => 'array'),
);
Database structure
activities_log!
admin_bmu_calendars!
admin_landing_pages!
admin_notifications!
artists!
banlists!
blacklists!
blogs!
communications!
db_logs!
engineers!
events!
fs.chunks!
fs.files!
galleries!
job_applications!
job_songs!
jobs!

labels!
media!
messages!
news!
payments!
playlists!
sequence!
services!
sounday_contest_songs!
sounday_contest_users!
sounday_contest_videos!
studios!
system.indexes!
temp_lookups!
tokens!
users!
venues!
videos
One last thing
Behold, the mighty firehose
Whups, not that one
rs0:PRIMARY> db.firehose.stats()
{
"ns" : "sounday_analytics_prod.firehose",
"count" : 3146600,
"size" : 10086355648,
"avgObjSize" : 3205.4775465581897,
"storageSize" : 10830245856,
"numExtents" : 26,
"nindexes" : 1,
"lastExtentSize" : 2146426864,
"paddingFactor" : 1,
"systemFlags" : 1,
"userFlags" : 0,
"totalIndexSize" : 113204896,
"indexSizes" : {
"_id_" : 113204896
},
"ok" : 1
}
Yeah, I said firehose. Got a problem wit dat?

Console time
If you wanted to see this part of the talk,
you should have attended the session.!
!
!
!
!
!
:-)
Sleeper Check!
Stump the Speaker
Thank You!
Mitch Pirtle
mitch.pirtle@gmail.com
http://about.me/mitchitized
http://twitter.com/mitchitized
http://github.com/spacemonkey

More Related Content

Similar to MongoDB, Development and You

Similar to MongoDB, Development and You (20)

Inheriting iOS code
Inheriting iOS codeInheriting iOS code
Inheriting iOS code
 
Bil conference jan 2009
Bil conference jan 2009Bil conference jan 2009
Bil conference jan 2009
 
Brutal refactoring, lying code, the Churn, and other emotional stories from L...
Brutal refactoring, lying code, the Churn, and other emotional stories from L...Brutal refactoring, lying code, the Churn, and other emotional stories from L...
Brutal refactoring, lying code, the Churn, and other emotional stories from L...
 
Why don'we just say "No" - Devopsdays Silicon Valley Jun 2014
Why don'we just say "No" -  Devopsdays Silicon Valley Jun 2014Why don'we just say "No" -  Devopsdays Silicon Valley Jun 2014
Why don'we just say "No" - Devopsdays Silicon Valley Jun 2014
 
Bica Studios Game Design Document and the Importance of Testing
Bica Studios Game Design Document and the Importance of TestingBica Studios Game Design Document and the Importance of Testing
Bica Studios Game Design Document and the Importance of Testing
 
Quality code 2019
Quality code 2019Quality code 2019
Quality code 2019
 
Invisioning UX and UI
Invisioning UX and UIInvisioning UX and UI
Invisioning UX and UI
 
Doodling for-great-success
Doodling for-great-successDoodling for-great-success
Doodling for-great-success
 
Modelagem de Dados Semiestruturados com ISIS-DM
Modelagem de Dados Semiestruturados com ISIS-DMModelagem de Dados Semiestruturados com ISIS-DM
Modelagem de Dados Semiestruturados com ISIS-DM
 
SearchLove Boston 2015 | Ian Lurie, 'Why the Hell Not? SEO Leadership Through...
SearchLove Boston 2015 | Ian Lurie, 'Why the Hell Not? SEO Leadership Through...SearchLove Boston 2015 | Ian Lurie, 'Why the Hell Not? SEO Leadership Through...
SearchLove Boston 2015 | Ian Lurie, 'Why the Hell Not? SEO Leadership Through...
 
How To Reach and Engage the Passive Talent Audience
How To Reach and Engage the Passive Talent AudienceHow To Reach and Engage the Passive Talent Audience
How To Reach and Engage the Passive Talent Audience
 
SEO leadership: Get from 'Why' to 'Why Not'
SEO leadership: Get from 'Why' to 'Why Not'SEO leadership: Get from 'Why' to 'Why Not'
SEO leadership: Get from 'Why' to 'Why Not'
 
Eastside incubator - Startup in Seattle
Eastside incubator - Startup in SeattleEastside incubator - Startup in Seattle
Eastside incubator - Startup in Seattle
 
Chasing Elephants - Alberto Brandolini - Codemotion Rome 2017
Chasing Elephants - Alberto Brandolini - Codemotion Rome 2017Chasing Elephants - Alberto Brandolini - Codemotion Rome 2017
Chasing Elephants - Alberto Brandolini - Codemotion Rome 2017
 
Chasing elephants
Chasing elephantsChasing elephants
Chasing elephants
 
Websummit
WebsummitWebsummit
Websummit
 
The Original Hypertext Preprocessor
The Original Hypertext PreprocessorThe Original Hypertext Preprocessor
The Original Hypertext Preprocessor
 
Teaching & Learning Forum presentation
Teaching & Learning Forum presentationTeaching & Learning Forum presentation
Teaching & Learning Forum presentation
 
Collaboration between LINE, Microsoft and AI by the developers, for the devel...
Collaboration between LINE, Microsoft and AI by the developers, for the devel...Collaboration between LINE, Microsoft and AI by the developers, for the devel...
Collaboration between LINE, Microsoft and AI by the developers, for the devel...
 
Django girls ahmedabad First Things First!
Django girls ahmedabad First Things First!Django girls ahmedabad First Things First!
Django girls ahmedabad First Things First!
 

More from Mitch Pirtle

More from Mitch Pirtle (20)

Cloudy with a chance of scale
Cloudy with a chance of scaleCloudy with a chance of scale
Cloudy with a chance of scale
 
My life with MongoDB
My life with MongoDBMy life with MongoDB
My life with MongoDB
 
PHP Cloud Deployment Toolkits
PHP Cloud Deployment ToolkitsPHP Cloud Deployment Toolkits
PHP Cloud Deployment Toolkits
 
MongoTorino 2013 Opening Keynote
MongoTorino 2013 Opening KeynoteMongoTorino 2013 Opening Keynote
MongoTorino 2013 Opening Keynote
 
Data as Documents: Overview and intro to MongoDB
Data as Documents: Overview and intro to MongoDBData as Documents: Overview and intro to MongoDB
Data as Documents: Overview and intro to MongoDB
 
Unified Content Model and Joomla!
Unified Content Model and Joomla!Unified Content Model and Joomla!
Unified Content Model and Joomla!
 
Gridfs and MongoDB
Gridfs and MongoDBGridfs and MongoDB
Gridfs and MongoDB
 
Joomla - an Overview
Joomla - an OverviewJoomla - an Overview
Joomla - an Overview
 
Operational MongoDB
Operational MongoDBOperational MongoDB
Operational MongoDB
 
Joomla Extreme Performance
Joomla Extreme PerformanceJoomla Extreme Performance
Joomla Extreme Performance
 
Joomla and MongoDB
Joomla and MongoDBJoomla and MongoDB
Joomla and MongoDB
 
Mongodb and Totsy: An e-commerce case study
Mongodb and Totsy: An e-commerce case studyMongodb and Totsy: An e-commerce case study
Mongodb and Totsy: An e-commerce case study
 
Mongodb and Totsy - E-commerce Case Study
Mongodb and Totsy - E-commerce Case StudyMongodb and Totsy - E-commerce Case Study
Mongodb and Totsy - E-commerce Case Study
 
PHP, Lithium and MongoDB
PHP, Lithium and MongoDBPHP, Lithium and MongoDB
PHP, Lithium and MongoDB
 
Content Management Systems and MongoDB
Content Management Systems and MongoDBContent Management Systems and MongoDB
Content Management Systems and MongoDB
 
MongoDB: Built for Speed
MongoDB: Built for SpeedMongoDB: Built for Speed
MongoDB: Built for Speed
 
Content Mangement Systems and MongoDB
Content Mangement Systems and MongoDBContent Mangement Systems and MongoDB
Content Mangement Systems and MongoDB
 
Joomla For Entrepreneurs
Joomla For EntrepreneursJoomla For Entrepreneurs
Joomla For Entrepreneurs
 
Thin Server Architecture
Thin Server ArchitectureThin Server Architecture
Thin Server Architecture
 
Developing Joomla! 1.5 Extensions, Explained
Developing Joomla! 1.5 Extensions, ExplainedDeveloping Joomla! 1.5 Extensions, Explained
Developing Joomla! 1.5 Extensions, Explained
 

Recently uploaded

Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 

Recently uploaded (20)

Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
 
Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG Evaluation
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 

MongoDB, Development and You