SlideShare a Scribd company logo
–                                 – 	

MongoDB                      
      	

  5   MongoDB          	

           (@nsega)	

      GCREST, Inc.
•                  (Age:28) (twitter: @nsega)	

•           	

     •                            	

     •                                        	

     •                                                      
                        (   SNS                      )	


•                                       	

     •    JavaEE
Agenda	

•                                        	

•  MongoDB                   	

•              	

•                                  	

•                          	

•                    	

• 
?
?	


                        -@games-	

      http://www.atgames.jp/	


                  290
MongoDB
MongoDB                                                 	

    SNS                                                       	

              
                                                  
(         )
•                  
     	

•          MySQL         	

• 
•          	

• 
MongoDB               	

•         
                	

•                           	



NoSQL
MongoDB                          	

l  NoSQL              MongoDB         

l  MongoDB JP
MongoDB
(   SNS          )	

•  Linux/CentOS v5.4 	

•  Apache v2.2.14	

•  MySQL v5.5(InnoDB)	

•  PostgreSQL v9.0.1	

•  MongoDB v1.8.2-rc3 NEW!!	

•  PHP v5.2 / symfony v1.2.9
  (MongoDriver/mongo.so) NEW!!
15 (Web/PC )
 3 (Web/Mobile )
 mongos                                    	


5 (MySQL)	

 1   :Master / 3 :Slave/ 1 :
3 (MongoDB) NEW!!	

•  CPU:Intel(R) Xeon(R) 2.13GHz 8core	

•  Memory:16GB 	

•  HDD: 550GB
   (xfs 400GB/mongo        )
Web Server	

                                       x 18 (PC/MB)
                          mongos	


Server1                Server2                   Server3
    CONFIG	

            CONFIG	

          CONFIG	


                          Sharding
   PRIMARY	

             PRIMARY	

        PRIMARY	

          ReplicaSet     ReplicaSet       ReplicaSet
 SECONDARY	

           SECONDARY	

      SECONDARY
MongoDB DataAccess
MongoDB                                       	

                                                     	

  (   ) (         ) (         )
l Shard Key         
    (      ID(    )) mod 100
    md       Shard Key            
	

l 100         (0~99) 3         Shard
l Chunk            (split             )
 /usr/local/mongodb/bin/mongo localhost/admin;	


db.runCommand({split:sns.footprints,middle:{md:0}});	

db.runCommand({split:sns.footprints,middle:{md:1}});
     :	

db.runCommand({split:sns.footprints,middle:{md:98}});	

db.runCommand({split:sns.footprints,middle:{md:99}});
l Chunk           (moveChunk                     )
db.runCommand({moveChunk:sns.footprints,
                  find:{md:0},to:”mongo01});	

db.runCommand({moveChunk:sns.footprints,
                  find:{md:1},to:”mongo02});
   :	

db.runCommand({moveChunk:sns.footprints,
                  find:{md:98},to:”mongo03});	

db.runCommand({moveChunk:sns.footprints,
                  find:{md:99},to:”mongo01});
MongoDB DataAccess
             	



•  Symfony(PHP) + MongoDB 	

• 
MongoDB DataAccess
                	


               Class MogoKeyValue    MongoDB         


Class                       Class 
DiaryEvalMongoKeyVale       FootprintsMongoKeyVale



     DAO
•          explain 
     	

• 
db.footprints.findOne();
{
_id : ObjectId(4e0967ac6978a9cf03000027),
md : 73,
                                                        	

fromId : 5439901,        md/           ID mod 100 	

toId” : 5484473,          fromId/ ID	

date : 1106281433,       toId/ ID	

                           date/       (YYMMDDHH24MISS)
”dataType : 0             dateType/
}
 db.footprints.count();                     (                )	

30282                                            30,000
explain                      	

db.footprints.find({fromId:5439901,”dateType:{$gt:0}})	

Ø  .sort({date:-1}).explain();	

