SlideShare una empresa de Scribd logo
1 de 71
–                                 – 	

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導入事例

Más contenido relacionado

La actualidad más candente

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 MongoDBMongoDB
 
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 MongoDBantoinegirbal
 
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. SQLMongoDB
 
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 jab17alikonweb
 
Building Apps with MongoDB
Building Apps with MongoDBBuilding Apps with MongoDB
Building Apps with MongoDBNate 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 DieAaron 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 MongoDBrogerbodamer
 
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-problemsMongoDB
 

La actualidad más candente (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 a ココロもつながるオンラインゲーム–アットゲームズ–のMongoDB導入事例

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 at ZPUGDC
MongoDB at ZPUGDCMongoDB at ZPUGDC
MongoDB at ZPUGDCMike Dirolf
 
MongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overviewMongoDB: a gentle, friendly overview
MongoDB: a gentle, friendly overviewAntonio 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 & AnalyticsServer 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 ScaleMongoDB
 
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 MongoDBMongoDB
 
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.comMongoDB
 
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 CakePHPichikaway
 
MongoDB at FrozenRails
MongoDB at FrozenRailsMongoDB at FrozenRails
MongoDB at FrozenRailsMike Dirolf
 

Similar a ココロもつながるオンラインゲーム–アットゲームズ–の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
 

Último

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
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.pdfsudhanshuwaghmare1
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
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...apidays
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
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 CVKhem
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 

Último (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
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
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
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...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

ココロもつながるオンラインゲーム–アットゲームズ–の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. ( )