SlideShare a Scribd company logo
1 of 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の実例

More Related Content

What's hot

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 ContextRussell Castagnaro
 
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! Dave Stokes
 
Security in Android Applications / Александр Смирнов (RedMadRobot)
Security in Android Applications / Александр Смирнов (RedMadRobot)Security in Android Applications / Александр Смирнов (RedMadRobot)
Security in Android Applications / Александр Смирнов (RedMadRobot)Ontico
 
Hidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-PersistenceHidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-PersistenceSven Ruppert
 
MongoDB @ Frankfurt NoSql User Group
MongoDB @  Frankfurt NoSql User GroupMongoDB @  Frankfurt NoSql User Group
MongoDB @ Frankfurt NoSql User GroupChris Harris
 
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...MongoDB
 
Json within a relational database
Json within a relational databaseJson within a relational database
Json within a relational databaseDave Stokes
 
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 doDave Stokes
 
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 JavaScriptDave Stokes
 
MySQL 8.0 Operational Changes
MySQL 8.0 Operational ChangesMySQL 8.0 Operational Changes
MySQL 8.0 Operational ChangesDave Stokes
 
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.
Java/Scala Lab: Борис Трофимов - Обжигающая Big Data.GeeksLab Odessa
 
More mastering the art of indexing
More mastering the art of indexingMore mastering the art of indexing
More mastering the art of indexingYoshinori Matsunobu
 
Zend Framework 1 + Doctrine 2
Zend Framework 1 + Doctrine 2Zend Framework 1 + Doctrine 2
Zend Framework 1 + Doctrine 2Ralph Schindler
 
Mongo or Die: How MongoDB Powers Doodle or Die
Mongo or Die: How MongoDB Powers Doodle or DieMongo or Die: How MongoDB Powers Doodle or Die
Mongo or Die: How MongoDB Powers Doodle or DieAaron Silverman
 
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 TeamsMongoDB
 
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 2012Chris Richardson
 

What's hot (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
 

Similar to 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.V2Baruch Osoveskiy
 
Squeak DBX
Squeak DBXSqueak DBX
Squeak DBXESUG
 
20141011 mastering mysqlnd
20141011 mastering mysqlnd20141011 mastering mysqlnd
20141011 mastering mysqlnddo_aki
 
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_v1Ivan Ma
 
Spring & Hibernate
Spring & HibernateSpring & Hibernate
Spring & HibernateJiayun Zhou
 
PythonDatabaseAPI -Presentation for Database
PythonDatabaseAPI -Presentation for DatabasePythonDatabaseAPI -Presentation for Database
PythonDatabaseAPI -Presentation for Databasedharawagh9999
 
Icinga 2009 at OSMC
Icinga 2009 at OSMCIcinga 2009 at OSMC
Icinga 2009 at OSMCIcinga
 
DjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling DisqusDjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling Disquszeeg
 
豆瓣 Qcon2009 Beijing
豆瓣 Qcon2009 Beijing豆瓣 Qcon2009 Beijing
豆瓣 Qcon2009 Beijingyiditushe
 
豆瓣技术架构的发展历程
豆瓣技术架构的发展历程豆瓣技术架构的发展历程
豆瓣技术架构的发展历程George Ang
 
MySQL Ecosystem in 2020
MySQL Ecosystem in 2020MySQL Ecosystem in 2020
MySQL Ecosystem in 2020Alkin Tezuysal
 
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.Cloud Native Day Tel Aviv
 
Play Framework and Activator
Play Framework and ActivatorPlay Framework and Activator
Play Framework and ActivatorKevin Webber
 
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 ToolMiguel Araújo
 
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/PythonJesper Wisborg Krogh
 
Python在豆瓣的应用
Python在豆瓣的应用Python在豆瓣的应用
Python在豆瓣的应用Qiangning Hong
 
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 DolphinOlivier DASINI
 
Python and the MySQL Document Store
Python and the MySQL Document StorePython and the MySQL Document Store
Python and the MySQL Document StoreJesper Wisborg Krogh
 

Similar to 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
 

More from Kazuhiro Oinuma

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

More from 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のちょっとイイ話
 

Recently uploaded

Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
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
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
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
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 

Recently uploaded (20)

Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
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
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
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
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 

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

Editor's Notes

  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