SlideShare une entreprise Scribd logo
1  sur  33
Télécharger pour lire hors ligne
MongoDB Integration Example
Solving Performance And High
        Load Problems
Gold Sponsor of
DrupalCamp Kyiv 2011
Silver Sponsors of
DrupalCamp Kyiv 2011
Freerice v2

    Easy questions and categories management

    Users registration

    Facebook/Twitter integration

    Friendship system

    Groups

    Detailed game statistics per user/group/total,
    rating system, user statuses
Round 1

    Questions = Nodes. Data imported.

    Categories = Nodes + Taxonomy

    User profiles = Content profile module

    Groups = Organic groups module

    Friendship system = Flag module

    Game logic, statistics = custom

    Blog, comments… = Core modules
Beta test – OK

Live test - Fail
MySQL is slow

    Views

    node_load()

    user_load()

    Organic group          = SLOW
                           QUERIES

    Game data
    processing

    …
What can help?

    Pressflow

    Memcache

    Varnish + AJAX Block

    Game as separate script

    MySQL replication

    Code optimization
AJAX Blocks


    AJAX blocks request -> index.php

    New module for managing AJAX blocks

    Set of blocks on page with needed bootstrap
    level
Game as separate script
MySQL is slow
What is MongoDB?


    Fast INSERTs

    Fast SELECTs

    Pretty fast UPDATEs

    No JOINs
PHP and MongoDB

    PECL extension for MongoDB

    Very easy to use

    Redundancy of documentation and examples
    on both MongoDB and PHP.net sites
Code examples
Code example
What is 1 right answer?


    10 rice

    1 update into user tables

    1 update into group tables

    1 update into totals tables

    1 update in user status tables

    …
1.5-4.5 millions right answers per day
statistics.grains collection


    Every right answer    "uid": 1,
                          "cid": 17555,
    = 1 insert            "gid": 0,

    Statistics            "amt": 10,
                          "dat": 1305496800,
    recalculation every   "lvl": 1
    night
Nodes collections

    node.question, node.caterogy collection

    hook_nodeapi() for insert, update, delete

    Full Question and Category nodes into
    MongoDB

    Questions and Categories SELECTs millions
    time often than INSERTs/UPDATEs

    Nothing changed for site administration
statistics.user_totals collection
Other collections

    statistic.group_totals

    statistic.totals

    statistic.useractivity
Views

    Bunch of views used on site

    Views produce a lot of SELECTs into MySQL

    It is not possible to cache them

    It is not possible to replace them
sview module
Sview disadvantages

    Hard to support

    No page/block view “from a box”, custom code
    needed
Multilingual support

    MySQL data is translated as usual

    Nothing to translate from users, groups
    collections

    Questions and Categories nodes are fully
    saved in MongoDB -> easy to translate
MongoDB replication
Why ReplicaSet

    Data redundancy

    Automated failover

    Distribute read load

    Simplify maintenance

    Recommended for sharding
How to use ReplicaSet
Freerice today

    560k registered users

    17k groups

    25m page views per day

    9.3b rice gained = 1m meals

    3 DB servers and 2 Front end servers
If you have any questions

    http://www.mongodb.org/

    http:/php.net/manual/en/book.mongo.php

    mail: evgeniyk@adyax.com

    skype: smart_here

Contenu connexe

Tendances

Introduction4 SQLite
Introduction4 SQLiteIntroduction4 SQLite
Introduction4 SQLite
Stanley Huang
 

Tendances (13)

Geek Sync | SQL Security Principals and Permissions 101
Geek Sync | SQL Security Principals and Permissions 101Geek Sync | SQL Security Principals and Permissions 101
Geek Sync | SQL Security Principals and Permissions 101
 
Mule with stored procedure
Mule with stored procedureMule with stored procedure
Mule with stored procedure
 
SQLite 3
SQLite 3SQLite 3
SQLite 3
 
SQLite: Light, Open Source Relational Database Management System
SQLite: Light, Open Source Relational Database Management SystemSQLite: Light, Open Source Relational Database Management System
SQLite: Light, Open Source Relational Database Management System
 
Document db
Document dbDocument db
Document db
 
Azure document DB
Azure document DBAzure document DB
Azure document DB
 
No SQL and MongoDB - Hyderabad Scalability Meetup
No SQL and MongoDB - Hyderabad Scalability MeetupNo SQL and MongoDB - Hyderabad Scalability Meetup
No SQL and MongoDB - Hyderabad Scalability Meetup
 
