Web App for Containers + MySQLでコンテナ対応したRailsアプリを作ろう!Yoichi Kawasaki
?
Web App for Containers は、アプリスタックのホストに Docker コンテナーを使用するため皆さんが今Linux上で利用しているOSSベースのアプリもアプリスタックごとDockerコンテナ化することでそのまま Web App for Containersで利用することができます。本ウェビナーでは簡単なMySQL + Ruby on Rails アプリ を題材に、アプリをコンテナ化し Web App for Containersにデプロイするまでの一連の流れを解説し、CIツールを使った継続的なデプロイ方法についてご紹介します。今回、AzureのフルマネージドMySQLサービスであるAzure DB for MySQLを利用して完全マネージドな環境でのアプリ実行を実現します。
Nuxt.jsを使ったPWA対応アプリの開発を公開
※ 株式会社GIGでは毎月社内勉強会を実施しています
GIG inc.
Good is good.
We provide opportunities to the SEKAI by fusing technology and ideas.
テクノロジーとクリエイティブでセカイをより良くする。小さなチームからスタートした多くの先人達が、世界をより豊かなモノに変革してきました。通信、UX、デバイス、技術の変化と共に世界はまだまだ加速度的に変わります。
Good is good. いいものはいい。GIGは、関わったユーザーやクライアントが前に進める“きっかけ”をつくりつづけます。
■ お問い合せ
https://giginc.co.jp/contact/
This document summarizes new features and improvements in MySQL 8.0. Key highlights include utf8mb4 becoming the default character set to support Unicode 9.0, performance improvements for utf8mb4 of up to 1800%, continued enhancements to JSON support including new functions, expanded GIS functionality including spatial reference system support, and new functions for working with UUIDs and bitwise operations. It also provides a brief history of MySQL and outlines performance improvements seen in benchmarks between MySQL versions.
This document summarizes benchmarks of MySQL multi-thread slave performance using different numbers of slave_parallel_workers threads on Oracle Cloud MySQL instances. It finds that using 16 threads provides the best performance, processing queries faster and keeping the slave less behind the master compared to lower thread counts. CPU usage is also lower with 16 threads even though more threads are used.
6. History of MySQL Cluster ”NDB”
90年代後期
Ericsson (Alzato) にて設計/開発
2003年
MySQL ABが NDB Cluster
ProjectをEricssonから引き継ぎ
開発 (MySQL 4.1)
2008年
SunがNDB Cluster Projectを引き継
ぎ開発(MySQL 5.1/Cluster 6.x~ )
2010年
OracleがNDB Cluster Projectを引き 継ぎ
開発(MySQL 5.1 / Cluster 7.x~)
Original design paper:
Design and Modelling of a Parallel Data Server for Telecom Application
MySQL Clusterの基礎となっている技術は、通信機器ベンダのエリクソンで携帯通信網の加入者
データベース向けに開発されたEricsson Network Data Base(NDB)と呼ばれていた技術が起源
Changes in MySQL 5.0.9 (2005-07-15)
Changes in MySQL 5.0.8 (Not released)
Changes in MySQL 5.0.7 (2005-06-10)
11. Data Nodeの拡張(例)
SMALL Medium Large
例) Max 200M QPM and
20M UPM.
例) Max 600M QPM and
55M UPM.
例) Max 1100M QPM and
110M UPM
Data nodeは最大48台まで増設可能 (Node IDは、1~48を使用)
→ ノードを増やすことで、処理とデータの分散を行うので負荷を分散する事が可能
例) 100GB/Node 例) 100GB/2Group=50GB/Node 例) 100GB/4Group=25GB/Node
17. NoSQL & SQL Access to MySQL Cluster data
Ndbcluster (NDB)
18. 本日は時間も限られているので,ClusterJ
にフォーカスして説明させて頂きます。
Memcachedに関しては,次のセッションで
ご確認下さい。
【参考】
概要: MySQL Cluster API Developer Guide
Java: 4.2.1. Getting, Installing, and Setting Up MySQL Cluster Connector for Java
Node.JS: Using JavaScript and Node.js with MySQL Cluster – First steps
MySQL NoSQL Connector for node.js
Memcached: Chapter 6. ndbmemcache—Memcache API for MySQL Cluster
NDB API: Chapter 2. The NDB API
JPA: 4.2.3. Using JPA with MySQL Cluster
19. ? ドメイン?オブジェクト?モデル
– Java API
– 高パフォーマンス、低レイテンシ
– 豊富な機能
– ClusterJ
? ClusterJの上位レイヤーとしてJPA インターフェース
– JPA準拠 (Persistence API)
? OpenJPA のプラグインとして実装
– 可能な場合はClusterJを使用、
いくつかの処理はJDBC経由に迂回する。
– 全体としてJDBC単独よりも高速化を狙う
– Javaアプリ開発者にとってより扱いやすく
– WebアプリでのMySQL Cluster利用を簡素化
NoSQL: Connector for Java (ClusterJ/JPA)
clusterj: Required for building MySQL Cluster with ClusterJ support.
openjpa: Required for building MySQL Cluster with ClusterJPA support.
20. NoSQL: Connector for Java (ClusterJ/JPA)
参照: http://dev.mysql.com/doc/ndbapi/en/mccj.htmlJTie: framework for mapping any C++ API to Java
24. デモ用スクリプト(トランザクション処理)
? トランザクションを明示することも可能
– begin()
– commit()
– rollback()
? トランザクションのロールバックを指示することも可能
– setRollbackOnly()
– getRollbackOnly()
※ これらの関数が使用されない場合、それぞれの処理が単一トランザクションとして扱われる。
Transaction: There is one transaction per session at any point in time. By default, each operation
(query, insert, update, or delete) is run under a new transaction.
[Annotation]
Employee.class
Employee.java
[Application]
Main.class
Main.java
[Connection]
clusterj.properties
ここでは、パフォーマンスを
考慮して、トランザクションを
1つにまとめ、データベースに
1回で書き込まれるようにし
ています。
25. デモ内容
ClusterJによるデータ処理
~ NoSQL処理確認~
1. データINSERT処理 (1件)
2. データ更新処理 (1件)
3. データINSERT LOOP処理(100件)
4. データ削除処理 (全件)
※NoSQLにて処理したデータをSQLコマンドにて並行して確認。(各処理後)
※ndbinfo.memory_per_fragmentからデータ分散状況確認。(3でデータを投入後)
※SQL側の処理が無い事を、Generalログにて確認。(最後)
MySQL Cluster Data Nodes
Data Layer
Apps Apps Apps Apps
JPA
Cluster JPA
JDBC Cluster J
MySQL JNI
NDB API (C++)