Google Cloud Spanner Preview

22
Google Cloud Spanner Meetup 26-2-2017 Vadim Solovey //CTO (vadim@doit- intl.com)

Transcript of Google Cloud Spanner Preview

Page 1: Google Cloud Spanner Preview

Google Cloud Spanner Meetup 26-2-2017

Vadim Solovey //CTO ([email protected])

Page 2: Google Cloud Spanner Preview

DoIT International confidential │ Do not distribute

About us..

Vadim SoloveyCTO

Page 3: Google Cloud Spanner Preview

DoIT International confidential │ Do not distribute

Page 4: Google Cloud Spanner Preview

DoIT International confidential │ Do not distribute

Page 5: Google Cloud Spanner Preview

DoIT International confidential │ Do not distribute

Page 6: Google Cloud Spanner Preview

SQL?Strong consistency

Standard Query Language

ACID transactions

Horizontally scalable

Highly available

or No-SQL?

Page 7: Google Cloud Spanner Preview

Confidential + Proprietary

“NewSQL is a class of modern relational database management systems that seek to provide the same scalable performance of NoSQL systems for online transaction processing (OLTP) read-write workloads while still maintaining the ACID guarantees of a traditional database system. [...] Example systems in this category are Google Spanner …”

Source: https://en.wikipedia.org/wiki/NewSQL

Page 8: Google Cloud Spanner Preview

Confidential + Proprietary

It is impossible for a distributed computer system to simultaneously provide more than two out of three of the following guarantees: Consistency. Availability. Partition Tolerance.

CAP Theorem

Page 9: Google Cloud Spanner Preview

“Cloud Spanner is not just software. It is the union of software, hardware — in the form of atomic

clocks in Google’s data centers — and an incredibly robust network connecting their data centers

together. So it’s not just writing code. It’s a lot of investment and a lot of operational expertise that

Google excels at.”

Nick HeudeckerResearch Director, Gartner

Page 10: Google Cloud Spanner Preview

With Cloud Spanner you enjoy all the traditional benefits of a SQL database: ● ACID transactions● High Availability through

synchronous replication● Schemas (w/ changes without

downtime),● SQL Queries ● Scales Horizontally● Managed by Google SRE team

Cloud Spanner 101

Page 11: Google Cloud Spanner Preview

Best of Both Relational & NoSQLCloud Spanner Traditional Relational Traditional NoSQL

Schema ✓ Yes ✓ Yes X No

SQL ✓ Yes ✓ Yes X No

Consistency ✓ Strong ✓ Strong X Eventual

Availability ✓ High X Failover ✓ High

Scalability ✓ Horizontal X Vertical ✓ Horizontal

Replication ✓ Automatic ↻ Configurable ↻ Configurable

Page 12: Google Cloud Spanner Preview

Cloud StorageCloud BigtableCloud

DatastoreCloud SQL

Good for:Binary or object data

Such as:Images, Media serving, backups

Good for:Hierarchical, mobile, web

Such as:User profiles,Game State

Good for:Web frameworks

Such as:CMS, eCommerce

Good for:Heavy read + write, events,

Such as:AdTech, Financial, IoT

CloudMemorystore

Good for:Web/mobile apps, gaming

Such as:Game state, user sessions

EAP

Cloud Spanner

Beta

Good for:RDBMS+scale,HA, HTAP

Such as:User metadata,Ad/Fin/MarTech

BigQuery

Good for:Enterprise Data Warehouse

Such as:Analytics, Dashboards

In Memory Relational Non-Relational Object Warehouse

Cloud Database Portfolio

Page 13: Google Cloud Spanner Preview

PricingNo ops or I/O to provision

Storage auto-scales, no storage provisioning required

Nodes● $0.90 / hour / node (includes 3

replications)

Storage● SSD: $0.30 GB / month (includes

replication)

Network● Standard cross-region and Internet egress● Free: Ingress, egress within region

Page 14: Google Cloud Spanner Preview

Other solutions on the marketCloud Spanner Oracle AWS

AuroraAWS