Introduction4 SQLite
Introduction4 SQLiteIntroduction4 SQLite
Introduction4 SQLite
 
Sq lite presentation
Sq lite presentationSq lite presentation
Sq lite presentation
 
"But It Worked In Development!" - 3 Hard SQL Server Problems
"But It Worked In Development!" - 3 Hard SQL Server Problems"But It Worked In Development!" - 3 Hard SQL Server Problems
"But It Worked In Development!" - 3 Hard SQL Server Problems
 
Azure sql database limitations
Azure sql database limitationsAzure sql database limitations
Azure sql database limitations
 
Enterprise java unit-2_chapter-2
Enterprise  java unit-2_chapter-2Enterprise  java unit-2_chapter-2
Enterprise java unit-2_chapter-2
 
Sql vs. NoSql
Sql vs. NoSqlSql vs. NoSql
Sql vs. NoSql
 

En vedette

MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB
 
Schema Design
Schema DesignSchema Design
Schema Design
MongoDB
 
Cassandra and Solid State Drives
Cassandra and Solid State DrivesCassandra and Solid State Drives
Cassandra and Solid State Drives
Rick Branson
 
MongoDB Performance Tuning and Monitoring
MongoDB Performance Tuning and MonitoringMongoDB Performance Tuning and Monitoring
MongoDB Performance Tuning and Monitoring
MongoDB
 
MongoDB Performance Tuning
MongoDB Performance TuningMongoDB Performance Tuning
MongoDB Performance Tuning
MongoDB
 

En vedette (20)

MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
 
Cassandra and Solid State Drives
Cassandra and Solid State DrivesCassandra and Solid State Drives
Cassandra and Solid State Drives
 
MongoDB Linux Porting, Performance Measurements and and Scaling Advantage usi...
MongoDB Linux Porting, Performance Measurements and and Scaling Advantage usi...MongoDB Linux Porting, Performance Measurements and and Scaling Advantage usi...
MongoDB Linux Porting, Performance Measurements and and Scaling Advantage usi...
 
Mongo Performance Optimization Using Indexing
Mongo Performance Optimization Using IndexingMongo Performance Optimization Using Indexing
Mongo Performance Optimization Using Indexing
 
Overcoming Scaling Challenges in MongoDB Deployments with SSD
Overcoming Scaling Challenges in MongoDB Deployments with SSDOvercoming Scaling Challenges in MongoDB Deployments with SSD
Overcoming Scaling Challenges in MongoDB Deployments with SSD
 
Schema Design
Schema DesignSchema Design
Schema Design
 
Schema Design by Example ~ MongoSF 2012
Schema Design by Example ~ MongoSF 2012Schema Design by Example ~ MongoSF 2012
Schema Design by Example ~ MongoSF 2012
 
Webinar: MongoDB for Content Management
Webinar: MongoDB for Content ManagementWebinar: MongoDB for Content Management
Webinar: MongoDB for Content Management
 
Constructing Web APIs with Rack, Sinatra and MongoDB
Constructing Web APIs with Rack, Sinatra and MongoDBConstructing Web APIs with Rack, Sinatra and MongoDB
Constructing Web APIs with Rack, Sinatra and MongoDB
 
MongoDB Days UK: Jumpstart: Schema Design
MongoDB Days UK: Jumpstart: Schema DesignMongoDB Days UK: Jumpstart: Schema Design
MongoDB Days UK: Jumpstart: Schema Design
 
Webinar: MongoDB 2.6 New Security Features
Webinar: MongoDB 2.6 New Security FeaturesWebinar: MongoDB 2.6 New Security Features
Webinar: MongoDB 2.6 New Security Features
 
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeBuilding Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at Stripe
 
Why does my choice of storage matter with cassandra?
Why does my choice of storage matter with cassandra?Why does my choice of storage matter with cassandra?
Why does my choice of storage matter with cassandra?
 
Cassandra and Solid State Drives
Cassandra and Solid State DrivesCassandra and Solid State Drives
Cassandra and Solid State Drives
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
 
MongoDB Performance Tuning and Monitoring
MongoDB Performance Tuning and MonitoringMongoDB Performance Tuning and Monitoring
MongoDB Performance Tuning and Monitoring
 
Tuning Linux for MongoDB
Tuning Linux for MongoDBTuning Linux for MongoDB
Tuning Linux for MongoDB
 
Getting Started with MongoDB and Node.js
Getting Started with MongoDB and Node.jsGetting Started with MongoDB and Node.js
Getting Started with MongoDB and Node.js
 
