SlideShare une entreprise Scribd logo
1  sur  107
MySQL       NoSQL
            NoSQL


MySQL Casual Talks #2
•   id: oinume (   :   )
•   id: oinume (   :   )

•   2010   3
•   id: oinume (   :   )

•   2010   3

•
•   id: oinume (     :   )

•   2010   3

•
•              SQL           MySQL
•   id: oinume (     :   )

•   2010   3

•
•              SQL             MySQL

•   ver 3.23                 MySQL
• MySQL   NoSQL(   )
• MySQL   NoSQL(   )

•                  MySQL
• MySQL NoSQL( )
•             MySQL

• NoSQL(KVS)
• MySQL NoSQL( )
•             MySQL

• NoSQL(KVS)
• NoSQL(KVS)
•   Fusion-IO
•   Fusion-IO

•           (Java)
•    Fusion-IO

•            (Java)

•   MySQL
•        Fusion-IO

•                   (Java)

•       MySQL

    •      Oracle
•        Fusion-IO

•                   (Java)

•       MySQL

    •      Oracle

•
•
•
•   2009 2
•
•   2009 2

•            800   ↑ (2011   7 )
•
•   2009 2

•            800   ↑ (2011   7 )

•
•
•   2009 2

•            800   ↑ (2011   7 )

•
    •
•
•   2009 2

•            800   ↑ (2011   7 )

•
    •
    •
•
•   2009 2

•            800      ↑ (2011   7 )

•
    •
    •
    •   (          ) ← NEW
Browser


          Web x 35


                        Memcached x 4 MySQL x 6
                                       with FIO


          Socket x 70
request



Browser


                    Web x 35


                                  Memcached x 4 MySQL x 6
                                                 with FIO


                    Socket x 70
request



Browser
           swf


                    Web x 35


                                  Memcached x 4 MySQL x 6
                                                 with FIO


                    Socket x 70
request



Browser
           swf


                    Web x 35


                                  Memcached x 4 MySQL x 6
                                                 with FIO


                    Socket x 70
request



Browser
           swf


                    Web x 35

            TCP Socket


                                   Memcached x 4 MySQL x 6
                                                  with FIO


                     Socket x 70
request



Browser
           swf


                    Web x 35

            TCP Socket


                                   Memcached x 4 MySQL x 6
                                                  with FIO


                     Socket x 70   Java
request



Browser
           swf


                    Web x 35

            TCP Socket


                                   Memcached x 4 MySQL x 6
                                                  with FIO


                     Socket x 70   Java
request



Browser
           swf


                    Web x 35

            TCP Socket


                                   Memcached x 4 MySQL x 6
                                                  with FIO


                     Socket x 70   Java
request



Browser
           swf


                    Web x 35

            TCP Socket


                                   Memcached x 4 MySQL x 6
                                                  with FIO


                     Socket x 70   Java
•   : 2.1Gbps
•     : 2.1Gbps

•   : 100,000
•               : 2.1Gbps

•            : 100,000

• Web: 36,000 req / s
•                : 2.1Gbps

•             : 100,000

• Web: 36,000 req / s
• Socket: 160,000 req / s
•                : 2.1Gbps

•             : 100,000

• Web: 36,000 req / s
• Socket: 160,000 req / s
• Database: 52000 qps (read: 40000, write: 12000)
MySQL
MySQL
MySQL
•   RDBMS
MySQL
•   RDBMS

    •           KVS + MySQL
MySQL
•   RDBMS

    •              KVS + MySQL



    •   KVS      MySQL
MySQL
•   RDBMS

    •                     KVS + MySQL



    •      KVS          MySQL

•   IndexPersister              MySQL   KVS
IndexPersister ?
IndexPersister

•                      Java      MySQL



• key / value
•                      SQL