DynamoDB

AzureDocumentD

BMongoDB Cassandra

Type Scale out relational RDBMS RDBMS Key-value Document Document Wide-column

Schema Yes Yes Yes No No No No

SQL Native Native Native No Limited No CQL

Consistency (Default) Strong (global) Strong

(datacenter)Strong(within AZ) Tunable Tunable Eventual Tunable

Availability99.99% *(multi-region: 5 9s)

User configured 99.99% Unspecified 99.99% Unspecified Unspecified

Data-layer Encryption Yes Yes Within

Region Client-side No Not by default Datastax

Scalability Horizontal within DC Vertical Horizontal Horizontal Horizontal Horizontal

ReplicationRegional(multi-region: 2017)

Datacenter Regional Multi-region Multi-region User

configuredUser configured

Managed Service Yes Yes Yes Yes YesAtlas3rd Party Cloud

3rd party

Page 15: Google Cloud Spanner Preview

TCO ComparisonsCloud Spanner

(regional replication)

Cloud SQL (HA)

Cloud Bigtable

(unreplicated)

AWS Aurora AWS DynamoDB

AzureDocumentDB

Resource-based Resource-based Resource-based 3Y RI Pricing On-Demand per-op per-op

Read-heavy workload (50GB storage)

$2,094 $2,226 $1,021 $973 $1,744 $2400 $1887

Mixed Workload (50GB storage)

$2,094 $2,226 $1,021 $973 $1,744 $4,398 $5,333

Page 16: Google Cloud Spanner Preview

InteractiongRPC and RESTful client libraries available:● Java● Python● Golang● NodeJS● Ruby (upcoming)● PHP (upcoming)

JDBC Driver is Available as well for limited legacy apps support.

Google Cloud CLI (work with instances, databases and run queries)

Page 17: Google Cloud Spanner Preview

Data Types & Data Definition Language

Data Types Available:● BOOL, INT64, FLOAT64, STRING( length ), BYTES( length ), DATE, TIMESTAMP● ARRAY of scalar types (no access to individual members, read or write the entire

array)

Use Cloud Spanner's Data Definition Language (DDL) to work with databases, tables and indexes● CREATE ● ALTER● DROP

Page 18: Google Cloud Spanner Preview

Expressions, Functions, and Operators

● CASTing i.e. CAST(x=1 AS STRING)● Aggregations, i.e. COUNT, MIN, MAX, AVG, BIT*, SUM● Mathematical, i.e. SQRT(X)● String, i.e. LENGTH(value) or SUBSTR(value, position[, length])● Array, i.e. ARRAY_LENGTH(array_expression)● Date/Time, i.e. DATE_DIFF(date_expression, date_expression, date_part)● Conditional, i.e. WHEN, CASE, IF, COALESCE

Page 19: Google Cloud Spanner Preview

Best Practices & Performance

● Each node can provide up to 10K QPS of reads / 2K QPS of 1KB writes and 2 TiB storage

● Minimum of 3 nodes recommended for production environments (min is one node)● Carefully choose a primary key (to avoid hotspots)

Page 20: Google Cloud Spanner Preview

Product Roadmap for 2017

● Multi-Regional replication● Dataflow | Pub Sub | BigQuery integrations● Local mock server● JSON support (repeated and nested fields)● Writes in SQL

Page 21: Google Cloud Spanner Preview

Spanner Resources

● Documentation: cloud.google.com/spanner/docs

● Podcast with Deepti Srivastava: goo.gl/tlGAx4

● Optimizing Schema Design for Cloud Spanner: https://goo.gl/4KG1hZ

● Spanner, TrueTime and the CAP Theorem - https://research.google.com/pubs/pub45855.html

● Whitepaper Explained: by Wilson Hsieh - youtube.com/watch?v=NthK17nbpYs

● The Life of Cloud Spanner Reads & Writes - https://goo.gl/vXK1r4

● Life of a Cloud Spanner Query - https://goo.gl/mCyTvW

Page 22: Google Cloud Spanner Preview

DEMO