SQLFire Webinar

39
vFabric SQLFire Fast meets scalable in VMware's new distributed SQL database.

description

SQLFire is a memory-optimized distributed SQL database from VMware. SQLFire is built for applications that need higher speed and lower latency than traditional databases can offer, but also require strong support for querying and transactions. This webinar introduces the basics of SQLFire, including a discussion of why traditional databases are not scalable enough to deal with the demands of modern applications. I cover some of the extensions SQLFire makes to the SQL standard in order to be a truly horizontally-scalable SQL database. The demo presented with the webinar shows how SQLFire can transparently scale to processes requests faster. In the demo a number of inserts are made, but not before a complex validation processes is done on the data being inserted. As a result the inserts are very slow. With SQLFire though you can simply add or remove nodes at any time, so if you anticipate a period where you need more processing power you can add a node and process inserts faster. SQLFire is designed to be horizontally scalable in all features, so you can scale not only inserts but also queries, transactions, etc. Full source code for the demo is available (see the slides for details).

Transcript of SQLFire Webinar

Page 1: SQLFire Webinar

vFabric SQLFire

Fast meets scalable in VMware's new distributed SQL database.

Page 2: SQLFire Webinar

Speed Matters.

Users demand fast applications and fast websites.The database is the hardest thing to scale.

Page 3: SQLFire Webinar

• SQLFire is a memory-optimized, distributed SQL database.

• SQLFire satisfies modern application needs by adopting a more scalable design than traditional RDBMS.

• SQLFire focuses on Speed, Scale and SQL.

What Is SQLFire?

Page 4: SQLFire Webinar

Speed• Memory-optimized for

maximum speed and minimum latency.

SQLFire: Speed, Scale, SQL.Scale

• Horizontally scalable.• Add or remove nodes at

any time for more capacity or availability.

SQL• Familiar SQL interface.• SQL 92 compliant.• JDBC and ADO.NET

interfaces.

Page 5: SQLFire Webinar

• Memory Optimization– Latency is tracked to the millisecond.– Use memory to get an advantage.

• SQLFire can use disk too.– Data can be asynchronously persisted to disk.– Append-only logfile format for best update

performance.– Disaster prevention and for larger databases.

SQLFire Speed Through Memory Optimization.

Page 6: SQLFire Webinar

What’s Really Great About Memory?

Disk seeks are 100,000 times slower than memory reads!(10,000,000 ns = 10 ms)

Page 7: SQLFire Webinar

• Major online travel site.• Minimizing page load time a must.– Did all the usual tricks including minimizing server

round-trips, etc.• Required all data access to complete in less than

20ms – Always!• Selected a memory-optimized database from

VMware.

Who Needs That Kind Of Latency Anyway?

Page 8: SQLFire Webinar

The Things People Do For Speed.• Many architectures

for speeding up data have appeared lately.

• All stem from

• Many architectures have appeared to make data faster.– Memcached on top of SQL Databases.– Read-only slave nodes.– Clustering / RAC.– NoSQL.

• Clear need to overcome traditional database limitations.– Relational databases were not built to serve thousands (or

even hundreds) of users at once.– RDBMS were not built for the low latency users expect.

Page 9: SQLFire Webinar

Don’t Mask The Problem, Solve It!

SQLFireHorizontally Scalable

SQL Database

Memcache + SQL:Multi-data model

to overcome the DB.

Application Tier

Browser Tier

Application Tier

Browser Tier

Page 10: SQLFire Webinar

What Is Horizontal Scalability?• Software that makes

multiple computers appear as one system.

• Horizontal scale gives:– Better performance.– More capacity.– Higher availability.

Page 11: SQLFire Webinar

• SQLFire is a horizontally-scalable SQL Database.• SQLFire is horizontally scalable from the ground up.– Data inserts.– Key lookup.– Stored procedures / functions.– Joins.– Transactions.– More.

SQLFire Horizontal Scalability.

Page 12: SQLFire Webinar

• SQLFire syntax is based on the SQL-92 standard.• SQLFire extensions are to Data Definition

