SlideShare uma empresa Scribd logo
1 de 128
Baixar para ler offline
KVSの性能
   RDBMSのインデックス
  更にMapReduceを併せ持つ
    All-in-one NoSQL

楽 天 株 式 会 社 開 発 部 ア ーキ テ ク ト G 窪 田 博 昭 | 2 0 1 2 年 1 月 1 8 日   1
Introduction
Agenda
• Introduction
• How to use mongo on the news.infoseek.co.jp




                                                2
Introduction




               3
Who am I ?




             4
Introduction
Profile


Name:       窪田 博昭 Hiroaki Kubota
Company:    Rakuten Inc.
Unit:       ACT = Development Unit Architect Group
Mail:       hiroaki.kubota@mail.rakuten.com

Hobby:      Futsal , Golf
Recent:     My physical power has gradual declined...

twitter :   crumbjp
github:     crumbjp
                                                        5
How to take advantages of the Mongo
         for the infoseek news




                                      6
For instance of our page




                           7
Page structure




                 8
Layout / Components

Layout              Components




                                 9
Albatross structure

           Internet

                                  Request                SessionDB
LayoutDB    Gat page layout

                                                         MongoDB
                  WEB                                    ReplSet
MongoDB
ReplSet       Get components
                                 Call APIs               Memcache

                   API

                               Retrieve data

             ContentsDB                        MongoDB
                                               ReplSet               10
Albatross structure
                   Developer

                             HTML markup
LayoutDB   Set page layout       &        Deploy API
                             API settings

                 CMS                             Batch servers
MongoDB
ReplSet
            Set components
                                                          Insert Data


                   API servers



             ContentsDB                     MongoDB
                                            ReplSet                     11
CMS
Layout editor




                      12
CMS




      13
CMS




      14
MapReduce




            15
MapReduce
Our usage
We have never used MapReduce as regular operation.
However, We have used it for some irreglar case.

• To search the invalid articles that should be removed
  because of someone’s mistakes...

• To analyze the number of new articles posted a day.

• To analyze the updated number an article.

• We get start considering to use it regularly for the
  social data analyzing before long ...
                                                         16
Structure & Performance




                          17
Structure
We are using very poor machine (Virtual machine) !!

•   Intel(R) Xeon(R) CPU X5650 2.67GHz 1core!!
•   4GB memory
•   50 GB disk space ( iScsi )
•   CentOS5.5 64bit
•   mongodb 1.8.0
     – ReplicaSet 5 nodes ( + 1 Arbiter)
     – Oplog size 1.2GB
     – Average object size 1KB

                                                      18
Structure
Researched environment

We’ve also researched following environments...
• Virtual machine 1 core
  – 1kb data , 6,000,000 documents
  – 8kb data , 200,000 documents
• Virtual machine 3 core
  – 1kb data , 6,000,000 documents
  – 8kb data , 200,000 documents
• EC2 large instance
  – 2kb data , 60,000,000 documents. ( 100GB )
                                                  19
Performance
I found the formula for making a rough estimation of QPS

1~8 kb documents + 1 unique index
C    = Number of CPU cores (Xeon 2.67 GHz)
DD = Score of ‘dd’ command (byte/sec)
S    = Document size (byte)

• GET qps            = 4500 × C
• SET(fsync) bytes/s = 0.05×DD ÷ S
• SET(nsync) qps     = 4500 BUT...
                           have chance of STALE
                                                           20
Performance example (on EC2 large)




                                     21
Performance example (on EC2 large)
Environment and amount of data

EC2 large instance
     – 2kb data , 60,000,000 documents. ( 100GB )
     – 1 unique index

Data-type
 {
     shop: 'someone',
     item: 'something',
     description: 'item explanation sentences...‘
 }                                                  22
Performance example (on EC2 large)
Batch insert (1000 documents) fsync=true
17906 sec (=289 min) (=3358 docs/sec)

Ensure index (background=false)

4049 sec (=67min)
      1. primary          2101 sec (=35min)
      2. secondary        1948 sec (=32min)




                                               23
Performance example (on EC2 large)
Add one node
5833sec (=97min)
      1. Get files 2GB×48   2120 sec (=35min)
      2. _id indexing       1406 sec (=23min)
      3. uniq indexing      2251 sec (=38min)
      4. other processes    56 sec (=1 min)




                                                24
Performance example (on EC2 large)
Group by
• Reduce by unique index & map & reduce
      – 368 msec
 db.data.group({ key: { shop: 1},
                 cond: { shop: 'someone' },
                 reduce: function ( o , p ) { p.sum++; },
                 initial: { sum: 0 } });




                                                            25
Performance example (on EC2 large)
MapReduce
• Scan all data 3116sec (=52min)
      – number of key = 39092
 db.data.mapReduce(
  function(){ emit(this.shop,1); },
  function(k,v){
   var ret=0;
   v.forEach( function (value){ ret+=value; });
   return ret; },
  { query: {}, inline: 1, out: 'Tmp' } );
                                                  26
Major problems...




                    27
Indexing




           28
Index probrem
Online indexisng is completely useless even if last version (2.0.2)
Indexing is lock operation in default.
Indexing operation can run as background
   on the primary. But...
It CANNOT run as background on the secondary
Moreover the all secondary’s indexing run
   at the same time !!
Result in above...

           All slave freezes !                           orz...
                                                                      29
Present indexing ( default )




                               30
Index probrem
Present indexing ( default )
                               Primary
                                              save
                                                        Batch


      Secondary                Secondary          Secondary




   Client       Client         Client    Client      Client   31
Index probrem
Present indexing ( default )
                                Primary
 ensureIndex
                                 Lock      Cannot Batch
                                                   write
                               Indexing

      Secondary                Secondary           Secondary




   Client       Client         Client     Client     Client    32
Index probrem
Present indexing ( default )
                               Primary
          finished
                                                       Batch
                               Complete
                  SYNC                     SYNC
                                  SYNC
      Secondary                Secondary          Secondary
         Lock                     Lock               Lock
       Indexing                 Indexing           Indexing

                     Cannot read !!
   Client       Client         Client    Client     Client    33
Index probrem
Ideal indexing ( default )
                                Primary
                                                        Batch
                               Complete

      Secondary                Secondary           Secondary

       Complete                 Complete           Complete



   Client        Client        Client     Client     Client    34
Present indexing ( background )




                                  35
Index probrem
Present indexing ( background )
                           Primary
                                          save
                                                    Batch


     Secondary             Secondary          Secondary




   Client      Client      Client    Client      Client   36
Index probrem
 Present indexing ( background )

ensureIndex(background)
                             Primary      Slow down...
                           Slowdown                Batch
                            Indexing

       Secondary            Secondary         Secondary




    Client      Client      Client   Client     Client    37
Index probrem
Present indexing ( background )
                           Primary
          finished
                                                       Batch
                          Complete
                 SYNC                      SYNC
                                  SYNC
     Secondary             Secondary              Secondary
        Lock                  Lock                   Lock
      Indexing              Indexing               Indexing

                     Cannot read !!
   Client      Client      Client        Client     Client    38
Index probrem
Present indexing ( background )
                           Primary
          finished
                                                       Batch
  Background Complete don’t work
             indexing
                 SYNC                      SYNC
                                  SYNC
     Secondary             Secondary              Secondary
        on the
        Lock
                        secondaries
                              Lock                   Lock
      Indexing              Indexing               Indexing

                     Cannot read !!
   Client      Client      Client        Client     Client    39
Index probrem
Present indexing ( background )
                           Primary
          finished
                                                       Batch
                          Complete
                 SYNC                      SYNC
                                  SYNC
     Secondary             Secondary              Secondary
        Lock                  Lock                   Lock
      Indexing              Indexing               Indexing

                     Cannot read !!
   Client      Client      Client        Client     Client    40
Index probrem
Ideal indexing ( background )
                                Primary
                                                        Batch
                           Complete

      Secondary             Secondary              Secondary

       Complete             Complete               Complete



   Client       Client      Client        Client     Client    41
Probable 2.1.X indexing




                          42
Index probrem
Accoding to mongodb.org this probrem will fix in 2.1.0

But not released formally.
So I checked out the source code up to date.
 Certainlly it’ll be fixed !
Moreover it sounds like it’ll run as foreground
 when slave status isn’t SECONDARY
   (it means RECOVERING )




                                                         43
Index probrem
Probable 2.1.X indexing
                             Primary
                                            save
                                                      Batch


      Secondary             Secondary           Secondary




   Client      Client       Client     Client      Client   44
Index probrem
 Probable 2.1.X indexing

ensureIndex(background)
                              Primary      Slow down...
                            Slowdown                Batch
                             Indexing

       Secondary             Secondary         Secondary




    Client      Client       Client   Client     Client    45
