Technical Overview Technical Action Demo Technical Overview What

  • Slides: 23
Download presentation

概要 一、Technical Overview 二、Technical Action 三、Demo演示

概要 一、Technical Overview 二、Technical Action 三、Demo演示

Technical Overview What is Volt. DB? • It’s an open-source OLTP database that is

Technical Overview What is Volt. DB? • It’s an open-source OLTP database that is designed to run on a cluster. • It is an in-memory shared-nothing system. • Tables are partitioned across multiple servers in the cluster.

Technical Overview Volt. DB的性能(官方): Volt. DB is very scalable; it should scale to 120

Technical Overview Volt. DB的性能(官方): Volt. DB is very scalable; it should scale to 120 partitions, 39 servers, and 1. 6 million complex transactions per second at over 300 CPU cores, Volt. DB 宣称具备非常高的可伸缩性,超过 120 个分 区、39台服务器,可在 300 个 CPU 核心上每秒钟处理 160 万的复杂事务。 测试例子

Technical Action Volt. DB的运行要求:

Technical Action Volt. DB的运行要求:

Technical Action Volt. DB的安装: $ tar -zxvf voltdb-2. 1. tar. gz -C $HOME/ $

Technical Action Volt. DB的安装: $ tar -zxvf voltdb-2. 1. tar. gz -C $HOME/ $ sudo tar -zxvf voltdb-2. 1. tar. gz -C /opt $ cd /opt $ sudo mv voltdb-2. 1 voltdb

Technical Action Volt. DB Application step by step: • • • Defining the Database

Technical Action Volt. DB Application step by step: • • • Defining the Database Schema Writing the Stored Procedure for CRUD Writing the Client Application Creating the Project Definition Building the Application Run

Technical Action 分表字段: • 建表时的主键索引不一定是voltdb里的分表字段( Partitioning column)。 • 分表字段是根据业务,频率来确定的,确定的分表字段 需要在项目定义文件和存储过程文件中指明。 • @Proc. Info( single.

Technical Action 分表字段: • 建表时的主键索引不一定是voltdb里的分表字段( Partitioning column)。 • 分表字段是根据业务,频率来确定的,确定的分表字段 需要在项目定义文件和存储过程文件中指明。 • @Proc. Info( single. Partition = true, partition. Info = "Reservation. Flight. ID: 0" ) • <partition table="Reservation" column="Flight. ID">

Technical Action Replicated Tables: • Volt. DB里如果不在项目定义文件中特别指定一个表有分 表字段,则这个表默认被复制(Replicated)。 • 可以复制的表要满足的条件:Small, mostly read-only tables can

Technical Action Replicated Tables: • Volt. DB里如果不在项目定义文件中特别指定一个表有分 表字段,则这个表默认被复制(Replicated)。 • 可以复制的表要满足的条件:Small, mostly read-only tables can be replicated。

Technical Action Volt. DB stored procedure(一般形式): import org. voltdb. *; @Proc. Info( single. Partition

Technical Action Volt. DB stored procedure(一般形式): import org. voltdb. *; @Proc. Info( single. Partition = true|false, partition. Info = "Table-name. Column-name: 0" ) public class Procedure-name extends Volt. Procedure { // Declare SQL statements. . . public datatype run ( arguments ) throws Volt. Abort. Exception { // Body of the Stored Procedure. . . } }

Technical Action Default Procedures for Partitioned Tables: • • • 表名大写,存储过程名小写。 针对最常用的insert、select、update和delete。 Insert操作,参数按表结构定义的顺序排列。 Select和delete只要主键。

Technical Action Default Procedures for Partitioned Tables: • • • 表名大写,存储过程名小写。 针对最常用的insert、select、update和delete。 Insert操作,参数按表结构定义的顺序排列。 Select和delete只要主键。 Update操作,参数也要按表结构定义的顺序排列,主键要出现两次。 client. call. Procedure("HELLOWORLD. insert", "Howdy", "Earth", "American"); client. call. Procedure("HELLOWORLD. select“, "American"). get. Results(); client. call. Procedure("HELLOWORLD. update“, "Yo", "Biosphere", "American"); client. call. Procedure("HELLOWORLD. delete“, "American");

Technical Action Shortcut for Defining Simple Stored Procedures: <procedure class="procedures. simple. Count. Reservations"> <sql>SELECT

Technical Action Shortcut for Defining Simple Stored Procedures: <procedure class="procedures. simple. Count. Reservations"> <sql>SELECT COUNT(*) FROM RESERVATION</sql> </procedure> <procedure class="procedures. simple. Count. Children"> <sql>SELECT COUNT(*) FROM CUSTOMER WHERE AGE < 21</sql> </procedure> <procedure class="procedures. simple. My. Reservations. By. Trip"> <sql>SELECT R. RESERVEID, F. FLIGHTID, F. DEPARTTIME FROM RESERVATION AS R, FLIGHT AS F WHERE R. CUSTOMERID = ? AND R. FLIGHTID = F. FLIGHTID AND F. ORIGIN=? AND F. DESTINATION=? </sql></procedure>

Technical Action Volt. DB Tools: • 程模版生成脚本- Generate Script $ cd /opt/voltdb/tools $ python

Technical Action Volt. DB Tools: • 程模版生成脚本- Generate Script $ cd /opt/voltdb/tools $ python generate test $HOME/workspace/test • Volt. DB Studio • a browser-based tool • test, debug and optimize • a catalog viewer, an ad hoc SQL query pane, and a cluster monitor

Appendix Volt. DB的资源: • Visit http: //voltdb. com to… Download Volt. DB Get sample

Appendix Volt. DB的资源: • Visit http: //voltdb. com to… Download Volt. DB Get sample app code • Join the Volt. DB community Volt. DB user groups: www. meetup. com/voltdb Follow Volt. DB on Twitter @voltdb • 源码 https: //github. com/Volt. DB/