{	

cursor : BasicCursor,	

         INDEX
nscanned : 30178,	

nscannedObjects : 30178,	

n : 54,	

scanAndOrder : true,	

millis : 31,	

nYields : 0,	

                                        	

nChunkSkips : 0,	

isMultiKey : false,	

indexOnly : false,	

indexBounds : {	

             }	

}
INDEX                                 	

 db.footprints.ensureIndex({fromId:1,dataType:1,date:-1});	

 db.footprints.getIndexes();
[	

           :	

                                          wkwk
     	

{	

     	

 	

_id : ObjectId(4e2c5aff4ab228594428620c),	

     	

 	

ns : sns.footprints,	

     	

 	

key : {	

     	

 	

 	

fromId : 1,	

     	

 	

 	

”dataType : 1,	

      INDEX
     	

 	

 	

date : -1	

     	

 	

},	

     	

 	

name : fromId_1_dataType_1_date_-1,	

     	

 	

v : 0	

     	

}	

]
explain
db.footprints.find({fr:5439901,ty:{$gt:0}}).sort({dt:-1}).explain();
{
cursor : BtreeCursor fromId_1_dataType_1_date_-1,
nscanned : 54,
nscannedObjects : 54,                                 INDEX 	

n : 54,
scanAndOrder : true,
millis : 1,
nYields : 0,                                       	

nChunkSkips : 0,
isMultiKey : false,                                          	

indexOnly : false,              (             )
indexBounds : {
:
AP
     DB
orz	

•  MongoDB                              	

•  PHP
db.diaryeval.findOne();	

{	

     	

_id : ObjectId(4e2afdc86978a9bb76000000),	

      md : 32,	

     	

diaryId : 2224,	

     	

fromId : 5472732,	

                                      	

     	

toId : 5439901,	

              md/ fromId mod 100
     	

”dataType : 1,	

                                          diaryId/ DiaryID	

     	

date : 2011/07/24 01:58:48	

}	

                                      fromId/         ID	

                                          toId/        ID	

                                          dateType/            	

                                          date/
                                               (YYYY/MM/DD HH24:MI:SS)
NG   OK   /
(   Д )   !!
DB
                 	


          



(perl)
DB
                    	

            perl          	





2011/6/24
DB
                                                    	





db.footprints.find({”dataType:0,date:{$lt:110624000000}})
 .count();
359832                                36
DB
                                                	


perl remove.ashiato.over.one.month.pl	

[2011-06-24 14:28:45] TARGET  110624	

[2011-06-24 14:28:45] END $VAR1 = 1;


              36                               	

                                        !
DB
                                                    	

                                         	

db.footprints.find({”dataType:0,date:{$lt:110624000000}})
 .count();
359832

                                                    orz
DB
                                                      	

              (   ´    ) (´        )(           )(          )



db.footprints.find({”dataType:0,date:{$lt:110624000000}})
 .count();
 0
                                              DB                
                                          (        )
/ (     )
mongod
mongod                           	


         mongod(primary)
mongod                       	

   	

     :	





[conn38666] JS Error: out of memory
mongod                             	


l             mongod            AP
                        accept             
	

l         AP MongoDB

	

l 
server1 mongod(PRIMARY)

ReplicaSet                 SECONDARY	

     PRIMARY


        (      д )
SECONDARY




  [rs Manager] replSet can't see a majority, will not try to elect self

 elect
mongo1
                            	

         mongo1




                  server2
                                  SECONDARY
mongo1

         mongo1




                  server1         priority
                                                      
                  server2         (default   01)
ReplicaSet SECONDARY
priority            1
              PRIMARY 
                	

SECONDARY
                        (*´   )
           ( д lll)      (        )
(           )
slowms
                                  	


/usr/local/mongodb/bin/mongod --slowms 500 
--logpath /var/log/mongodb/data.log 	

	

500ms
Fri Jul 22 15:48:24 [conn171] query sns.$cmd ntoreturn:
1 command: { count: footprints,
   query: { toId:       , $where: this.dataType  0 } } reslen:64 607ms
	

Fri Jul 22 17:53:00 [conn33887] query sns.$cmd ntoreturn:
1 command: { count: footprints,
   query: { toId:       , $where: this.dataType  0 } } reslen:64 527ms	


                                               	

                                               ( `д ´)
printShardingSizes()
                             	

      2    1           moveChunk()
printShardingSizes()

                                                    	




       	
7/26        (7/5)           3

            2GB
l 
                       
	

l MongoDB       
                                   
	

l           Map/Reduce
MongoDB

group                       Map/Reduce 	

                                       	

	

http://www.mongodb.org/pages/viewpage.action?pageId=6750296
• RDBMS                       
          	

•                                               
                	

• 
(   )
ココロもつながるオンラインゲーム–アットゲームズ–のMongoDB導入事例
ココロもつながるオンラインゲーム–アットゲームズ–のMongoDB導入事例
ココロもつながるオンラインゲーム–アットゲームズ–のMongoDB導入事例
ココロもつながるオンラインゲーム–アットゲームズ–のMongoDB導入事例

More Related Content

What's hot

Mythbusting: Understanding How We Measure the Performance of MongoDB
Mythbusting: Understanding How We Measure the Performance of MongoDBMythbusting: Understanding How We Measure the Performance of MongoDB
Mythbusting: Understanding How We Measure the Performance of MongoDB
MongoDB
 
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
MongoDB
 
2011 Mongo FR - Indexing in MongoDB
2011 Mongo FR - Indexing in MongoDB2011 Mongo FR - Indexing in MongoDB
2011 Mongo FR - Indexing in MongoDB
antoinegirbal
 
MongoDB Performance Debugging
MongoDB Performance DebuggingMongoDB Performance Debugging
MongoDB Performance DebuggingMongoDB
 
Fast querying indexing for performance (4)
Fast querying   indexing for performance (4)Fast querying   indexing for performance (4)
Fast querying indexing for performance (4)
MongoDB
 
Mongodb index 讀書心得
Mongodb index 讀書心得Mongodb index 讀書心得
Mongodb index 讀書心得
cc liu
 
How Signpost uses MongoDB for Tracking and Analytics
How Signpost uses MongoDB for Tracking and AnalyticsHow Signpost uses MongoDB for Tracking and Analytics
How Signpost uses MongoDB for Tracking and Analyticsmattinsler
 
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
Daniel Cousineau
 
Reducing Development Time with MongoDB vs. SQL
Reducing Development Time with MongoDB vs. SQLReducing Development Time with MongoDB vs. SQL
Reducing Development Time with MongoDB vs. SQL
MongoDB
 
The rise of json in rdbms land jab17
The rise of json in rdbms land jab17The rise of json in rdbms land jab17
The rise of json in rdbms land jab17
alikonweb
 
Building Apps with MongoDB
Building Apps with MongoDBBuilding Apps with MongoDB
Building Apps with MongoDB
Nate Abele
 
Morphia: Simplifying Persistence for Java and MongoDB
Morphia:  Simplifying Persistence for Java and MongoDBMorphia:  Simplifying Persistence for Java and MongoDB
Morphia: Simplifying Persistence for Java and MongoDBJeff Yemin
 
Mongo or Die: How MongoDB Powers Doodle or Die
Mongo or Die: How MongoDB Powers Doodle or DieMongo or Die: How MongoDB Powers Doodle or Die
Mongo or Die: How MongoDB Powers Doodle or Die
Aaron Silverman
 
Optimizing Slow Queries with Indexes and Creativity
Optimizing Slow Queries with Indexes and CreativityOptimizing Slow Queries with Indexes and Creativity
Optimizing Slow Queries with Indexes and CreativityMongoDB
 
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
GeeksLab Odessa
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDB
rogerbodamer
 
Mining legal texts with Python
Mining legal texts with PythonMining legal texts with Python
Mining legal texts with Python
Flávio Codeço Coelho
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBMongoDB
 
Mongodb debugging-performance-problems
Mongodb debugging-performance-problemsMongodb debugging-performance-problems
Mongodb debugging-performance-problems
MongoDB
 

What's hot (20)

Mythbusting: Understanding How We Measure the Performance of MongoDB
Mythbusting: Understanding How We Measure the Performance of MongoDBMythbusting: Understanding How We Measure the Performance of MongoDB
Mythbusting: Understanding How We Measure the Performance of MongoDB
 
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
 
2011 Mongo FR - Indexing in MongoDB
2011 Mongo FR - Indexing in MongoDB2011 Mongo FR - Indexing in MongoDB
2011 Mongo FR - Indexing in MongoDB
 
MongoDB Performance Debugging
MongoDB Performance DebuggingMongoDB Performance Debugging
MongoDB Performance Debugging
 
Fast querying indexing for performance (4)
Fast querying   indexing for performance (4)Fast querying   indexing for performance (4)
Fast querying indexing for performance (4)
 
Mongodb index 讀書心得
Mongodb index 讀書心得Mongodb index 讀書心得
Mongodb index 讀書心得
 
How Signpost uses MongoDB for Tracking and Analytics
How Signpost uses MongoDB for Tracking and AnalyticsHow Signpost uses MongoDB for Tracking and Analytics
How Signpost uses MongoDB for Tracking and Analytics
 
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
 
Ajax cheat sheet
Ajax cheat sheetAjax cheat sheet
Ajax cheat sheet
 
Reducing Development Time with MongoDB vs. SQL
Reducing Development Time with MongoDB vs. SQLReducing Development Time with MongoDB vs. SQL
Reducing Development Time with MongoDB vs. SQL
 
The rise of json in rdbms land jab17
The rise of json in rdbms land jab17The rise of json in rdbms land jab17
The rise of json in rdbms land jab17
 
Building Apps with MongoDB
Building Apps with MongoDBBuilding Apps with MongoDB
Building Apps with MongoDB
 
Morphia: Simplifying Persistence for Java and MongoDB
Morphia:  Simplifying Persistence for Java and MongoDBMorphia:  Simplifying Persistence for Java and MongoDB
Morphia: Simplifying Persistence for Java and MongoDB
 
Mongo or Die: How MongoDB Powers Doodle or Die
Mongo or Die: How MongoDB Powers Doodle or DieMongo or Die: How MongoDB Powers Doodle or Die
Mongo or Die: How MongoDB Powers Doodle or Die
 
Optimizing Slow Queries with Indexes and Creativity
Optimizing Slow Queries with Indexes and CreativityOptimizing Slow Queries with Indexes and Creativity
Optimizing Slow Queries with Indexes and Creativity
 
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDB
 
Mining legal texts with Python
Mining legal texts with PythonMining legal texts with Python
Mining legal texts with Python
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDB
 
Mongodb debugging-performance-problems
Mongodb debugging-performance-problemsMongodb debugging-performance-problems
Mongodb debugging-performance-problems
 

Similar to ココロもつながるオンラインゲーム–アットゲームズ–のMongoDB導入事例

Mongo db dla administratora
Mongo db dla administratoraMongo db dla administratora
Mongo db dla administratora
Łukasz Jagiełło
 
Social Data and Log Analysis Using MongoDB
Social Data and Log Analysis Using MongoDBSocial Data and Log Analysis Using MongoDB
Social Data and Log Analysis Using MongoDBTakahiro Inoue
 
MongoDB dla administratora
MongoDB dla administratora MongoDB dla administratora
MongoDB dla administratora
3camp
 
MongoDB Basics Unileon
MongoDB Basics UnileonMongoDB Basics Unileon
MongoDB Basics Unileon
Juan Antonio Roy Couto
 
MongoDB at ZPUGDC
MongoDB at ZPUGDCMongoDB at ZPUGDC
MongoDB at ZPUGDC
Mike Dirolf
 
mongodb tutorial
mongodb tutorialmongodb tutorial
mongodb tutorial
Jaehong Park
 
MongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overviewMongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overview
Antonio Pintus
 
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
MongoDB
 
MongoDB: Optimising for Performance, Scale & Analytics
MongoDB: Optimising for Performance, Scale & AnalyticsMongoDB: Optimising for Performance, Scale & Analytics
MongoDB: Optimising for Performance, Scale & Analytics
Server Density
 
视觉中国的MongoDB应用实践(QConBeijing2011)
视觉中国的MongoDB应用实践(QConBeijing2011)视觉中国的MongoDB应用实践(QConBeijing2011)
视觉中国的MongoDB应用实践(QConBeijing2011)
Night Sailer
 
PostgreSQLからMongoDBへ
PostgreSQLからMongoDBへPostgreSQLからMongoDBへ
PostgreSQLからMongoDBへ
Basuke Suzuki
 
MongoDB: Intro & Application for Big Data
MongoDB: Intro & Application  for Big DataMongoDB: Intro & Application  for Big Data
MongoDB: Intro & Application for Big DataTakahiro Inoue
 
MongoDB at Scale
MongoDB at ScaleMongoDB at Scale
MongoDB at Scale
MongoDB
 
Back to Basics, webinar 2: La tua prima applicazione MongoDB
Back to Basics, webinar 2: La tua prima applicazione MongoDBBack to Basics, webinar 2: La tua prima applicazione MongoDB
Back to Basics, webinar 2: La tua prima applicazione MongoDB
MongoDB
 
MongoDB.pdf
MongoDB.pdfMongoDB.pdf
MongoDB.pdf
KuldeepKumar778733
 
Streaming Data Pipelines with MongoDB and Kafka at ao.com
Streaming Data Pipelines with MongoDB and Kafka at ao.comStreaming Data Pipelines with MongoDB and Kafka at ao.com
Streaming Data Pipelines with MongoDB and Kafka at ao.com
MongoDB
 
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...
MongoDB
 
How to use MongoDB with CakePHP
How to use MongoDB with CakePHPHow to use MongoDB with CakePHP
How to use MongoDB with CakePHP
ichikaway
 
MongoDB at FrozenRails
MongoDB at FrozenRailsMongoDB at FrozenRails
MongoDB at FrozenRails
Mike Dirolf
 

Similar to ココロもつながるオンラインゲーム–アットゲームズ–のMongoDB導入事例 (20)

Mongo db dla administratora
Mongo db dla administratoraMongo db dla administratora
Mongo db dla administratora
 
Social Data and Log Analysis Using MongoDB
Social Data and Log Analysis Using MongoDBSocial Data and Log Analysis Using MongoDB
Social Data and Log Analysis Using MongoDB
 
MongoDB dla administratora
MongoDB dla administratora MongoDB dla administratora
MongoDB dla administratora
 
MongoDB Basics Unileon
MongoDB Basics UnileonMongoDB Basics Unileon
MongoDB Basics Unileon
 
MongoDB at ZPUGDC
MongoDB at ZPUGDCMongoDB at ZPUGDC
MongoDB at ZPUGDC
 
mongodb tutorial
mongodb tutorialmongodb tutorial
mongodb tutorial
 
MongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overviewMongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overview
 
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
 
MongoDB: Optimising for Performance, Scale & Analytics
MongoDB: Optimising for Performance, Scale & AnalyticsMongoDB: Optimising for Performance, Scale & Analytics
MongoDB: Optimising for Performance, Scale & Analytics
 
Mongo scaling
Mongo scalingMongo scaling
Mongo scaling
 
视觉中国的MongoDB应用实践(QConBeijing2011)
视觉中国的MongoDB应用实践(QConBeijing2011)视觉中国的MongoDB应用实践(QConBeijing2011)
视觉中国的MongoDB应用实践(QConBeijing2011)
 
PostgreSQLからMongoDBへ
PostgreSQLからMongoDBへPostgreSQLからMongoDBへ
PostgreSQLからMongoDBへ
 
MongoDB: Intro & Application for Big Data
MongoDB: Intro & Application  for Big DataMongoDB: Intro & Application  for Big Data
MongoDB: Intro & Application for Big Data
 
MongoDB at Scale
MongoDB at ScaleMongoDB at Scale
MongoDB at Scale
 
Back to Basics, webinar 2: La tua prima applicazione MongoDB
Back to Basics, webinar 2: La tua prima applicazione MongoDBBack to Basics, webinar 2: La tua prima applicazione MongoDB
Back to Basics, webinar 2: La tua prima applicazione MongoDB
 
MongoDB.pdf
MongoDB.pdfMongoDB.pdf
MongoDB.pdf
 
Streaming Data Pipelines with MongoDB and Kafka at ao.com
Streaming Data Pipelines with MongoDB and Kafka at ao.comStreaming Data Pipelines with MongoDB and Kafka at ao.com
Streaming Data Pipelines with MongoDB and Kafka at ao.com
 
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...
 
How to use MongoDB with CakePHP
How to use MongoDB with CakePHPHow to use MongoDB with CakePHP
How to use MongoDB with CakePHP
 
MongoDB at FrozenRails
MongoDB at FrozenRailsMongoDB at FrozenRails
MongoDB at FrozenRails
 

Recently uploaded

zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 

Recently uploaded (20)

zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 

ココロもつながるオンラインゲーム–アットゲームズ–のMongoDB導入事例

  • 1. – MongoDB 5 MongoDB (@nsega) GCREST, Inc.
  • 2. •  (Age:28) (twitter: @nsega) •  •  •  •  ( SNS ) •  •  JavaEE
  • 3. Agenda •  •  MongoDB •  •  •  •  • 
  • 4. ?
  • 5. ? -@games- http://www.atgames.jp/ 290
  • 7. MongoDB SNS ( )
  • 8. •  •  MySQL • 
  • 9. •  • 
  • 10.
  • 11. MongoDB •  •  NoSQL
  • 12. MongoDB l  NoSQL MongoDB l  MongoDB JP
  • 13.
  • 14.
  • 16.
  • 17. ( SNS ) •  Linux/CentOS v5.4 •  Apache v2.2.14 •  MySQL v5.5(InnoDB) •  PostgreSQL v9.0.1 •  MongoDB v1.8.2-rc3 NEW!! •  PHP v5.2 / symfony v1.2.9 (MongoDriver/mongo.so) NEW!!
  • 18. 15 (Web/PC ) 3 (Web/Mobile ) mongos 5 (MySQL) 1 :Master / 3 :Slave/ 1 :
  • 19. 3 (MongoDB) NEW!! •  CPU:Intel(R) Xeon(R) 2.13GHz 8core •  Memory:16GB •  HDD: 550GB (xfs 400GB/mongo )
  • 20. Web Server x 18 (PC/MB) mongos Server1 Server2 Server3 CONFIG CONFIG CONFIG Sharding PRIMARY PRIMARY PRIMARY ReplicaSet ReplicaSet ReplicaSet SECONDARY SECONDARY SECONDARY
  • 21.
  • 23. MongoDB ( ) ( ) ( )
  • 24. l Shard Key ( ID( )) mod 100 md Shard Key l 100 (0~99) 3 Shard
  • 25. l Chunk (split ) /usr/local/mongodb/bin/mongo localhost/admin; db.runCommand({split:sns.footprints,middle:{md:0}}); db.runCommand({split:sns.footprints,middle:{md:1}}); : db.runCommand({split:sns.footprints,middle:{md:98}}); db.runCommand({split:sns.footprints,middle:{md:99}});
  • 26. l Chunk (moveChunk ) db.runCommand({moveChunk:sns.footprints, find:{md:0},to:”mongo01}); db.runCommand({moveChunk:sns.footprints, find:{md:1},to:”mongo02}); : db.runCommand({moveChunk:sns.footprints, find:{md:98},to:”mongo03}); db.runCommand({moveChunk:sns.footprints, find:{md:99},to:”mongo01});
  • 27. MongoDB DataAccess •  Symfony(PHP) + MongoDB • 
  • 28. MongoDB DataAccess Class MogoKeyValue MongoDB Class Class DiaryEvalMongoKeyVale FootprintsMongoKeyVale DAO
  • 29. •  explain • 
  • 30. db.footprints.findOne(); { _id : ObjectId(4e0967ac6978a9cf03000027), md : 73, fromId : 5439901, md/ ID mod 100 toId” : 5484473, fromId/ ID date : 1106281433, toId/ ID date/ (YYMMDDHH24MISS) ”dataType : 0 dateType/ } db.footprints.count(); ( ) 30282 30,000
  • 31. explain db.footprints.find({fromId:5439901,”dateType:{$gt:0}}) Ø  .sort({date:-1}).explain(); { cursor : BasicCursor, INDEX nscanned : 30178, nscannedObjects : 30178, n : 54, scanAndOrder : true, millis : 31, nYields : 0, nChunkSkips : 0, isMultiKey : false, indexOnly : false, indexBounds : { } }
  • 32. INDEX db.footprints.ensureIndex({fromId:1,dataType:1,date:-1}); db.footprints.getIndexes(); [ : wkwk { _id : ObjectId(4e2c5aff4ab228594428620c), ns : sns.footprints, key : { fromId : 1, ”dataType : 1, INDEX date : -1 }, name : fromId_1_dataType_1_date_-1, v : 0 } ]
  • 33. explain db.footprints.find({fr:5439901,ty:{$gt:0}}).sort({dt:-1}).explain(); { cursor : BtreeCursor fromId_1_dataType_1_date_-1, nscanned : 54, nscannedObjects : 54, INDEX n : 54, scanAndOrder : true, millis : 1, nYields : 0, nChunkSkips : 0, isMultiKey : false, indexOnly : false, ( ) indexBounds : { :
  • 34.
  • 35. AP DB
  • 36. orz •  MongoDB •  PHP
  • 37. db.diaryeval.findOne(); { _id : ObjectId(4e2afdc86978a9bb76000000), md : 32, diaryId : 2224, fromId : 5472732, toId : 5439901, md/ fromId mod 100 ”dataType : 1, diaryId/ DiaryID date : 2011/07/24 01:58:48 } fromId/ ID toId/ ID dateType/ date/ (YYYY/MM/DD HH24:MI:SS)
  • 38. NG OK /
  • 39. ( Д ) !!
  • 40. DB (perl)
  • 41. DB perl 2011/6/24
  • 42. DB db.footprints.find({”dataType:0,date:{$lt:110624000000}}) .count(); 359832 36
  • 43. DB perl remove.ashiato.over.one.month.pl [2011-06-24 14:28:45] TARGET 110624 [2011-06-24 14:28:45] END $VAR1 = 1; 36 !
  • 44. DB db.footprints.find({”dataType:0,date:{$lt:110624000000}}) .count(); 359832 orz
  • 45. DB ( ´ ) (´ )( )( ) db.footprints.find({”dataType:0,date:{$lt:110624000000}}) .count(); 0 DB ( )
  • 46. / ( )
  • 48. mongod mongod(primary)
  • 49. mongod : [conn38666] JS Error: out of memory
  • 50. mongod l  mongod AP accept l  AP MongoDB l 
  • 51. server1 mongod(PRIMARY) ReplicaSet SECONDARY PRIMARY ( д )
  • 52. SECONDARY [rs Manager] replSet can't see a majority, will not try to elect self elect
  • 53. mongo1 mongo1 server2 SECONDARY
  • 54. mongo1 mongo1 server1 priority server2 (default 01)
  • 55. ReplicaSet SECONDARY priority 1 PRIMARY SECONDARY (*´ ) ( д lll) ( )
  • 56. ( )
  • 57. slowms /usr/local/mongodb/bin/mongod --slowms 500 --logpath /var/log/mongodb/data.log 500ms
  • 58. Fri Jul 22 15:48:24 [conn171] query sns.$cmd ntoreturn: 1 command: { count: footprints, query: { toId: , $where: this.dataType 0 } } reslen:64 607ms Fri Jul 22 17:53:00 [conn33887] query sns.$cmd ntoreturn: 1 command: { count: footprints, query: { toId: , $where: this.dataType 0 } } reslen:64 527ms ( `д ´)
  • 59. printShardingSizes() 2 1 moveChunk()
  • 60. printShardingSizes() 7/26 (7/5) 3 2GB
  • 61.
  • 62. l  l MongoDB l  Map/Reduce
  • 63. MongoDB group Map/Reduce http://www.mongodb.org/pages/viewpage.action?pageId=6750296
  • 64.
  • 65. • RDBMS •  • 
  • 66.
  • 67. ( )