Index probrem
Probable 2.1.X indexing
                             Primary
          finished
                                                     Batch
                            Complete
                 SYNC                     SYNC
                                SYNC
      Secondary             Secondary           Secondary
      Slowdown              Slowdown            Slowdown
       Indexing              Indexing            Indexing

                     Slow down...
   Client      Client       Client     Client     Client    46
Index probrem
Probable 2.1.X indexing
                             Primary
                                                     Batch
                            Complete

      Secondary             Secondary           Secondary

      Complete               Complete           Complete



   Client      Client       Client     Client     Client    47
Index probrem
Background indexing 2.1.X

But I think it’s not enough.
I think it can be fatal for the system that
the all secondaries slowdown at the same time !!


               So...




                                                   48
Ideal indexing




                 49
Index probrem
Ideal indexing
                             Primary
                                            save
                                                      Batch


      Secondary             Secondary           Secondary




   Client        Client     Client     Client      Client   50
Index probrem
 Ideal indexing

ensureIndex(background)
                              Primary      Slow down...
                            Slowdown                Batch
                             Indexing

       Secondary             Secondary         Secondary




    Client        Client     Client   Client     Client    51
Index probrem
Ideal indexing
                             Primary
           finished
                                                     Batch
                            Complete
            ensureIndex

     Recovering             Secondary           Secondary

        Indexing



   Client        Client     Client     Client     Client    52
Index probrem
Ideal indexing
                             Primary
                                                     Batch
                            Complete
                                  ensureIndex
      Secondary             Recovering          Secondary

       Complete              Indexing



   Client        Client     Client     Client     Client    53
Index probrem
Ideal indexing
                             Primary
                                                    Batch
                            Complete
                                          ensureIndex

      Secondary             Secondary       Recovering

       Complete              Complete           Indexing



   Client        Client     Client     Client    Client    54
Index probrem
Ideal indexing
                             Primary
                                                     Batch
                            Complete

      Secondary             Secondary           Secondary

       Complete              Complete           Complete



   Client        Client     Client     Client     Client    55
Index probrem
But ... I easilly guess it’s difficult to apply for current Oplog



It would be great if I can operate indexing manually
 at each secondaries




                                                                    56
I suggest Manual indexing




                            57
Index probrem
Manual indexing
                              Primary
                                             save
                                                       Batch


     Secondary               Secondary           Secondary




   Client         Client     Client     Client      Client   58
Index probrem
Manual indexing
                           Primary
ensureIndex(manual,background)             Slow down...
                        Slowdown                    Batch
                          Indexing

     Secondary               Secondary         Secondary




   Client         Client     Client   Client     Client    59
Index probrem
Manual indexing
                              Primary
          finished
                                                      Batch
                             Complete

     Secondary               Secondary           Secondary




   Client         Client     Client     Client     Client    60
Index probrem
Manual indexing
                              Primary
          finished
                                                      Batch
                             Complete

     Secondary               Secondary           Secondary

      The secondaries don’t sync
            automatically
   Client         Client     Client     Client     Client    61
Index probrem
Manual indexing
                              Primary
          finished
                                                      Batch
                             Complete

     Secondary               Secondary           Secondary




   Client         Client     Client     Client     Client    62
Index probrem
Manual indexing
                              Primary
                                                      Batch
                             Complete
            ensureIndex(manual)

     Recovering              Secondary           Secondary

       Indexing



   Client         Client     Client     Client     Client    63
Index probrem
Manual indexing
                              Primary
                                                         Batch
                             Complete
                                   ensureIndex(manual)

     Secondary               Recovering          Secondary

      Complete                Indexing



   Client         Client     Client     Client     Client    64
Index probrem
Manual indexing
                              Primary
                                                      Batch
                             Complete
ensureIndex(manual,background)

     Secondary               Secondary           Secondary
                                                 Slowdown
      Complete                Complete            Indexing



   Client         Client     Client     Client     Client    65
Index probrem
Manual indexing
                              Primary
                                                     Batch
                             Complete
      It needs to support
ensureIndex(manual,background)


    background operation
    Secondary Secondary Secondary
                        Slowdown
      Complete                Complete           Indexing
Just in case,if the ReplSet has only
          one Secondary
   Client         Client     Client     Client    Client    66
Index probrem
Manual indexing
                              Primary
                                                      Batch
                             Complete
ensureIndex(manual,background)

     Secondary               Secondary           Secondary
                                                 Slowdown
      Complete                Complete            Indexing



   Client         Client     Client     Client     Client    67
Index probrem
Manual indexing
                              Primary
                                                      Batch
                             Complete

     Secondary               Secondary           Secondary

      Complete                Complete           Complete



   Client         Client     Client     Client     Client    68
That’s all about Indexing problem




                                    69
Struggle to control the sync




                               70
STALE




        71
Unknown log & Out of control the ReplSet
We often suffered from going out of control the Secondaries...

• Secondaries change status repeatedly in a moment
   between Secondary and Recovering (1.8.0)
• Then we found the strange line in the log...



[rsSync] replSet error RS102 too stale to catch up




                                                                 72
What’s Stale ?
stale [stéil] (レベル:社会人必須 ) powered by goo.ne.jp

•   〈食品・飲料などが〉新鮮でない(⇔fresh);
•    気の抜けた, 〈コーヒーが〉香りの抜けた,
•   〈パンが〉ひからびた, 堅くなった,
•   〈空気・臭(にお)いなどが〉むっとする,
•   いやな臭いのする




                                                  73
What’s Stale ?
stale [stéil] (レベル:社会人必須 ) powered by goo.ne.jp

•   〈食品・飲料などが〉新鮮でない(⇔fresh);
•    気の抜けた, 〈コーヒーが〉香りの抜けた,
•   〈パンが〉ひからびた, 堅くなった,
•   〈空気・臭(にお)いなどが〉むっとする,
•   いやな臭いのする


どうも非常によろしくないらしい・・・

                                                  74
Mechanizm of being stale




                           75
ReplicaSet

  Client


mongod              mongod




Database   Oplog   Database   Oplog
    Primary          Secondary
                                      76
Replication (simple case)




                            77
ReplicaSet

  Client


mongod              mongod




Database   Oplog   Database   Oplog
    Primary          Secondary
                                      78
Insert & Replication 1

             A
  Client
              Insert


mongod                     mongod




            Insert A
   A

Database    Oplog         Database   Oplog
       Primary               Secondary
                                                79
Insert & Replication 1

  Client


                                  Sync




            Insert A                     Insert A
   A                          A

Database    Oplog         Database       Oplog
       Primary               Secondary
                                                    80
Replication (busy case)




                          81
Stale

  Client


mongod                  mongod




            Insert A                  Insert A
   A                      A

Database    Oplog      Database       Oplog
       Primary           Secondary
                                                 82
Insert & Replication 2

             B
  Client
              Insert




            Insert B
   B        Insert A                 Insert A
   A                          A

Database    Oplog         Database   Oplog
       Primary               Secondary
                                                83
Insert & Replication 2

             C
  Client
              Insert




            Insert C
   C        Insert B
   B        Insert A                 Insert A
   A                          A

Database    Oplog         Database   Oplog
       Primary               Secondary
                                                84
Insert & Replication 2

             A
  Client
             Update




           Update A
            Insert C
   C        Insert B
   B        Insert A                 Insert A
   A                          A

Database    Oplog         Database   Oplog
       Primary               Secondary
                                                85
Insert & Replication 2

  Client


                            Check Oplog




           Update A
            Insert C
   C        Insert B
   B        Insert A                      Insert A
   A                          A

Database    Oplog         Database        Oplog
       Primary               Secondary
                                                     86
Insert & Replication 2

  Client


                              Sync




           Update A                  Update A
            Insert C                 Insert C
   C        Insert B          C      Insert B
   B        Insert A          B      Insert A
   A                          A

Database    Oplog         Database   Oplog
       Primary               Secondary
                                                87
Replication (more busy)




                          88
Stale

  Client


mongod                  mongod




            Insert A                  Insert A
   A                      A

Database    Oplog      Database       Oplog
       Primary           Secondary
                                                 89
Stale

             B
  Client
              Insert




            Insert B
   B        Insert A                  Insert A
   A                      A

Database    Oplog      Database       Oplog
       Primary           Secondary
                                                 90
Stale

             C
  Client
              Insert




            Insert C
   C        Insert B
   B        Insert A                  Insert A
   A                      A

Database    Oplog      Database       Oplog
       Primary           Secondary
                                                 91
Stale

             A
  Client
             Update




           Update A
            Insert C
   C        Insert B
   B        Insert A                  Insert A
   A                      A

Database    Oplog      Database       Oplog
       Primary           Secondary
                                                 92
Stale

             C
  Client
             Update




           Update C
           Update A
   C        Insert C
   B        Insert B                  Insert A
   A        Insert A      A