MongoDB and Ecommerce : A perfect combination
MongoDB and Ecommerce : A perfect combinationMongoDB and Ecommerce : A perfect combination
MongoDB and Ecommerce : A perfect combination
 
MongoDB Performance Tuning
MongoDB Performance TuningMongoDB Performance Tuning
MongoDB Performance Tuning
 

Similaire à Evgeniy Karelin. Mongo DB integration example solving performance and high load problems. DrupalCamp Kyiv 2011

Membase Meetup 2010
Membase Meetup 2010Membase Meetup 2010
Membase Meetup 2010
Membase
 
http://www.hfadeel.com/Blog/?p=151
http://www.hfadeel.com/Blog/?p=151http://www.hfadeel.com/Blog/?p=151
http://www.hfadeel.com/Blog/?p=151
xlight
 
Node.js Enterprise Middleware
Node.js Enterprise MiddlewareNode.js Enterprise Middleware
Node.js Enterprise Middleware
Behrad Zari
 
Beyond relational database - Building high performance websites using Redis a...
Beyond relational database - Building high performance websites using Redis a...Beyond relational database - Building high performance websites using Redis a...
Beyond relational database - Building high performance websites using Redis a...
Dinh Pham
 
Gavin M
Gavin MGavin M
Gavin M
Ontico
 
Building Scalable .NET Web Applications
Building Scalable .NET Web ApplicationsBuilding Scalable .NET Web Applications
Building Scalable .NET Web Applications
Buu Nguyen
 
Top 100 PHP Interview Questions and Answers
Top 100 PHP Interview Questions and AnswersTop 100 PHP Interview Questions and Answers
Top 100 PHP Interview Questions and Answers
Vineet Kumar Saini
 

Similaire à Evgeniy Karelin. Mongo DB integration example solving performance and high load problems. DrupalCamp Kyiv 2011 (20)

Membase Meetup 2010
Membase Meetup 2010Membase Meetup 2010
Membase Meetup 2010
 
Case Study with Answers.com on Scaling with Memcached and MySQL
Case Study with Answers.com on Scaling with Memcached and MySQLCase Study with Answers.com on Scaling with Memcached and MySQL
Case Study with Answers.com on Scaling with Memcached and MySQL
 
http://www.hfadeel.com/Blog/?p=151
http://www.hfadeel.com/Blog/?p=151http://www.hfadeel.com/Blog/?p=151
http://www.hfadeel.com/Blog/?p=151
 
ASP.NET MVC Performance
ASP.NET MVC PerformanceASP.NET MVC Performance
ASP.NET MVC Performance
 
Lessons from Highly Scalable Architectures at Social Networking Sites
Lessons from Highly Scalable Architectures at Social Networking SitesLessons from Highly Scalable Architectures at Social Networking Sites
Lessons from Highly Scalable Architectures at Social Networking Sites
 
Node.js Enterprise Middleware
Node.js Enterprise MiddlewareNode.js Enterprise Middleware
Node.js Enterprise Middleware
 
Data virtualization, Data Federation & IaaS with Jboss Teiid
Data virtualization, Data Federation & IaaS with Jboss TeiidData virtualization, Data Federation & IaaS with Jboss Teiid
Data virtualization, Data Federation & IaaS with Jboss Teiid
 
GlobalsDB: Its significance for Node.js Developers
GlobalsDB: Its significance for Node.js DevelopersGlobalsDB: Its significance for Node.js Developers
GlobalsDB: Its significance for Node.js Developers
 
Dot Net Nuke Presentation
Dot Net Nuke PresentationDot Net Nuke Presentation
Dot Net Nuke Presentation
 
My sql crashcourse_intro_kdl
My sql crashcourse_intro_kdlMy sql crashcourse_intro_kdl
My sql crashcourse_intro_kdl
 
Beyond relational database - Building high performance websites using Redis a...
Beyond relational database - Building high performance websites using Redis a...Beyond relational database - Building high performance websites using Redis a...
Beyond relational database - Building high performance websites using Redis a...
 
Gavin M
Gavin MGavin M
Gavin M
 
Klmug presentation - Simple Analytics with MongoDB
Klmug presentation - Simple Analytics with MongoDBKlmug presentation - Simple Analytics with MongoDB
Klmug presentation - Simple Analytics with MongoDB
 
NodeJS ecosystem
NodeJS ecosystemNodeJS ecosystem
NodeJS ecosystem
 
Building Scalable .NET Web Applications
Building Scalable .NET Web ApplicationsBuilding Scalable .NET Web Applications
Building Scalable .NET Web Applications
 