Language (DDL), e.g. CREATE TABLE.• SQLFire ships with JDBC and ADO.NET drivers.– Built-in, transparent high availability.

SQLFire and SQL.

Page 13: SQLFire Webinar

COMPARING SQLFIRE AND OTHER DATABASES

Page 14: SQLFire Webinar

• Traditional RDBMS: Too much focus on ACID consistency.• Traditional RDBMS: Too much contention for disk.

SQLFire Challenges Traditional DB Design, Not SQL.

Page 15: SQLFire Webinar

• Many new data models (NoSQL) are emerging– Key-value– Column family (inspired by Google BigTable)– Document– Graph

• Most focus on making model less rigid than SQL• Consistency model is not ACID

• Different tradeoffs for different goals

The database world is changing. A lot!

Low scale

STRICT – Full ACID (RDBMS)

High scale

Tunable Consistency

Very high scale

Eventual

Page 16: SQLFire Webinar

SQLFire At A Glance.

Page 17: SQLFire Webinar

Attribute SQLFire Other SQL DBs

DB Interface Standard SQL. Standard SQL.

Data ConsistencyTunable. Mix of eventual consistency and high consistency.

High consistency.

Transactions Supported. Very strong support.

Scaling Model Scale out, commodity servers. Scale up.

SQLFire Versus Other SQL Databases.

Page 18: SQLFire Webinar

Attribute NoSQL SQLFireDB Interface Idiosyncratic (i.e. each is custom). Standard SQL.

Querying Idiosyncratic or not present. SQL Queries.Data Consistency Tunable, most favor eventual

consistency.Tunable, favors high consistency.

Transactions Weak or not present. Linearly scalable transaction model.

Interface Design Designed for simplicity. Designed for compatibility.Data Model Wide variety of different models. Relational model.

Schema Flexibility Focus on extreme flexibility, dynamism.

SQL model, requires DB migrations, etc.

SQLFire Versus NoSQL.

Page 19: SQLFire Webinar

HANDS ON WITH SQLFIREIllustrating some of SQLFire’s key features.

Page 20: SQLFire Webinar

1

2

3

4

5

6

7

8

910

SQLFire Tables Are Replicated By Default. CREATE TABLE sales

(product_id int, store_id int,

price float);

SQLFire Node 1

SQLFire Node 2

Replica

Replica

sales

Best for small andfrequently accessed

data.

Page 21: SQLFire Webinar

1

2

3

4

5

6

7

8

910

Partitioned Tables Are Split Among Members. CREATE TABLE sales

(product_id int, store_id int,

price float)

PARTITION BY

COLUMN (product_id);

SQLFire Node 1

SQLFire Node 2

Replica

Replica

sales Partition 1

Partition 2Best for largedata sets.

Page 22: SQLFire Webinar

Type Purpose Example

Hash Partitioning (Default)

Built-in hashing algorithm splits data at random across available servers.

PARTITION BY COLUMN (customer_id);

ListManually divide data across servers based on discrete criteria.

PARTITION BY LIST (home_state) (VALUES (‘CA’, ‘WA’), VALUES (‘TX’, ‘OK’));

RangeManually divide data across servers based on continuous criteria.

PARTITION BY RANGE (date) (VALUES BETWEEN ‘2008-01-01’ AND ‘2008-12-31’, VALUES BETWEEN ‘2009-01-01’ AND ‘2009-12-30’);

ExpressionFully dynamic division of data based on function execution. Can use UDFs.

PARTITION BY (MONTH(date));

Types Of Partitioning In SQLFire.

Page 23: SQLFire Webinar

1

2

3

4

5

6

7

8

910

Redundancy Increases Availability. CREATE TABLE sales

(product_id int, store_id int,

price float)

PARTITION BY

COLUMN (product_id);

REDUNDANCY 1;

SQLFire Node 1

Partition 2*

SQLFire Node 2

Partition 1*

Replica

Replica

salesPartition 1

Partition 2All data is availableif Node 1 fails.

Page 24: SQLFire Webinar