Database    Oplog      Database       Oplog
       Primary           Secondary
                                                 93
Stale

             D
  Client
              Insert




            Insert D
   D       Update C
   C       Update A
   B        Insert C                  Insert A
   A        Insert B      A

Database    Insert A   Database       Oplog
       Primary           Secondary
                                                 94
Stale

  Client                                 [Inset A]
                                        not found !!
                              Check Oplog




            Insert D
   D       Update C
   C       Update A
   B        Insert C                  Insert A
   A        Insert B      A

Database    Insert A   Database       Oplog
       Primary           Secondary
                                                       95
Stale

  Client                                 [Inset A]
                                        not found !!
                              Check Oplog

                                                 It cannot get
                                                 infomation about
                                                 [Insert B].
            Insert D
   D       Update C
   C       Update A                              So cannot sync !!
   B        Insert C                  Insert A
   A        Insert B      A
                                                 It’s called STALE
Database    Insert A   Database       Oplog
       Primary           Recovering
                                                                96
Stale
We have to understand the importance of adjusting oplog size

We can specify the oplog size as one of the command line option
Only at the first time per the dbpath
 that is also specified as a command line.
Also we cannot change the oplog size
 without clearing the dbpath.


              Be careful !



                                                               97
Replication (Join as a new node)




                                   98
InitialSync

  Client


mongod




            Insert D
   D       Update C
   C       Update A
   B        Insert C
   A

Database    Oplog
       Primary
                                     99
InitialSync

  Client


mongod                  mongod




            Insert D
   D       Update C
   C       Update A
   B        Insert C
   A

Database    Oplog      Database   Oplog
       Primary             Startup
                                          100
InitialSync

  Client


                            Get last Oplog




            Insert D
   D       Update C
   C       Update A
   B        Insert C                 Insert D
   A

Database    Oplog      Database       Oplog
       Primary           Recovering
                                                101
InitialSync

                          D
  Client
                          C
                          B
                          A   Cloning DB




            Insert D
   D       Update C
   C       Update A
   B        Insert C               Insert D
   A

Database    Oplog      Database     Oplog
       Primary           Recovering
                                              102
InitialSync

                          D
  Client
                          C
                          B
                          A   Cloning DB




            Insert D
   D       Update C
   C       Update A
   B        Insert C               Insert D
   A                      A

Database    Oplog      Database     Oplog
       Primary           Recovering
                                              103
InitialSync

             E            D
  Client
              Insert      C
                          B
                          A   Cloning DB




   E        Insert E
   D        Insert D
   C       Update C
   B                      B
           Update A                Insert D
   A                      A
            Insert C

Database    Oplog      Database     Oplog
       Primary           Recovering
                                              104
InitialSync

             B
  Client
             Update


                          Cloning DB complete




   E       Update B
   D        Insert E      D
   C        Insert D      C
   B       Update C       B           Insert D
   A       Update A       A

Database    Oplog      Database       Oplog
       Primary           Recovering
                                                 105
InitialSync

  Client


                              Check Oplog




   E       Update B
   D        Insert E      D
   C        Insert D      C
   B       Update C       B           Insert D
   A                      A

Database    Oplog      Database       Oplog
       Primary           Recovering
                                                 106
InitialSync

  Client


                              Sync




   E       Update B       E
   D        Insert E      D       Update B
   C        Insert D      C          Insert E
   B       Update C       B          Insert D
   A                      A

Database    Oplog      Database      Oplog
       Primary           Secondary
                                                107
Additional infomation
From source code. ( I’ve never examed these... )

Secondary will try to sync from other Secondaries
 when it cannot reach the Primary or
 might be stale against the Primary.

 There is a bit of chance that sync problem not occured if the
  secondary has old Oplog or larger Oplog space than Primary




                                                            108
Sync from another secondary

  Client




            Insert D                                    Insert D
   D       Update C                             D       Update C
   C       Update A                             C       Update A
   B        Insert C              Insert A      B       Insert C
   A        Insert B      A                     A       Insert B

Database    Insert A   Database   Oplog      Database   Insert A

       Primary           Secondary             Secondary
                                                              109
Sync from another secondary

  Client                              [Inset A]
                                     not found !!

                              Check Oplog




            Insert D                                        Insert D
   D       Update C                                 D       Update C
   C       Update A                                 C       Update A
   B        Insert C                  Insert A      B       Insert C
   A        Insert B      A                         A       Insert B

Database    Insert A   Database       Oplog      Database   Insert A

       Primary           Secondary                  Secondary
                                                                  110
Sync from another secondary

  Client                          But found at the other secondary
                                    So it’s able to sync

                              Check Oplog




            Insert D                                        Insert D
   D       Update C                                 D       Update C
   C       Update A                                 C       Update A
   B        Insert C                  Insert A      B       Insert C
   A        Insert B      A                         A       Insert B

Database    Insert A   Database       Oplog      Database   Insert A

       Primary           Secondary                 Secondary
                                                                  111
Sync from the other secondary

  Client                          But found at the other secondary
                                    So it’s able to sync

                              Sync




            Insert D                 Insert D              Insert D
   D       Update C       D         Update C       D       Update C
   C       Update A       C         Update A       C       Update A
   B        Insert C      B          Insert C      B       Insert C
   A        Insert B      A          Insert B      A       Insert B
            Insert A                 Insert A              Insert A
Database               Database                 Database
       Primary           Secondary                Secondary
                                                                 112
That’s all about sync




                        113
Others...




            114
Disk space




             115
Disk space
Data fragment into any DB files sparsely...
We met the unfavorable circumstance in our DBs

This circumstance appears at some of our collections
 around 3 months after we launched the services

db.ourcol.storageSize()      = 16200727264 (15GB)
db.ourcol.totalSize()        = 16200809184
db.ourcol.totalIndexSize()   =       81920
db.outcol.dataSize()         =     2032300 (2MB)


    What’s happen to them !!
                                                       116
Disk space
Data fragment into any DB files sparsely...
It’s seems like to be caused by the specific operation
 that insert , update and delete over and over.

Anyway we have to shrink the using disk space regularly
 just like PostgreSQL’s vacume.


            But how to do it ?



                                                          117
Disk space
Shrink the using disk spaces
MongoDB offers some functions for this case.
 But couldn’t use in our case !

repairdatabase:
 Only runable on the Primary.
 It needs long time and BLOCK all operations !!

compact:
 Only runable on the Secondary.
 Zero-fill the blank space instead of shrink disk spaces.
 So cannot shrink...
                                                            118
Disk space
Our measurements
For temporary collection:
 To issue drop-command regularly.
For other collections:
   1. Get rid of one secondary from the ReplSet.
   2. Shut down this.
   3. Remove all DB files.
   4. Join to the ReplSet.
   5. Do these operations one after another.
   6. Step down the Primary. (Change Primary node)
   7. At last, do 1 – 4 operations on prior Primary.
                                                  119
PHP client




             120
PHP client
We tried 1.4.4 and 1.2.2
1.4.4:
 There is some critical bugs around connection pool.
 We struggled to invalidate the broken connection.
 I think, you should use 1.2.X instead of 1.4.X
1.2.2:
 It seems like to be fixed around connection pool.
 But there are 2 critical bugs !
    – Socket handle leak
    – Useless sleep
 However, This version is relatively stable        121



    as long as to fix these bugs
PHP client
We tried 1.4.4 and 1.2.2


https://github.com/crumbjp/Personal

 - mongo1.2.2.non-wait.patch
 - mongo1.2.2.sock-leak.patch




                                        122
PHP client




             123
Closing




          124
Closing
What’s MongoDB ?
It has very good READ performance.
    We can use mongo instead of memcached.
    if we can allow the limited write performance.
Die hard !
    MongoDB have high availability even if under a severe stress..
Can use easilly without deep consideration
    We can manage to do anything after getting start to use.
    Let’s forget any awkward trivial things that have bothered us.
         How to treat the huge data ?
         How to put in the cache system ?
         How to keep the availablity ?
         And so on ....                                       125
Closing
Keep in mind
Sharding is challenging...
   It’s last resort !
   It’s hard to operate. In particular, to maintain config-servers.
   [Mongos] is also difficult to keep alive.
   I want the way to failover Mongos.
Mongo is able to run on the poor environment but...
   You should ONLY put aside the large diskspace
Huge write is sensitive
   Adjust the oplog size carefully
Indexing function has been unfinished
   Cannot apply index online
                                                                  126
All right, Have fun !!



                         127
Thank you for your listening




                               128

Mais conteúdo relacionado

Mais procurados