Top 100 PHP Interview Questions and Answers
Top 100 PHP Interview Questions and AnswersTop 100 PHP Interview Questions and Answers
Top 100 PHP Interview Questions and Answers
 
Scaling 101 test
Scaling 101 testScaling 101 test
Scaling 101 test
 
Scaling 101
Scaling 101Scaling 101
Scaling 101
 
MySQL And Search At Craigslist
MySQL And Search At CraigslistMySQL And Search At Craigslist
MySQL And Search At Craigslist
 
Voldemort & Hadoop @ Linkedin, Hadoop User Group Jan 2010
Voldemort & Hadoop @ Linkedin, Hadoop User Group Jan 2010Voldemort & Hadoop @ Linkedin, Hadoop User Group Jan 2010
Voldemort & Hadoop @ Linkedin, Hadoop User Group Jan 2010
 

Plus de Vlad Savitsky

Dmitry Drozdik. how to make friendship between drupal and content manager. dr...
Dmitry Drozdik. how to make friendship between drupal and content manager. dr...Dmitry Drozdik. how to make friendship between drupal and content manager. dr...
Dmitry Drozdik. how to make friendship between drupal and content manager. dr...
Vlad Savitsky
 
Dennis popov. scrum for drupal. drupal camp kyiv 2011
Dennis popov. scrum for drupal. drupal camp kyiv 2011Dennis popov. scrum for drupal. drupal camp kyiv 2011
Dennis popov. scrum for drupal. drupal camp kyiv 2011
Vlad Savitsky
 
Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...
Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...
Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...
Vlad Savitsky
 

Plus de Vlad Savitsky (18)

Looking for Vulnerable Code. Vlad Savitsky
Looking for Vulnerable Code. Vlad SavitskyLooking for Vulnerable Code. Vlad Savitsky
Looking for Vulnerable Code. Vlad Savitsky
 
Art of Estimation. Vlad Savitsky
Art of Estimation. Vlad SavitskyArt of Estimation. Vlad Savitsky
Art of Estimation. Vlad Savitsky
 
Varnish and Drupal.
Varnish and Drupal.Varnish and Drupal.
Varnish and Drupal.
 
Chapter18
Chapter18Chapter18
Chapter18
 
Css Intro. Vlad Savitsky
Css Intro. Vlad SavitskyCss Intro. Vlad Savitsky
Css Intro. Vlad Savitsky
 
HTML. Быстрое погружение. Влад Савицкий
HTML. Быстрое погружение. Влад СавицкийHTML. Быстрое погружение. Влад Савицкий
HTML. Быстрое погружение. Влад Савицкий
 
How to be a believer online. Vlad Savitsky. Novomedia forum 2011
How to be a believer online. Vlad Savitsky. Novomedia forum 2011How to be a believer online. Vlad Savitsky. Novomedia forum 2011
How to be a believer online. Vlad Savitsky. Novomedia forum 2011
 
Vlad savitsky. Church Site in 15 minutes
Vlad savitsky. Church Site in 15 minutesVlad savitsky. Church Site in 15 minutes
Vlad savitsky. Church Site in 15 minutes
 
Dmitry Drozdik. how to make friendship between drupal and content manager. dr...
Dmitry Drozdik. how to make friendship between drupal and content manager. dr...Dmitry Drozdik. how to make friendship between drupal and content manager. dr...
Dmitry Drozdik. how to make friendship between drupal and content manager. dr...
 
Alexey Kostin. Increase site ctr in serp using google rich snippets. DrupalCa...
Alexey Kostin. Increase site ctr in serp using google rich snippets. DrupalCa...Alexey Kostin. Increase site ctr in serp using google rich snippets. DrupalCa...
Alexey Kostin. Increase site ctr in serp using google rich snippets. DrupalCa...
 
Oleg Natalushko. Drupal server anatomy. DrupalCamp Kyiv 2011
Oleg Natalushko. Drupal server anatomy. DrupalCamp Kyiv 2011Oleg Natalushko. Drupal server anatomy. DrupalCamp Kyiv 2011
Oleg Natalushko. Drupal server anatomy. DrupalCamp Kyiv 2011
 
Dennis popov. scrum for drupal. drupal camp kyiv 2011
Dennis popov. scrum for drupal. drupal camp kyiv 2011Dennis popov. scrum for drupal. drupal camp kyiv 2011
Dennis popov. scrum for drupal. drupal camp kyiv 2011
 