•
DDL
CREATE TABLE `user` (
   `id` varbinary(255) NOT NULL,
   `data` longblob NOT NULL,
   PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
Java
@Persistable("user")
public class User {
  @IndexKey
  @Store(index=0)
  public int getUserId() {
      return userId;
  }

    @Store(index=1)
    public String getNickname() {
         return nickname;
    }
    ....
}
Java

                          Java
  @Persistable("user")
  public class User {
    @IndexKey
    @Store(index=0)
    public int getUserId() {
        return userId;
    }

       @Store(index=1)
       public String getNickname() {
            return nickname;
       }
       ....
  }
Java

                          Java
  @Persistable("user")
  public class User {
    @IndexKey
    @Store(index=0)
    public int getUserId() {
        return userId;
    }

       @Store(index=1)
       public String getNickname() {
            return nickname;
       }
       ....
  }
Java

                          Java
  @Persistable("user")
  public class User {
    @IndexKey
    @Store(index=0)
    public int getUserId() {
                                        DB
        return userId;
    }                                  index=0 0


       @Store(index=1)
       public String getNickname() {
            return nickname;
       }
       ....
  }
select hex(id), hex(data) from user
 order by id limit 1 ¥G

hex(id) : 00000001
hex(data):
0700000006000000060103000000020000000E02000B7
97573616B752D3030303600000019020016E38286E38
186E38195E3818F36E58FB7E381A7E38199000000030
1010100000003010101FFFFFFFF
load - 1

       ID: 1

User user = persister.load(1, User.class);
String nickname = user.getNickname();
...
fetch -
                             10

IndexQuery query = IndexQuery.all();
query.limit(10);
List<User> users =
   persister.fetch(query, User.class);
for (User user : users) ...
fetch -                                      (2)

      ID:2

User user = persister.load(2, User.class);
IndexQuery query =
  IndexQuery.startWith(new IndexValue(user.getUserId()));
List<UserItem> userItems =
   persister.fetch(query, UserItem.class);
fetch -                                                (2)
@Persistable("user_item")
public class UserItem {                       userId, itemId
  @IndexKey
  public IndexKey getKey() {
        KeyCreator.toValue(userId, itemId);
  }
  @Store(index=0)
  public int getUserId() {
        return userId;
  }
  @Store(index=1)
  public int getItemId() {
       return itemId;
  }
  ....
}
fetch -                     (2)

          userId   itemId
            1        1
            1        2
            1        3
            2       10
            2       20
fetch -                                     (2)
User user = persister.load(2, User.class);
IndexQuery query =
  IndexQuery.startWith(new IndexValue(user.getUserId()));
List<UserItem> userItems =
   persister.fetch(query, UserItem.class);

◆       SQL
select id, data from user_item
 where id >= {v1} and id < {v2}
   v1: 00000002
   v2: 00000003
• count
• exists
• remove
• save (insert ... on duplicate key update)
•   MySQL   slow query
•   MySQL   slow query

•
•   MySQL   slow query

•
•                        slow query
•   MySQL   slow query

•
•                        slow query

•               Java
•   MySQL   slow query

•
•                        slow query

•               Java

•
•   load
•          load

    •   MySQL     context switch
•             load

    •   MySQL               context switch

    •   select ... where id in (...)
•                 load

    •       MySQL               context switch

    •       select ... where id in (...)



•       1                                  fetch (   )
•                 load

    •       MySQL               context switch

    •       select ... where id in (...)



•       1                                  fetch (   )

    •       key          Column
•                 load

    •       MySQL               context switch

    •       select ... where id in (...)



•       1                                  fetch (   )

    •       key          Column

    •
•                 load

    •       MySQL               context switch

    •       select ... where id in (...)



•       1                                  fetch (          )

    •       key          Column

    •
    •                     1      fetch               1000
MySQL   Key Value Store
KVS
KVS
•   SQL
KVS
•        SQL

    •   JOIN
KVS
•           SQL

    •   JOIN

    •   (         )INDEX
KVS
•           SQL

    •   JOIN

    •   (             )INDEX

    •   (         )
KVS
•             SQL

    •     JOIN

    •     (             )INDEX

    •     (         )

•       ALTER TABLE
KVS
•             SQL

    •     JOIN

    •     (             )INDEX

    •     (         )

•       ALTER TABLE

    •
KVS
•             SQL

    •     JOIN

    •     (             )INDEX

    •     (         )

•       ALTER TABLE

    •
    •
KVS
•             SQL

    •     JOIN

    •     (             )INDEX

    •     (         )

•       ALTER TABLE

    •
    •
•       mongoDB           KVS
KVS
•             SQL

    •     JOIN

    •     (             )INDEX

    •     (         )

•       ALTER TABLE

    •
    •
•       mongoDB            KVS

    •                   Ameba Pico mongoDB
•   Column
•       Column

    •
•       Column

    •
    •            Column
•       Column

    •
    •            Column

•
•       Column

    •
    •            Column

•
    •
•                Column

    •
    •                     Column

•
    •
•       Column       (ALTER TABLE)
•                  Column

    •
    •                        Column

•
    •
•       Column          (ALTER TABLE)

    •    short -> int                   Column
MySQLでNoSQL - アメーバピグでのNoSQLの実例
MySQLでNoSQL - アメーバピグでのNoSQLの実例
MySQLでNoSQL - アメーバピグでのNoSQLの実例

Contenu connexe

Tendances

MongoDB @ Frankfurt NoSql User Group
MongoDB @  Frankfurt NoSql User GroupMongoDB @  Frankfurt NoSql User Group
MongoDB @ Frankfurt NoSql User Group
Chris Harris
 

Tendances (20)

2001: JNDI Its all in the Context
2001:  JNDI Its all in the Context2001:  JNDI Its all in the Context
2001: JNDI Its all in the Context
 
Sequel
SequelSequel
Sequel
 
Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my! Datacon LA - MySQL without the SQL - Oh my!
Datacon LA - MySQL without the SQL - Oh my!
 
Security in Android Applications / Александр Смирнов (RedMadRobot)
Security in Android Applications / Александр Смирнов (RedMadRobot)Security in Android Applications / Александр Смирнов (RedMadRobot)
Security in Android Applications / Александр Смирнов (RedMadRobot)
 
MySQL JSON Functions
MySQL JSON FunctionsMySQL JSON Functions
MySQL JSON Functions
 
Hidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-PersistenceHidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-Persistence
 
MongoDB @ Frankfurt NoSql User Group
MongoDB @  Frankfurt NoSql User GroupMongoDB @  Frankfurt NoSql User Group
MongoDB @ Frankfurt NoSql User Group
 
Jndi
JndiJndi
Jndi
 
MongoDB .local Munich 2019: New Encryption Capabilities in MongoDB 4.2: A Dee...
MongoDB .local Munich 2019: New Encryption Capabilities in MongoDB 4.2: A Dee...MongoDB .local Munich 2019: New Encryption Capabilities in MongoDB 4.2: A Dee...
MongoDB .local Munich 2019: New Encryption Capabilities in MongoDB 4.2: A Dee...
 
Json within a relational database
Json within a relational databaseJson within a relational database
Json within a relational database
 
Spring.io
Spring.ioSpring.io
Spring.io
 
Php &amp; my sql - how do pdo, mysq-li, and x devapi do what they do
Php &amp; my sql  - how do pdo, mysq-li, and x devapi do what they doPhp &amp; my sql  - how do pdo, mysq-li, and x devapi do what they do
Php &amp; my sql - how do pdo, mysq-li, and x devapi do what they do
 
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptJavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
 
MySQL 8.0 Operational Changes
MySQL 8.0 Operational ChangesMySQL 8.0 Operational Changes
MySQL 8.0 Operational Changes
 
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
 
More mastering the art of indexing
More mastering the art of indexingMore mastering the art of indexing
More mastering the art of indexing
 
Zend Framework 1 + Doctrine 2
Zend Framework 1 + Doctrine 2Zend Framework 1 + Doctrine 2
Zend Framework 1 + Doctrine 2
 
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
 
Webinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev TeamsWebinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev Teams
 
SQL? NoSQL? NewSQL?!? What's a Java developer to do? - PhillyETE 2012
SQL? NoSQL? NewSQL?!? What's a Java developer to do? - PhillyETE 2012SQL? NoSQL? NewSQL?!? What's a Java developer to do? - PhillyETE 2012
SQL? NoSQL? NewSQL?!? What's a Java developer to do? - PhillyETE 2012
 

Similaire à MySQLでNoSQL - アメーバピグでのNoSQLの実例

iloug2015.Mysql.for.oracle.dba.V2
iloug2015.Mysql.for.oracle.dba.V2iloug2015.Mysql.for.oracle.dba.V2
iloug2015.Mysql.for.oracle.dba.V2
Baruch Osoveskiy
 
豆瓣技术架构的发展历程
豆瓣技术架构的发展历程豆瓣技术架构的发展历程
豆瓣技术架构的发展历程
George Ang
 
豆瓣 Qcon2009 Beijing
豆瓣 Qcon2009 Beijing豆瓣 Qcon2009 Beijing
豆瓣 Qcon2009 Beijing
yiditushe
 

Similaire à MySQLでNoSQL - アメーバピグでのNoSQLの実例 (20)

iloug2015.Mysql.for.oracle.dba.V2
iloug2015.Mysql.for.oracle.dba.V2iloug2015.Mysql.for.oracle.dba.V2
iloug2015.Mysql.for.oracle.dba.V2
 
Mla2011 final draft
Mla2011 final draftMla2011 final draft
Mla2011 final draft
 
Squeak DBX
Squeak DBXSqueak DBX
Squeak DBX
 
20141011 mastering mysqlnd
20141011 mastering mysqlnd20141011 mastering mysqlnd
20141011 mastering mysqlnd
 
20171104 hk-py con-mysql-documentstore_v1
20171104 hk-py con-mysql-documentstore_v120171104 hk-py con-mysql-documentstore_v1
20171104 hk-py con-mysql-documentstore_v1
 
Spring & Hibernate
Spring & HibernateSpring & Hibernate
Spring & Hibernate
 
PythonDatabaseAPI -Presentation for Database
PythonDatabaseAPI -Presentation for DatabasePythonDatabaseAPI -Presentation for Database
PythonDatabaseAPI -Presentation for Database
 
Icinga 2009 at OSMC
Icinga 2009 at OSMCIcinga 2009 at OSMC
Icinga 2009 at OSMC
 
DjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling DisqusDjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling Disqus
 
豆瓣技术架构的发展历程
豆瓣技术架构的发展历程豆瓣技术架构的发展历程
豆瓣技术架构的发展历程
 
豆瓣 Qcon2009 Beijing
豆瓣 Qcon2009 Beijing豆瓣 Qcon2009 Beijing
豆瓣 Qcon2009 Beijing
 
Jakarta EE 8 on JDK17
Jakarta EE 8 on JDK17Jakarta EE 8 on JDK17
Jakarta EE 8 on JDK17
 
MySQL Ecosystem in 2020
MySQL Ecosystem in 2020MySQL Ecosystem in 2020
MySQL Ecosystem in 2020
 
MySQL Shell: the daily tool for devs and admins. By Vittorio Cioe.
MySQL Shell: the daily tool for devs and admins. By Vittorio Cioe.MySQL Shell: the daily tool for devs and admins. By Vittorio Cioe.
MySQL Shell: the daily tool for devs and admins. By Vittorio Cioe.
 
Play Framework and Activator
Play Framework and ActivatorPlay Framework and Activator
Play Framework and Activator
 
MySQL Shell - The Best MySQL DBA Tool
MySQL Shell - The Best MySQL DBA ToolMySQL Shell - The Best MySQL DBA Tool
MySQL Shell - The Best MySQL DBA Tool
 
Develop Python Applications with MySQL Connector/Python
Develop Python Applications with MySQL Connector/PythonDevelop Python Applications with MySQL Connector/Python
Develop Python Applications with MySQL Connector/Python
 
Python在豆瓣的应用
Python在豆瓣的应用Python在豆瓣的应用
Python在豆瓣的应用
 
MySQL Day Paris 2016 - State Of The Dolphin
MySQL Day Paris 2016 - State Of The DolphinMySQL Day Paris 2016 - State Of The Dolphin
MySQL Day Paris 2016 - State Of The Dolphin
 
Python and the MySQL Document Store
Python and the MySQL Document StorePython and the MySQL Document Store
Python and the MySQL Document Store
 

Plus de Kazuhiro Oinuma (6)

カジュアルに本番データを開発環境に入れる #mysqlcasual
カジュアルに本番データを開発環境に入れる #mysqlcasualカジュアルに本番データを開発環境に入れる #mysqlcasual
カジュアルに本番データを開発環境に入れる #mysqlcasual
 
Vagrant環境のAnsibleを速くしたい
Vagrant環境のAnsibleを速くしたいVagrant環境のAnsibleを速くしたい
Vagrant環境のAnsibleを速くしたい
 
運用に効く!JVMオプション三選
運用に効く!JVMオプション三選運用に効く!JVMオプション三選
運用に効く!JVMオプション三選
 
コードはナマモノ 腐らせないために今までやってきたこと
コードはナマモノ 腐らせないために今までやってきたことコードはナマモノ 腐らせないために今までやってきたこと
コードはナマモノ 腐らせないために今までやってきたこと
 
20120524 english lt2_pythontoolsfortesting
20120524 english lt2_pythontoolsfortesting20120524 english lt2_pythontoolsfortesting
20120524 english lt2_pythontoolsfortesting
 
rsyncのちょっとイイ話
rsyncのちょっとイイ話rsyncのちょっとイイ話
rsyncのちょっとイイ話
 

Dernier

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Dernier (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
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
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 

MySQLでNoSQL - アメーバピグでのNoSQLの実例

  • 1. MySQL NoSQL NoSQL MySQL Casual Talks #2
  • 2.
  • 3.
  • 4.
  • 5. id: oinume ( : )
  • 6. id: oinume ( : ) • 2010 3
  • 7. id: oinume ( : ) • 2010 3 •
  • 8. id: oinume ( : ) • 2010 3 • • SQL MySQL
  • 9. id: oinume ( : ) • 2010 3 • • SQL MySQL • ver 3.23 MySQL
  • 10.
  • 11. • MySQL NoSQL( )
  • 12. • MySQL NoSQL( ) • MySQL
  • 13. • MySQL NoSQL( ) • MySQL • NoSQL(KVS)
  • 14. • MySQL NoSQL( ) • MySQL • NoSQL(KVS) • NoSQL(KVS)
  • 15.
  • 16.
  • 17. Fusion-IO
  • 18. Fusion-IO • (Java)
  • 19. Fusion-IO • (Java) • MySQL
  • 20. Fusion-IO • (Java) • MySQL • Oracle
  • 21. Fusion-IO • (Java) • MySQL • Oracle •
  • 22.
  • 23.
  • 24.
  • 25. • • 2009 2
  • 26. • • 2009 2 • 800 ↑ (2011 7 )
  • 27. • • 2009 2 • 800 ↑ (2011 7 ) •
  • 28. • • 2009 2 • 800 ↑ (2011 7 ) • •
  • 29. • • 2009 2 • 800 ↑ (2011 7 ) • • •
  • 30. • • 2009 2 • 800 ↑ (2011 7 ) • • • • ( ) ← NEW
  • 31.
  • 32. Browser Web x 35 Memcached x 4 MySQL x 6 with FIO Socket x 70
  • 33. request Browser Web x 35 Memcached x 4 MySQL x 6 with FIO Socket x 70
  • 34. request Browser swf Web x 35 Memcached x 4 MySQL x 6 with FIO Socket x 70
  • 35. request Browser swf Web x 35 Memcached x 4 MySQL x 6 with FIO Socket x 70
  • 36. request Browser swf Web x 35 TCP Socket Memcached x 4 MySQL x 6 with FIO Socket x 70
  • 37. request Browser swf Web x 35 TCP Socket Memcached x 4 MySQL x 6 with FIO Socket x 70 Java
  • 38. request Browser swf Web x 35 TCP Socket Memcached x 4 MySQL x 6 with FIO Socket x 70 Java
  • 39. request Browser swf Web x 35 TCP Socket Memcached x 4 MySQL x 6 with FIO Socket x 70 Java
  • 40. request Browser swf Web x 35 TCP Socket Memcached x 4 MySQL x 6 with FIO Socket x 70 Java
  • 41.
  • 42.
  • 43. : 2.1Gbps
  • 44. : 2.1Gbps • : 100,000
  • 45. : 2.1Gbps • : 100,000 • Web: 36,000 req / s
  • 46. : 2.1Gbps • : 100,000 • Web: 36,000 req / s • Socket: 160,000 req / s
  • 47. : 2.1Gbps • : 100,000 • Web: 36,000 req / s • Socket: 160,000 req / s • Database: 52000 qps (read: 40000, write: 12000)
  • 48. MySQL
  • 49. MySQL
  • 50. MySQL • RDBMS
  • 51. MySQL • RDBMS • KVS + MySQL
  • 52. MySQL • RDBMS • KVS + MySQL • KVS MySQL
  • 53. MySQL • RDBMS • KVS + MySQL • KVS MySQL • IndexPersister MySQL KVS
  • 55. IndexPersister • Java MySQL • key / value • SQL •
  • 56.
  • 57. DDL CREATE TABLE `user` ( `id` varbinary(255) NOT NULL, `data` longblob NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8
  • 58. Java @Persistable("user") public class User { @IndexKey @Store(index=0) public int getUserId() { return userId; } @Store(index=1) public String getNickname() { return nickname; } .... }
  • 59. Java Java @Persistable("user") public class User { @IndexKey @Store(index=0) public int getUserId() { return userId; } @Store(index=1) public String getNickname() { return nickname; } .... }
  • 60. Java Java @Persistable("user") public class User { @IndexKey @Store(index=0) public int getUserId() { return userId; } @Store(index=1) public String getNickname() { return nickname; } .... }
  • 61. Java Java @Persistable("user") public class User { @IndexKey @Store(index=0) public int getUserId() { DB return userId; } index=0 0 @Store(index=1) public String getNickname() { return nickname; } .... }
  • 62. select hex(id), hex(data) from user order by id limit 1 ¥G hex(id) : 00000001 hex(data): 0700000006000000060103000000020000000E02000B7 97573616B752D3030303600000019020016E38286E38 186E38195E3818F36E58FB7E381A7E38199000000030 1010100000003010101FFFFFFFF
  • 63.
  • 64. load - 1 ID: 1 User user = persister.load(1, User.class); String nickname = user.getNickname(); ...
  • 65. fetch - 10 IndexQuery query = IndexQuery.all(); query.limit(10); List<User> users = persister.fetch(query, User.class); for (User user : users) ...
  • 66. fetch - (2) ID:2 User user = persister.load(2, User.class); IndexQuery query = IndexQuery.startWith(new IndexValue(user.getUserId())); List<UserItem> userItems = persister.fetch(query, UserItem.class);
  • 67. fetch - (2) @Persistable("user_item") public class UserItem { userId, itemId @IndexKey public IndexKey getKey() { KeyCreator.toValue(userId, itemId); } @Store(index=0) public int getUserId() { return userId; } @Store(index=1) public int getItemId() { return itemId; } .... }
  • 68. fetch - (2) userId itemId 1 1 1 2 1 3 2 10 2 20
  • 69. fetch - (2) User user = persister.load(2, User.class); IndexQuery query = IndexQuery.startWith(new IndexValue(user.getUserId())); List<UserItem> userItems = persister.fetch(query, UserItem.class); ◆ SQL select id, data from user_item where id >= {v1} and id < {v2} v1: 00000002 v2: 00000003
  • 70. • count • exists • remove • save (insert ... on duplicate key update)
  • 71.
  • 72.
  • 73. MySQL slow query
  • 74. MySQL slow query •
  • 75. MySQL slow query • • slow query
  • 76. MySQL slow query • • slow query • Java
  • 77. MySQL slow query • • slow query • Java •
  • 78.
  • 79. load
  • 80. load • MySQL context switch
  • 81. load • MySQL context switch • select ... where id in (...)
  • 82. load • MySQL context switch • select ... where id in (...) • 1 fetch ( )
  • 83. load • MySQL context switch • select ... where id in (...) • 1 fetch ( ) • key Column
  • 84. load • MySQL context switch • select ... where id in (...) • 1 fetch ( ) • key Column •
  • 85. load • MySQL context switch • select ... where id in (...) • 1 fetch ( ) • key Column • • 1 fetch 1000
  • 86. MySQL Key Value Store
  • 87. KVS
  • 88. KVS • SQL
  • 89. KVS • SQL • JOIN
  • 90. KVS • SQL • JOIN • ( )INDEX
  • 91. KVS • SQL • JOIN • ( )INDEX • ( )
  • 92. KVS • SQL • JOIN • ( )INDEX • ( ) • ALTER TABLE
  • 93. KVS • SQL • JOIN • ( )INDEX • ( ) • ALTER TABLE •
  • 94. KVS • SQL • JOIN • ( )INDEX • ( ) • ALTER TABLE • •
  • 95. KVS • SQL • JOIN • ( )INDEX • ( ) • ALTER TABLE • • • mongoDB KVS
  • 96. KVS • SQL • JOIN • ( )INDEX • ( ) • ALTER TABLE • • • mongoDB KVS • Ameba Pico mongoDB
  • 97.
  • 98. Column
  • 99. Column •
  • 100. Column • • Column
  • 101. Column • • Column •
  • 102. Column • • Column • •
  • 103. Column • • Column • • • Column (ALTER TABLE)
  • 104. Column • • Column • • • Column (ALTER TABLE) • short -> int Column

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. \n
  90. \n
  91. \n
  92. \n
  93. \n
  94. \n