IAP09 CUDA@MIT 6.963 - Lecture 04: CUDA Advanced #1 (Nicolas Pinto, MIT)
IAP09 CUDA@MIT 6.963 - Lecture 04: CUDA Advanced #1 (Nicolas Pinto, MIT)IAP09 CUDA@MIT 6.963 - Lecture 04: CUDA Advanced #1 (Nicolas Pinto, MIT)
IAP09 CUDA@MIT 6.963 - Lecture 04: CUDA Advanced #1 (Nicolas Pinto, MIT)npinto
 
Introduction to Tokyo Products
Introduction to Tokyo ProductsIntroduction to Tokyo Products
Introduction to Tokyo ProductsMikio Hirabayashi
 
DSL - Domain Specific Languages, Chapter 4, Internal DSL
DSL - Domain Specific Languages,  Chapter 4, Internal DSLDSL - Domain Specific Languages,  Chapter 4, Internal DSL
DSL - Domain Specific Languages, Chapter 4, Internal DSLHiro Yoshioka
 
GeoServer presentation @ Italian GFOSS day 2008
GeoServer presentation @ Italian GFOSS day 2008GeoServer presentation @ Italian GFOSS day 2008
GeoServer presentation @ Italian GFOSS day 2008GeoSolutions
 
Processing massive amount of data with Map Reduce using Apache Hadoop - Indi...
Processing massive amount of data with Map Reduce using Apache Hadoop  - Indi...Processing massive amount of data with Map Reduce using Apache Hadoop  - Indi...
Processing massive amount of data with Map Reduce using Apache Hadoop - Indi...IndicThreads
 
From Java code to Java heap: Understanding and optimizing your application's ...
From Java code to Java heap: Understanding and optimizing your application's ...From Java code to Java heap: Understanding and optimizing your application's ...
From Java code to Java heap: Understanding and optimizing your application's ...Chris Bailey
 
Akiban Technologies: Renormalize
Akiban Technologies: RenormalizeAkiban Technologies: Renormalize
Akiban Technologies: RenormalizeAriel Weil
 
DaStor/Cassandra report for CDR solution
DaStor/Cassandra report for CDR solutionDaStor/Cassandra report for CDR solution
DaStor/Cassandra report for CDR solutionSchubert Zhang
 
Pycvf
PycvfPycvf
Pycvftranx
 
Mobile Mapping Spatial Database Framework
Mobile Mapping Spatial Database FrameworkMobile Mapping Spatial Database Framework
Mobile Mapping Spatial Database FrameworkConor Mc Elhinney
 
OpenDremel's Metaxa Architecture
OpenDremel's Metaxa ArchitectureOpenDremel's Metaxa Architecture
OpenDremel's Metaxa ArchitectureCamuel Gilyadov
 
Hanborq Optimizations on Hadoop MapReduce
Hanborq Optimizations on Hadoop MapReduceHanborq Optimizations on Hadoop MapReduce
Hanborq Optimizations on Hadoop MapReduceHanborq Inc.
 
Beyond Map/Reduce: Getting Creative With Parallel Processing
Beyond Map/Reduce: Getting Creative With Parallel ProcessingBeyond Map/Reduce: Getting Creative With Parallel Processing
Beyond Map/Reduce: Getting Creative With Parallel ProcessingEd Kohlwey
 
Rapid JCR applications development with Sling
Rapid JCR applications development with SlingRapid JCR applications development with Sling
Rapid JCR applications development with SlingBertrand Delacretaz
 
GfossDAY2011 GeoServer Presentation
GfossDAY2011 GeoServer PresentationGfossDAY2011 GeoServer Presentation
GfossDAY2011 GeoServer PresentationGeoSolutions
 
NoSQL @ CodeMash 2010
NoSQL @ CodeMash 2010NoSQL @ CodeMash 2010
NoSQL @ CodeMash 2010Ben Scofield
 

Mais procurados (18)

Kyotoproducts
KyotoproductsKyotoproducts
Kyotoproducts
 
IAP09 CUDA@MIT 6.963 - Lecture 04: CUDA Advanced #1 (Nicolas Pinto, MIT)
IAP09 CUDA@MIT 6.963 - Lecture 04: CUDA Advanced #1 (Nicolas Pinto, MIT)IAP09 CUDA@MIT 6.963 - Lecture 04: CUDA Advanced #1 (Nicolas Pinto, MIT)
IAP09 CUDA@MIT 6.963 - Lecture 04: CUDA Advanced #1 (Nicolas Pinto, MIT)
 
Introduction to Tokyo Products
Introduction to Tokyo ProductsIntroduction to Tokyo Products
Introduction to Tokyo Products
 
DSL - Domain Specific Languages, Chapter 4, Internal DSL
DSL - Domain Specific Languages,  Chapter 4, Internal DSLDSL - Domain Specific Languages,  Chapter 4, Internal DSL
DSL - Domain Specific Languages, Chapter 4, Internal DSL
 
GeoServer presentation @ Italian GFOSS day 2008
GeoServer presentation @ Italian GFOSS day 2008GeoServer presentation @ Italian GFOSS day 2008
GeoServer presentation @ Italian GFOSS day 2008
 
Processing massive amount of data with Map Reduce using Apache Hadoop - Indi...
Processing massive amount of data with Map Reduce using Apache Hadoop  - Indi...Processing massive amount of data with Map Reduce using Apache Hadoop  - Indi...
Processing massive amount of data with Map Reduce using Apache Hadoop - Indi...
 
Spark and shark
Spark and sharkSpark and shark
Spark and shark
 
From Java code to Java heap: Understanding and optimizing your application's ...
From Java code to Java heap: Understanding and optimizing your application's ...From Java code to Java heap: Understanding and optimizing your application's ...
From Java code to Java heap: Understanding and optimizing your application's ...
 
Akiban Technologies: Renormalize
Akiban Technologies: RenormalizeAkiban Technologies: Renormalize
Akiban Technologies: Renormalize
 
DaStor/Cassandra report for CDR solution
DaStor/Cassandra report for CDR solutionDaStor/Cassandra report for CDR solution
DaStor/Cassandra report for CDR solution
 
Pycvf
PycvfPycvf
Pycvf
 
Mobile Mapping Spatial Database Framework
Mobile Mapping Spatial Database FrameworkMobile Mapping Spatial Database Framework
Mobile Mapping Spatial Database Framework
 
OpenDremel's Metaxa Architecture
OpenDremel's Metaxa ArchitectureOpenDremel's Metaxa Architecture
OpenDremel's Metaxa Architecture
 
Hanborq Optimizations on Hadoop MapReduce
Hanborq Optimizations on Hadoop MapReduceHanborq Optimizations on Hadoop MapReduce
Hanborq Optimizations on Hadoop MapReduce
 
Beyond Map/Reduce: Getting Creative With Parallel Processing
Beyond Map/Reduce: Getting Creative With Parallel ProcessingBeyond Map/Reduce: Getting Creative With Parallel Processing
Beyond Map/Reduce: Getting Creative With Parallel Processing
 
Rapid JCR applications development with Sling
Rapid JCR applications development with SlingRapid JCR applications development with Sling
Rapid JCR applications development with Sling
 
GfossDAY2011 GeoServer Presentation
GfossDAY2011 GeoServer PresentationGfossDAY2011 GeoServer Presentation
GfossDAY2011 GeoServer Presentation
 
NoSQL @ CodeMash 2010
NoSQL @ CodeMash 2010NoSQL @ CodeMash 2010
NoSQL @ CodeMash 2010
 

Semelhante a KVSの性能、RDBMSのインデックス、更にMapReduceを併せ持つAll-in-One NoSQL: MongoDB

Monogo db in-action
Monogo db in-actionMonogo db in-action
Monogo db in-actionChi Lee
 
High Performance Computing Infrastructure: Past, Present, and Future
High Performance Computing Infrastructure: Past, Present, and FutureHigh Performance Computing Infrastructure: Past, Present, and Future
High Performance Computing Infrastructure: Past, Present, and Futurekarl.barnes
 
BedCon 2013 - Java Persistenz-Frameworks für MongoDB
BedCon 2013 - Java Persistenz-Frameworks für MongoDBBedCon 2013 - Java Persistenz-Frameworks für MongoDB
BedCon 2013 - Java Persistenz-Frameworks für MongoDBTobias Trelle
 
Scalable XQuery Processing with Zorba on top of MongoDB
Scalable XQuery Processing with Zorba on top of MongoDBScalable XQuery Processing with Zorba on top of MongoDB
Scalable XQuery Processing with Zorba on top of MongoDBWilliam Candillon
 
Squeak DBX
Squeak DBXSqueak DBX
Squeak DBXESUG
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repositorynobby
 
MEW22 22nd Machine Evaluation Workshop Microsoft
MEW22 22nd Machine Evaluation Workshop MicrosoftMEW22 22nd Machine Evaluation Workshop Microsoft
MEW22 22nd Machine Evaluation Workshop MicrosoftLee Stott
 
Skiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in DSkiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in DMithun Hunsur
 
Performance Management in ‘Big Data’ Applications
Performance Management in ‘Big Data’ ApplicationsPerformance Management in ‘Big Data’ Applications
Performance Management in ‘Big Data’ ApplicationsMichael Kopp
 
Sql Performance Tuning For Developers
Sql Performance Tuning For DevelopersSql Performance Tuning For Developers
Sql Performance Tuning For Developerssqlserver.co.il
 
Bio bigdata
Bio bigdata Bio bigdata
Bio bigdata Mk Kim
 
Infrastructure for cloud_computing
Infrastructure for cloud_computingInfrastructure for cloud_computing
Infrastructure for cloud_computingJULIO GONZALEZ SANZ
 
Pivotal OSS meetup - MADlib and PivotalR
Pivotal OSS meetup - MADlib and PivotalRPivotal OSS meetup - MADlib and PivotalR
Pivotal OSS meetup - MADlib and PivotalRgo-pivotal
 
MADlib Architecture and Functional Demo on How to Use MADlib/PivotalR
MADlib Architecture and Functional Demo on How to Use MADlib/PivotalRMADlib Architecture and Functional Demo on How to Use MADlib/PivotalR
MADlib Architecture and Functional Demo on How to Use MADlib/PivotalRPivotalOpenSourceHub
 
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...Chester Chen
 
Introduction to Apache Spark
Introduction to Apache SparkIntroduction to Apache Spark
Introduction to Apache SparkVincent Poncet
 
Solving performance problems in MySQL without denormalization
Solving performance problems in MySQL without denormalizationSolving performance problems in MySQL without denormalization
Solving performance problems in MySQL without denormalizationdmcfarlane
 
Akiban Technologies: Renormalize
Akiban Technologies: RenormalizeAkiban Technologies: Renormalize
Akiban Technologies: RenormalizeAriel Weil
 

Semelhante a KVSの性能、RDBMSのインデックス、更にMapReduceを併せ持つAll-in-One NoSQL: MongoDB (20)

Monogo db in-action
Monogo db in-actionMonogo db in-action
Monogo db in-action
 
High Performance Computing Infrastructure: Past, Present, and Future
High Performance Computing Infrastructure: Past, Present, and FutureHigh Performance Computing Infrastructure: Past, Present, and Future
High Performance Computing Infrastructure: Past, Present, and Future
 
BedCon 2013 - Java Persistenz-Frameworks für MongoDB
BedCon 2013 - Java Persistenz-Frameworks für MongoDBBedCon 2013 - Java Persistenz-Frameworks für MongoDB
BedCon 2013 - Java Persistenz-Frameworks für MongoDB
 
NoSQL with MySQL
NoSQL with MySQLNoSQL with MySQL
NoSQL with MySQL
 
Scalable XQuery Processing with Zorba on top of MongoDB
Scalable XQuery Processing with Zorba on top of MongoDBScalable XQuery Processing with Zorba on top of MongoDB
Scalable XQuery Processing with Zorba on top of MongoDB
 
mongodb tutorial
mongodb tutorialmongodb tutorial
mongodb tutorial
 
Squeak DBX
Squeak DBXSqueak DBX
Squeak DBX
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repository
 
MEW22 22nd Machine Evaluation Workshop Microsoft
MEW22 22nd Machine Evaluation Workshop MicrosoftMEW22 22nd Machine Evaluation Workshop Microsoft
MEW22 22nd Machine Evaluation Workshop Microsoft
 
Skiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in DSkiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in D
 
Performance Management in ‘Big Data’ Applications
Performance Management in ‘Big Data’ ApplicationsPerformance Management in ‘Big Data’ Applications
Performance Management in ‘Big Data’ Applications
 
Sql Performance Tuning For Developers
Sql Performance Tuning For DevelopersSql Performance Tuning For Developers
Sql Performance Tuning For Developers
 
Bio bigdata
Bio bigdata Bio bigdata
Bio bigdata
 
Infrastructure for cloud_computing
Infrastructure for cloud_computingInfrastructure for cloud_computing
Infrastructure for cloud_computing
 
Pivotal OSS meetup - MADlib and PivotalR
Pivotal OSS meetup - MADlib and PivotalRPivotal OSS meetup - MADlib and PivotalR
Pivotal OSS meetup - MADlib and PivotalR
 
MADlib Architecture and Functional Demo on How to Use MADlib/PivotalR
MADlib Architecture and Functional Demo on How to Use MADlib/PivotalRMADlib Architecture and Functional Demo on How to Use MADlib/PivotalR
MADlib Architecture and Functional Demo on How to Use MADlib/PivotalR
 
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
 
Introduction to Apache Spark
Introduction to Apache SparkIntroduction to Apache Spark
Introduction to Apache Spark
 
Solving performance problems in MySQL without denormalization
Solving performance problems in MySQL without denormalizationSolving performance problems in MySQL without denormalization
Solving performance problems in MySQL without denormalization
 
Akiban Technologies: Renormalize
Akiban Technologies: RenormalizeAkiban Technologies: Renormalize
Akiban Technologies: Renormalize
 

Mais de Rakuten Group, Inc.

コードレビュー改善のためにJenkinsとIntelliJ IDEAのプラグインを自作してみた話
コードレビュー改善のためにJenkinsとIntelliJ IDEAのプラグインを自作してみた話コードレビュー改善のためにJenkinsとIntelliJ IDEAのプラグインを自作してみた話
コードレビュー改善のためにJenkinsとIntelliJ IDEAのプラグインを自作してみた話Rakuten Group, Inc.
 
楽天における安全な秘匿情報管理への道のり
楽天における安全な秘匿情報管理への道のり楽天における安全な秘匿情報管理への道のり
楽天における安全な秘匿情報管理への道のりRakuten Group, Inc.
 
Simple and Effective Knowledge-Driven Query Expansion for QA-Based Product At...
Simple and Effective Knowledge-Driven Query Expansion for QA-Based Product At...Simple and Effective Knowledge-Driven Query Expansion for QA-Based Product At...
Simple and Effective Knowledge-Driven Query Expansion for QA-Based Product At...Rakuten Group, Inc.
 
DataSkillCultureを浸透させる楽天の取り組み
DataSkillCultureを浸透させる楽天の取り組みDataSkillCultureを浸透させる楽天の取り組み
DataSkillCultureを浸透させる楽天の取り組みRakuten Group, Inc.
 
大規模なリアルタイム監視の導入と展開
大規模なリアルタイム監視の導入と展開大規模なリアルタイム監視の導入と展開
大規模なリアルタイム監視の導入と展開Rakuten Group, Inc.
 
楽天における大規模データベースの運用
楽天における大規模データベースの運用楽天における大規模データベースの運用
楽天における大規模データベースの運用Rakuten Group, Inc.
 
楽天サービスを支えるネットワークインフラストラクチャー
楽天サービスを支えるネットワークインフラストラクチャー楽天サービスを支えるネットワークインフラストラクチャー
楽天サービスを支えるネットワークインフラストラクチャーRakuten Group, Inc.
 
楽天の規模とクラウドプラットフォーム統括部の役割
楽天の規模とクラウドプラットフォーム統括部の役割楽天の規模とクラウドプラットフォーム統括部の役割
楽天の規模とクラウドプラットフォーム統括部の役割Rakuten Group, Inc.
 
Rakuten Services and Infrastructure Team.pdf
Rakuten Services and Infrastructure Team.pdfRakuten Services and Infrastructure Team.pdf
Rakuten Services and Infrastructure Team.pdfRakuten Group, Inc.
 
The Data Platform Administration Handling the 100 PB.pdf
The Data Platform Administration Handling the 100 PB.pdfThe Data Platform Administration Handling the 100 PB.pdf
The Data Platform Administration Handling the 100 PB.pdfRakuten Group, Inc.
 
Supporting Internal Customers as Technical Account Managers.pdf
Supporting Internal Customers as Technical Account Managers.pdfSupporting Internal Customers as Technical Account Managers.pdf
Supporting Internal Customers as Technical Account Managers.pdfRakuten Group, Inc.
 
Making Cloud Native CI_CD Services.pdf
Making Cloud Native CI_CD Services.pdfMaking Cloud Native CI_CD Services.pdf
Making Cloud Native CI_CD Services.pdfRakuten Group, Inc.
 
How We Defined Our Own Cloud.pdf
How We Defined Our Own Cloud.pdfHow We Defined Our Own Cloud.pdf
How We Defined Our Own Cloud.pdfRakuten Group, Inc.
 
Travel & Leisure Platform Department's tech info
Travel & Leisure Platform Department's tech infoTravel & Leisure Platform Department's tech info
Travel & Leisure Platform Department's tech infoRakuten Group, Inc.
 