Andriy Kushnarov. BOND: a giant drupal in a huge company. DrupalCamp Kyiv 2011
Andriy Kushnarov. BOND: a giant drupal in a huge company. DrupalCamp Kyiv 2011Andriy Kushnarov. BOND: a giant drupal in a huge company. DrupalCamp Kyiv 2011
Andriy Kushnarov. BOND: a giant drupal in a huge company. DrupalCamp Kyiv 2011
 
Pavlenko Sergey. Drush: using and creating custom commands. DrupalCamp Kyiv 2011
Pavlenko Sergey. Drush: using and creating custom commands. DrupalCamp Kyiv 2011Pavlenko Sergey. Drush: using and creating custom commands. DrupalCamp Kyiv 2011
Pavlenko Sergey. Drush: using and creating custom commands. DrupalCamp Kyiv 2011
 
Danilenko Alexander. Drupal 7 theming on Omega. DrupalCamp Kyiv 2011
Danilenko Alexander. Drupal 7 theming on Omega. DrupalCamp Kyiv 2011Danilenko Alexander. Drupal 7 theming on Omega. DrupalCamp Kyiv 2011
Danilenko Alexander. Drupal 7 theming on Omega. DrupalCamp Kyiv 2011
 
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011
 
Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...
Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...
Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...
 
Оптимизация JavaScript в Drupal
Оптимизация JavaScript в DrupalОптимизация JavaScript в Drupal
Оптимизация JavaScript в Drupal
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Dernier (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

Evgeniy Karelin. Mongo DB integration example solving performance and high load problems. DrupalCamp Kyiv 2011

  • 1. MongoDB Integration Example Solving Performance And High Load Problems
  • 4.
  • 5. Freerice v2  Easy questions and categories management  Users registration  Facebook/Twitter integration  Friendship system  Groups  Detailed game statistics per user/group/total, rating system, user statuses
  • 6. Round 1  Questions = Nodes. Data imported.  Categories = Nodes + Taxonomy  User profiles = Content profile module  Groups = Organic groups module  Friendship system = Flag module  Game logic, statistics = custom  Blog, comments… = Core modules
  • 7. Beta test – OK Live test - Fail
  • 8. MySQL is slow  Views  node_load()  user_load()  Organic group = SLOW QUERIES  Game data processing  …
  • 9. What can help?  Pressflow  Memcache  Varnish + AJAX Block  Game as separate script  MySQL replication  Code optimization
  • 10.
  • 11. AJAX Blocks  AJAX blocks request -> index.php  New module for managing AJAX blocks  Set of blocks on page with needed bootstrap level
  • 14. What is MongoDB?  Fast INSERTs  Fast SELECTs  Pretty fast UPDATEs  No JOINs
  • 15. PHP and MongoDB  PECL extension for MongoDB  Very easy to use  Redundancy of documentation and examples on both MongoDB and PHP.net sites
  • 18. What is 1 right answer?  10 rice  1 update into user tables  1 update into group tables  1 update into totals tables  1 update in user status tables  …
  • 19. 1.5-4.5 millions right answers per day
  • 20. statistics.grains collection  Every right answer "uid": 1, "cid": 17555, = 1 insert "gid": 0,  Statistics "amt": 10, "dat": 1305496800, recalculation every "lvl": 1 night
  • 21. Nodes collections  node.question, node.caterogy collection  hook_nodeapi() for insert, update, delete  Full Question and Category nodes into MongoDB  Questions and Categories SELECTs millions time often than INSERTs/UPDATEs  Nothing changed for site administration
  • 23. Other collections  statistic.group_totals  statistic.totals  statistic.useractivity
  • 24. Views  Bunch of views used on site  Views produce a lot of SELECTs into MySQL  It is not possible to cache them  It is not possible to replace them
  • 26.
  • 27. Sview disadvantages  Hard to support  No page/block view “from a box”, custom code needed
  • 28. Multilingual support  MySQL data is translated as usual  Nothing to translate from users, groups collections  Questions and Categories nodes are fully saved in MongoDB -> easy to translate
  • 30. Why ReplicaSet  Data redundancy  Automated failover  Distribute read load  Simplify maintenance  Recommended for sharding
  • 31. How to use ReplicaSet
  • 32. Freerice today  560k registered users  17k groups  25m page views per day  9.3b rice gained = 1m meals  3 DB servers and 2 Front end servers
  • 33. If you have any questions  http://www.mongodb.org/  http:/php.net/manual/en/book.mongo.php  mail: evgeniyk@adyax.com  skype: smart_here