1

2

3

4

5

6

7

8

910

Collocate Data For Fast Joins. CREATE TABLE sales

(product_id int, store_id int,

price float)

PARTITION BY

COLUMN (product_id);

COLOCATE WITH customers;

SQLFire Node 1

Customer 1 Sales

SQLFire Node 2

Customer 2 Sales

Replica

Replica

Customer 1

Customer 2SQLFire can jointables withoutnetwork hops.

C1

C2

Related data placedon the same node.

Page 25: SQLFire Webinar

1

2

3

4

5

6

7

8

910

Why Collocation Matters. -- Biggest customers in CA.

SELECT sum(value) AS total

FROM sales, customer

WHERE sales.customerid =

customer.id AND

customer.state = “CA”

ORDER BY total DESC;

SQLFire Node 1

Customer 1 Sales

SQLFire Node 2

Customer 2 Sales

Replica

Replica

Customer 1

Customer 2

Since we collocatedcustomers and salesthis query execute

independentlyon each node.

Result:The query scales

linearly!

Page 26: SQLFire Webinar

1

2

3

4

5

6

7

8

910

Scaling Functions and Stored Procedures. CALL maxSales

WITH RESULT PROCESSOR

maxSalesReducer

ON TABLE sales;

SQLFire uses data-aware routing to

route processing tothe data.

maxSales on local data

maxSales on local data

maxSalesReducer

Result Processorsgive map/reduce

functionality.

Page 27: SQLFire Webinar

• Server Groups:– Granular control of data placement or restrict data to certain servers.

• Disk persistence and overflow.– For additional availability and when using SQLFire as a primary

database.• Caching / Operational Data Store.• Transactions.• Indexes.• Much more!

Some SQLFire Features Not Discussed Include…

Scan Me To Learn MoreAbout These Features!

Page 28: SQLFire Webinar

DEMOSQLFire In Action

Page 29: SQLFire Webinar

SQLFIRE RELEASE DETAILS

Page 30: SQLFire Webinar

• SQLFire Professional 1.0:– Release: December 13, 2011.– Part of the vFabric Advanced suite. (Per VM)– Also available standalone. (Per CPU)– Limit of 2 connected nodes per database.

• SQLFire Enterprise 1.0:– Coming 1H 2012.– Unlimited nodes.– Optional SQLFire Enterprise WAN Upgrade for active/active global

databases.

SQLFire Releases.

Page 31: SQLFire Webinar

• Same database in multiple datacenters or the cloud.• Fully active-active with asynchronous replication.• Coming 1H 2012 with SQLFire Enterprise.

SQLFire WAN.

Page 32: SQLFire Webinar

• Beta available now on our community site.– http://tinyurl.com/SQLFire

• General availability December 2011.– vFabric Suite or standalone.– Free for development up to 3 nodes.

• Follow us on Twitter:– http://twitter.com/vfabricsqlfire

Download SQLFire Today!

Scan To Learn More

Page 33: SQLFire Webinar

QUESTIONS?

Page 34: SQLFire Webinar

DEMO DETAILS

Page 35: SQLFire Webinar

• 2 VMs.– ubuntu– livecd

• Schema:– Table called record

• threadid: int, value int• Each value is validated upon insert.• The validate constraint check is extremely CPU intensive.

• Client: 5 threads inserting simultaneously.• Total of 2500 records to be inserted.

Demo Details

Page 36: SQLFire Webinar

Demo State 1

validate (very slow!)

Insert Complete

Insert

Ubuntu(locator)

Ubuntu(database)

Page 37: SQLFire Webinar

CREATE TABLE record (threadid int, value int CONSTRAINT MY_CK CHECK (validate(value) = 1)) PARTITION BY COLUMN (threadid);

Note: The validate function takes a long time to run.

Create Table Code:

Page 38: SQLFire Webinar

Demo State 2

validate (very slow!)

Insert Complete

Insert

Ubuntu(locator)

Ubuntu(database)

validate (very slow!)

Insert Complete

livecd(database)

Note:No client change!