Travel & Leisure Platform Department's tech info
Travel & Leisure Platform Department's tech infoTravel & Leisure Platform Department's tech info
Travel & Leisure Platform Department's tech infoRakuten Group, Inc.
 
Introduction of GORA API Group technology
Introduction of GORA API Group technologyIntroduction of GORA API Group technology
Introduction of GORA API Group technologyRakuten Group, Inc.
 
100PBを越えるデータプラットフォームの実情
100PBを越えるデータプラットフォームの実情100PBを越えるデータプラットフォームの実情
100PBを越えるデータプラットフォームの実情Rakuten Group, Inc.
 
社内エンジニアを支えるテクニカルアカウントマネージャー
社内エンジニアを支えるテクニカルアカウントマネージャー社内エンジニアを支えるテクニカルアカウントマネージャー
社内エンジニアを支えるテクニカルアカウントマネージャーRakuten Group, Inc.
 

Mais de Rakuten Group, Inc. (20)

コードレビュー改善のためにJenkinsとIntelliJ IDEAのプラグインを自作してみた話
コードレビュー改善のためにJenkinsとIntelliJ IDEAのプラグインを自作してみた話コードレビュー改善のためにJenkinsとIntelliJ IDEAのプラグインを自作してみた話
コードレビュー改善のためにJenkinsとIntelliJ IDEAのプラグインを自作してみた話
 
楽天における安全な秘匿情報管理への道のり
楽天における安全な秘匿情報管理への道のり楽天における安全な秘匿情報管理への道のり
楽天における安全な秘匿情報管理への道のり
 
What Makes Software Green?
What Makes Software Green?What Makes Software Green?
What Makes Software Green?
 
Simple and Effective Knowledge-Driven Query Expansion for QA-Based Product At...
Simple and Effective Knowledge-Driven Query Expansion for QA-Based Product At...Simple and Effective Knowledge-Driven Query Expansion for QA-Based Product At...
Simple and Effective Knowledge-Driven Query Expansion for QA-Based Product At...
 
DataSkillCultureを浸透させる楽天の取り組み
DataSkillCultureを浸透させる楽天の取り組みDataSkillCultureを浸透させる楽天の取り組み
DataSkillCultureを浸透させる楽天の取り組み
 
大規模なリアルタイム監視の導入と展開
大規模なリアルタイム監視の導入と展開大規模なリアルタイム監視の導入と展開
大規模なリアルタイム監視の導入と展開
 
楽天における大規模データベースの運用
楽天における大規模データベースの運用楽天における大規模データベースの運用
楽天における大規模データベースの運用
 
楽天サービスを支えるネットワークインフラストラクチャー
楽天サービスを支えるネットワークインフラストラクチャー楽天サービスを支えるネットワークインフラストラクチャー
楽天サービスを支えるネットワークインフラストラクチャー
 
楽天の規模とクラウドプラットフォーム統括部の役割
楽天の規模とクラウドプラットフォーム統括部の役割楽天の規模とクラウドプラットフォーム統括部の役割
楽天の規模とクラウドプラットフォーム統括部の役割
 
Rakuten Services and Infrastructure Team.pdf
Rakuten Services and Infrastructure Team.pdfRakuten Services and Infrastructure Team.pdf
Rakuten Services and Infrastructure Team.pdf
 
The Data Platform Administration Handling the 100 PB.pdf
The Data Platform Administration Handling the 100 PB.pdfThe Data Platform Administration Handling the 100 PB.pdf
The Data Platform Administration Handling the 100 PB.pdf
 
Supporting Internal Customers as Technical Account Managers.pdf
Supporting Internal Customers as Technical Account Managers.pdfSupporting Internal Customers as Technical Account Managers.pdf
Supporting Internal Customers as Technical Account Managers.pdf
 
Making Cloud Native CI_CD Services.pdf
Making Cloud Native CI_CD Services.pdfMaking Cloud Native CI_CD Services.pdf
Making Cloud Native CI_CD Services.pdf
 
How We Defined Our Own Cloud.pdf
How We Defined Our Own Cloud.pdfHow We Defined Our Own Cloud.pdf
How We Defined Our Own Cloud.pdf
 
Travel & Leisure Platform Department's tech info
Travel & Leisure Platform Department's tech infoTravel & Leisure Platform Department's tech info
Travel & Leisure Platform Department's tech info
 
Travel & Leisure Platform Department's tech info
Travel & Leisure Platform Department's tech infoTravel & Leisure Platform Department's tech info
Travel & Leisure Platform Department's tech info
 
OWASPTop10_Introduction
OWASPTop10_IntroductionOWASPTop10_Introduction
OWASPTop10_Introduction
 
Introduction of GORA API Group technology
Introduction of GORA API Group technologyIntroduction of GORA API Group technology
Introduction of GORA API Group technology
 
100PBを越えるデータプラットフォームの実情
100PBを越えるデータプラットフォームの実情100PBを越えるデータプラットフォームの実情
100PBを越えるデータプラットフォームの実情
 
社内エンジニアを支えるテクニカルアカウントマネージャー
社内エンジニアを支えるテクニカルアカウントマネージャー社内エンジニアを支えるテクニカルアカウントマネージャー
社内エンジニアを支えるテクニカルアカウントマネージャー
 

Último

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
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
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
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 2024Rafal Los
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
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 textsMaria Levchenko
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 

Último (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
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
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
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
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 

KVSの性能、RDBMSのインデックス、更にMapReduceを併せ持つAll-in-One NoSQL: MongoDB

  • 1. KVSの性能 RDBMSのインデックス 更にMapReduceを併せ持つ All-in-one NoSQL 楽 天 株 式 会 社 開 発 部 ア ーキ テ ク ト G 窪 田 博 昭 | 2 0 1 2 年 1 月 1 8 日 1
  • 2. Introduction Agenda • Introduction • How to use mongo on the news.infoseek.co.jp 2
  • 4. Who am I ? 4
  • 5. Introduction Profile Name: 窪田 博昭 Hiroaki Kubota Company: Rakuten Inc. Unit: ACT = Development Unit Architect Group Mail: hiroaki.kubota@mail.rakuten.com Hobby: Futsal , Golf Recent: My physical power has gradual declined... twitter : crumbjp github: crumbjp 5
  • 6. How to take advantages of the Mongo for the infoseek news 6
  • 7. For instance of our page 7
  • 10. Albatross structure Internet Request SessionDB LayoutDB Gat page layout MongoDB WEB ReplSet MongoDB ReplSet Get components Call APIs Memcache API Retrieve data ContentsDB MongoDB ReplSet 10
  • 11. Albatross structure Developer HTML markup LayoutDB Set page layout & Deploy API API settings CMS Batch servers MongoDB ReplSet Set components Insert Data API servers ContentsDB MongoDB ReplSet 11
  • 13. CMS 13
  • 14. CMS 14
  • 15. MapReduce 15
  • 16. MapReduce Our usage We have never used MapReduce as regular operation. However, We have used it for some irreglar case. • To search the invalid articles that should be removed because of someone’s mistakes... • To analyze the number of new articles posted a day. • To analyze the updated number an article. • We get start considering to use it regularly for the social data analyzing before long ... 16
  • 18. Structure We are using very poor machine (Virtual machine) !! • Intel(R) Xeon(R) CPU X5650 2.67GHz 1core!! • 4GB memory • 50 GB disk space ( iScsi ) • CentOS5.5 64bit • mongodb 1.8.0 – ReplicaSet 5 nodes ( + 1 Arbiter) – Oplog size 1.2GB – Average object size 1KB 18
  • 19. Structure Researched environment We’ve also researched following environments... • Virtual machine 1 core – 1kb data , 6,000,000 documents – 8kb data , 200,000 documents • Virtual machine 3 core – 1kb data , 6,000,000 documents – 8kb data , 200,000 documents • EC2 large instance – 2kb data , 60,000,000 documents. ( 100GB ) 19
  • 20. Performance I found the formula for making a rough estimation of QPS 1~8 kb documents + 1 unique index C = Number of CPU cores (Xeon 2.67 GHz) DD = Score of ‘dd’ command (byte/sec) S = Document size (byte) • GET qps = 4500 × C • SET(fsync) bytes/s = 0.05×DD ÷ S • SET(nsync) qps = 4500 BUT... have chance of STALE 20
  • 21. Performance example (on EC2 large) 21
  • 22. Performance example (on EC2 large) Environment and amount of data EC2 large instance – 2kb data , 60,000,000 documents. ( 100GB ) – 1 unique index Data-type { shop: 'someone', item: 'something', description: 'item explanation sentences...‘ } 22
  • 23. Performance example (on EC2 large) Batch insert (1000 documents) fsync=true 17906 sec (=289 min) (=3358 docs/sec) Ensure index (background=false) 4049 sec (=67min) 1. primary 2101 sec (=35min) 2. secondary 1948 sec (=32min) 23
  • 24. Performance example (on EC2 large) Add one node 5833sec (=97min) 1. Get files 2GB×48 2120 sec (=35min) 2. _id indexing 1406 sec (=23min) 3. uniq indexing 2251 sec (=38min) 4. other processes 56 sec (=1 min) 24
  • 25. Performance example (on EC2 large) Group by • Reduce by unique index & map & reduce – 368 msec db.data.group({ key: { shop: 1}, cond: { shop: 'someone' }, reduce: function ( o , p ) { p.sum++; }, initial: { sum: 0 } }); 25
  • 26. Performance example (on EC2 large) MapReduce • Scan all data 3116sec (=52min) – number of key = 39092 db.data.mapReduce( function(){ emit(this.shop,1); }, function(k,v){ var ret=0; v.forEach( function (value){ ret+=value; }); return ret; }, { query: {}, inline: 1, out: 'Tmp' } ); 26
  • 28. Indexing 28
  • 29. Index probrem Online indexisng is completely useless even if last version (2.0.2) Indexing is lock operation in default. Indexing operation can run as background on the primary. But... It CANNOT run as background on the secondary Moreover the all secondary’s indexing run at the same time !! Result in above... All slave freezes ! orz... 29
  • 30. Present indexing ( default ) 30
  • 31. Index probrem Present indexing ( default ) Primary save Batch Secondary Secondary Secondary Client Client Client Client Client 31
  • 32. Index probrem Present indexing ( default ) Primary ensureIndex Lock Cannot Batch write Indexing Secondary Secondary Secondary Client Client Client Client Client 32
  • 33. Index probrem Present indexing ( default ) Primary finished Batch Complete SYNC SYNC SYNC Secondary Secondary Secondary Lock Lock Lock Indexing Indexing Indexing Cannot read !! Client Client Client Client Client 33
  • 34. Index probrem Ideal indexing ( default ) Primary Batch Complete Secondary Secondary Secondary Complete Complete Complete Client Client Client Client Client 34
  • 35. Present indexing ( background ) 35
  • 36. Index probrem Present indexing ( background ) Primary save Batch Secondary Secondary Secondary Client Client Client Client Client 36
  • 37. Index probrem Present indexing ( background ) ensureIndex(background) Primary Slow down... Slowdown Batch Indexing Secondary Secondary Secondary Client Client Client Client Client 37
  • 38. Index probrem Present indexing ( background ) Primary finished Batch Complete SYNC SYNC SYNC Secondary Secondary Secondary Lock Lock Lock Indexing Indexing Indexing Cannot read !! Client Client Client Client Client 38
  • 39. Index probrem Present indexing ( background ) Primary finished Batch Background Complete don’t work indexing SYNC SYNC SYNC Secondary Secondary Secondary on the Lock secondaries Lock Lock Indexing Indexing Indexing Cannot read !! Client Client Client Client Client 39
  • 40. Index probrem Present indexing ( background ) Primary finished Batch Complete SYNC SYNC SYNC Secondary Secondary Secondary Lock Lock Lock Indexing Indexing Indexing Cannot read !! Client Client Client Client Client 40
  • 41. Index probrem Ideal indexing ( background ) Primary Batch Complete Secondary Secondary Secondary Complete Complete Complete Client Client Client Client Client 41
  • 43. Index probrem Accoding to mongodb.org this probrem will fix in 2.1.0 But not released formally. So I checked out the source code up to date. Certainlly it’ll be fixed ! Moreover it sounds like it’ll run as foreground when slave status isn’t SECONDARY (it means RECOVERING ) 43
  • 44. Index probrem Probable 2.1.X indexing Primary save Batch Secondary Secondary Secondary Client Client Client Client Client 44
  • 45. Index probrem Probable 2.1.X indexing ensureIndex(background) Primary Slow down... Slowdown Batch Indexing Secondary Secondary Secondary Client Client Client Client Client 45
  • 46. Index probrem Probable 2.1.X indexing Primary finished Batch Complete SYNC SYNC SYNC Secondary Secondary Secondary Slowdown Slowdown Slowdown Indexing Indexing Indexing Slow down... Client Client Client Client Client 46
  • 47. Index probrem Probable 2.1.X indexing Primary Batch Complete Secondary Secondary Secondary Complete Complete Complete Client Client Client Client Client 47
  • 48. Index probrem Background indexing 2.1.X But I think it’s not enough. I think it can be fatal for the system that the all secondaries slowdown at the same time !! So... 48
  • 50. Index probrem Ideal indexing Primary save Batch Secondary Secondary Secondary Client Client Client Client Client 50
  • 51. Index probrem Ideal indexing ensureIndex(background) Primary Slow down... Slowdown Batch Indexing Secondary Secondary Secondary Client Client Client Client Client 51
  • 52. Index probrem Ideal indexing Primary finished Batch Complete ensureIndex Recovering Secondary Secondary Indexing Client Client Client Client Client 52
  • 53. Index probrem Ideal indexing Primary Batch Complete ensureIndex Secondary Recovering Secondary Complete Indexing Client Client Client Client Client 53
  • 54. Index probrem Ideal indexing Primary Batch Complete ensureIndex Secondary Secondary Recovering Complete Complete Indexing Client Client Client Client Client 54
  • 55. Index probrem Ideal indexing Primary Batch Complete Secondary Secondary Secondary Complete Complete Complete Client Client Client Client Client 55
  • 56. Index probrem But ... I easilly guess it’s difficult to apply for current Oplog It would be great if I can operate indexing manually at each secondaries 56
  • 57. I suggest Manual indexing 57
  • 58. Index probrem Manual indexing Primary save Batch Secondary Secondary Secondary Client Client Client Client Client 58
  • 59. Index probrem Manual indexing Primary ensureIndex(manual,background) Slow down... Slowdown Batch Indexing Secondary Secondary Secondary Client Client Client Client Client 59
  • 60. Index probrem Manual indexing Primary finished Batch Complete Secondary Secondary Secondary Client Client Client Client Client 60
  • 61. Index probrem Manual indexing Primary finished Batch Complete Secondary Secondary Secondary The secondaries don’t sync automatically Client Client Client Client Client 61
  • 62. Index probrem Manual indexing Primary finished Batch Complete Secondary Secondary Secondary Client Client Client Client Client 62
  • 63. Index probrem Manual indexing Primary Batch Complete ensureIndex(manual) Recovering Secondary Secondary Indexing Client Client Client Client Client 63
  • 64. Index probrem Manual indexing Primary Batch Complete ensureIndex(manual) Secondary Recovering Secondary Complete Indexing Client Client Client Client Client 64
  • 65. Index probrem Manual indexing Primary Batch Complete ensureIndex(manual,background) Secondary Secondary Secondary Slowdown Complete Complete Indexing Client Client Client Client Client 65
  • 66. Index probrem Manual indexing Primary Batch Complete It needs to support ensureIndex(manual,background) background operation Secondary Secondary Secondary Slowdown Complete Complete Indexing Just in case,if the ReplSet has only one Secondary Client Client Client Client Client 66
  • 67. Index probrem Manual indexing Primary Batch Complete ensureIndex(manual,background) Secondary Secondary Secondary Slowdown Complete Complete Indexing Client Client Client Client Client 67
  • 68. Index probrem Manual indexing Primary Batch Complete Secondary Secondary Secondary Complete Complete Complete Client Client Client Client Client 68
  • 69. That’s all about Indexing problem 69
  • 70. Struggle to control the sync 70
  • 71. STALE 71
  • 72. Unknown log & Out of control the ReplSet We often suffered from going out of control the Secondaries... • Secondaries change status repeatedly in a moment between Secondary and Recovering (1.8.0) • Then we found the strange line in the log... [rsSync] replSet error RS102 too stale to catch up 72
  • 73. What’s Stale ? stale [stéil] (レベル:社会人必須 ) powered by goo.ne.jp • 〈食品・飲料などが〉新鮮でない(⇔fresh); • 気の抜けた, 〈コーヒーが〉香りの抜けた, • 〈パンが〉ひからびた, 堅くなった, • 〈空気・臭(にお)いなどが〉むっとする, • いやな臭いのする 73
  • 74. What’s Stale ? stale [stéil] (レベル:社会人必須 ) powered by goo.ne.jp • 〈食品・飲料などが〉新鮮でない(⇔fresh); • 気の抜けた, 〈コーヒーが〉香りの抜けた, • 〈パンが〉ひからびた, 堅くなった, • 〈空気・臭(にお)いなどが〉むっとする, • いやな臭いのする どうも非常によろしくないらしい・・・ 74
  • 75. Mechanizm of being stale 75
  • 76. ReplicaSet Client mongod mongod Database Oplog Database Oplog Primary Secondary 76
  • 78. ReplicaSet Client mongod mongod Database Oplog Database Oplog Primary Secondary 78
  • 79. Insert & Replication 1 A Client Insert mongod mongod Insert A A Database Oplog Database Oplog Primary Secondary 79
  • 80. Insert & Replication 1 Client Sync Insert A Insert A A A Database Oplog Database Oplog Primary Secondary 80
  • 82. Stale Client mongod mongod Insert A Insert A A A Database Oplog Database Oplog Primary Secondary 82
  • 83. Insert & Replication 2 B Client Insert Insert B B Insert A Insert A A A Database Oplog Database Oplog Primary Secondary 83
  • 84. Insert & Replication 2 C Client Insert Insert C C Insert B B Insert A Insert A A A Database Oplog Database Oplog Primary Secondary 84
  • 85. Insert & Replication 2 A Client Update Update A Insert C C Insert B B Insert A Insert A A A Database Oplog Database Oplog Primary Secondary 85
  • 86. Insert & Replication 2 Client Check Oplog Update A Insert C C Insert B B Insert A Insert A A A Database Oplog Database Oplog Primary Secondary 86
  • 87. Insert & Replication 2 Client Sync Update A Update A Insert C Insert C C Insert B C Insert B B Insert A B Insert A A A Database Oplog Database Oplog Primary Secondary 87
  • 89. Stale Client mongod mongod Insert A Insert A A A Database Oplog Database Oplog Primary Secondary 89
  • 90. Stale B Client Insert Insert B B Insert A Insert A A A Database Oplog Database Oplog Primary Secondary 90
  • 91. Stale C Client Insert Insert C C Insert B B Insert A Insert A A A Database Oplog Database Oplog Primary Secondary 91
  • 92. Stale A Client Update Update A Insert C C Insert B B Insert A Insert A A A Database Oplog Database Oplog Primary Secondary 92
  • 93. Stale C Client Update Update C Update A C Insert C B Insert B Insert A A Insert A A Database Oplog Database Oplog Primary Secondary 93
  • 94. Stale D Client Insert Insert D D Update C C Update A B Insert C Insert A A Insert B A Database Insert A Database Oplog Primary Secondary 94
  • 95. Stale Client [Inset A] not found !! Check Oplog Insert D D Update C C Update A B Insert C Insert A A Insert B A Database Insert A Database Oplog Primary Secondary 95
  • 96. Stale Client [Inset A] not found !! Check Oplog It cannot get infomation about [Insert B]. Insert D D Update C C Update A So cannot sync !! B Insert C Insert A A Insert B A It’s called STALE Database Insert A Database Oplog Primary Recovering 96
  • 97. Stale We have to understand the importance of adjusting oplog size We can specify the oplog size as one of the command line option Only at the first time per the dbpath that is also specified as a command line. Also we cannot change the oplog size without clearing the dbpath. Be careful ! 97
  • 98. Replication (Join as a new node) 98
  • 99. InitialSync Client mongod Insert D D Update C C Update A B Insert C A Database Oplog Primary 99
  • 100. InitialSync Client mongod mongod Insert D D Update C C Update A B Insert C A Database Oplog Database Oplog Primary Startup 100
  • 101. InitialSync Client Get last Oplog Insert D D Update C C Update A B Insert C Insert D A Database Oplog Database Oplog Primary Recovering 101
  • 102. InitialSync D Client C B A Cloning DB Insert D D Update C C Update A B Insert C Insert D A Database Oplog Database Oplog Primary Recovering 102
  • 103. InitialSync D Client C B A Cloning DB Insert D D Update C C Update A B Insert C Insert D A A Database Oplog Database Oplog Primary Recovering 103
  • 104. InitialSync E D Client Insert C B A Cloning DB E Insert E D Insert D C Update C B B Update A Insert D A A Insert C Database Oplog Database Oplog Primary Recovering 104
  • 105. InitialSync B Client Update Cloning DB complete E Update B D Insert E D C Insert D C B Update C B Insert D A Update A A Database Oplog Database Oplog Primary Recovering 105
  • 106. InitialSync Client Check Oplog E Update B D Insert E D C Insert D C B Update C B Insert D A A Database Oplog Database Oplog Primary Recovering 106
  • 107. InitialSync Client Sync E Update B E D Insert E D Update B C Insert D C Insert E B Update C B Insert D A A Database Oplog Database Oplog Primary Secondary 107
  • 108. Additional infomation From source code. ( I’ve never examed these... ) Secondary will try to sync from other Secondaries when it cannot reach the Primary or might be stale against the Primary. There is a bit of chance that sync problem not occured if the secondary has old Oplog or larger Oplog space than Primary 108
  • 109. Sync from another secondary Client Insert D Insert D D Update C D Update C C Update A C Update A B Insert C Insert A B Insert C A Insert B A A Insert B Database Insert A Database Oplog Database Insert A Primary Secondary Secondary 109
  • 110. Sync from another secondary Client [Inset A] not found !! Check Oplog Insert D Insert D D Update C D Update C C Update A C Update A B Insert C Insert A B Insert C A Insert B A A Insert B Database Insert A Database Oplog Database Insert A Primary Secondary Secondary 110
  • 111. Sync from another secondary Client But found at the other secondary So it’s able to sync Check Oplog Insert D Insert D D Update C D Update C C Update A C Update A B Insert C Insert A B Insert C A Insert B A A Insert B Database Insert A Database Oplog Database Insert A Primary Secondary Secondary 111
  • 112. Sync from the other secondary Client But found at the other secondary So it’s able to sync Sync Insert D Insert D Insert D D Update C D Update C D Update C C Update A C Update A C Update A B Insert C B Insert C B Insert C A Insert B A Insert B A Insert B Insert A Insert A Insert A Database Database Database Primary Secondary Secondary 112
  • 113. That’s all about sync 113
  • 114. Others... 114
  • 115. Disk space 115
  • 116. Disk space Data fragment into any DB files sparsely... We met the unfavorable circumstance in our DBs This circumstance appears at some of our collections around 3 months after we launched the services db.ourcol.storageSize() = 16200727264 (15GB) db.ourcol.totalSize() = 16200809184 db.ourcol.totalIndexSize() = 81920 db.outcol.dataSize() = 2032300 (2MB) What’s happen to them !! 116
  • 117. Disk space Data fragment into any DB files sparsely... It’s seems like to be caused by the specific operation that insert , update and delete over and over. Anyway we have to shrink the using disk space regularly just like PostgreSQL’s vacume. But how to do it ? 117
  • 118. Disk space Shrink the using disk spaces MongoDB offers some functions for this case. But couldn’t use in our case ! repairdatabase: Only runable on the Primary. It needs long time and BLOCK all operations !! compact: Only runable on the Secondary. Zero-fill the blank space instead of shrink disk spaces. So cannot shrink... 118
  • 119. Disk space Our measurements For temporary collection: To issue drop-command regularly. For other collections: 1. Get rid of one secondary from the ReplSet. 2. Shut down this. 3. Remove all DB files. 4. Join to the ReplSet. 5. Do these operations one after another. 6. Step down the Primary. (Change Primary node) 7. At last, do 1 – 4 operations on prior Primary. 119
  • 120. PHP client 120
  • 121. PHP client We tried 1.4.4 and 1.2.2 1.4.4: There is some critical bugs around connection pool. We struggled to invalidate the broken connection. I think, you should use 1.2.X instead of 1.4.X 1.2.2: It seems like to be fixed around connection pool. But there are 2 critical bugs ! – Socket handle leak – Useless sleep However, This version is relatively stable 121 as long as to fix these bugs
  • 122. PHP client We tried 1.4.4 and 1.2.2 https://github.com/crumbjp/Personal - mongo1.2.2.non-wait.patch - mongo1.2.2.sock-leak.patch 122
  • 123. PHP client 123
  • 124. Closing 124
  • 125. Closing What’s MongoDB ? It has very good READ performance. We can use mongo instead of memcached. if we can allow the limited write performance. Die hard ! MongoDB have high availability even if under a severe stress.. Can use easilly without deep consideration We can manage to do anything after getting start to use. Let’s forget any awkward trivial things that have bothered us. How to treat the huge data ? How to put in the cache system ? How to keep the availablity ? And so on .... 125
  • 126. Closing Keep in mind Sharding is challenging... It’s last resort ! It’s hard to operate. In particular, to maintain config-servers. [Mongos] is also difficult to keep alive. I want the way to failover Mongos. Mongo is able to run on the poor environment but... You should ONLY put aside the large diskspace Huge write is sensitive Adjust the oplog size carefully Indexing function has been unfinished Cannot apply index online 126
  • 127. All right, Have fun !! 127
  • 128. Thank you for your listening 128