You are on page 1of 32

SAP HANA DATABASE

Mihnea Andrei
SAP Products & Innovation HANA Platform July 8, 2014 Public
Agenda

SAP
SAP HANA DB Background
Architecture
Column Store & Compression
Snapshot Isolation
Outlook

© 2014 SAP AG or an SAP affiliate company. All rights reserved. Public 2


SAP
Who was SAP (before HANA)?

Sales Order Financial/Mgmt Business


Management Accounting Intelligence

Production Planning Talent Management

© 2014 SAP AG or an SAP affiliate company. All rights reserved. Public 4


74% of the world’s
transaction revenue
touches an SAP system.

© 2014 SAP AG or an SAP affiliate company. All rights reserved. 5


SAP
Business Applications – Database & Technology – Analytics – Cloud – Mobile

Annual revenue (IFRS) of € 16,82 billion

More than 253,500 customers in 188 countries

More than 66,500 employees – and locations in more than 130 countries

A 42-year history of innovation and growth as a true industry leader

© 2014 SAP AG or an SAP affiliate company. All rights reserved. Public 6


© 2014 SAP AG or an SAP affiliate company. All rights reserved. 7
Products & Innovation HANA Platform
California Campus – Worldwide

© 2014 SAP AG or an SAP affiliate company. All rights reserved. Public 8


SAP HANA DB Background
Why did we build HANA?
How Did the SAP Use Database Before HANA?

See “The SAP Transaction Model: Know Your Applications”, SIGMOD 2008 Industrial
Talk
 Database was mainly a dumb store …
– Retrieve/Store data (Open SQL, no stored procedures)
– Transaction commit, with locks held very briefly
– Operational utilities
 … because SAP kept the following in the application server:
– Application logic
– Business object-level locks
– Queued updates
– Data buffers
– Indexes

With the HANA platform, computation-intensive data-centric operations are moved to


the Database

© 2014 SAP AG or an SAP affiliate company. All rights reserved. Public 10


DRAM Price/GB

Year Price/GB
2013 $5.50
2010 $12.37
2005 $189
2000 $1,107
1995 $30,875
1990 $103,880
1985 $859,375
1980 $6,328,125

Source: http://www.statisticbrain.com/average-historic-price-of-ram/
© 2014 SAP AG or an SAP affiliate company. All rights reserved. Public 11
In-Memory Computing

CPU 4-8 sockets

Core Core 4-12 cores/CPU

L1 Cache L1 Cache 1 NS, 64K/core

L2 Cache L2 Cache 3 NS, 256k/core

L3 Cache 8 NS, >2M shared


Yes, DRAM is 125,000
times faster than disk, but
Main Memory 80 NS, TBs DRAM access is still 10-80
times slower than on-chip
SSD: 100K NS caches
Disk
HD: 10M NS
Using Intel Ivy Bridge for approximate values.
Actual numbers depends on specific hardware.

© 2014 SAP AG or an SAP affiliate company. All rights reserved. Public 12


Enterprise Workloads are Read Dominated

Workload in Enterprise Applications consists of:


 Mainly read queries (OLTP 83%, OLAP 94%)
 Many queries access large sets of data

100% 100%
Write: Write:
90 % Delete 90 % Delete
80 % Modification 80 % Modification
70 % Insert 70 % Insert
Workload

Workload
60 % 60 %
Read: Read:
50 % Range Select 50 % Select
40 % Table Scan 40 %
30 % Lookup 30 %
20 % 20 %
10 % 10 %
0 % 0 %
OLTP OLAP TPC-C

© 2014 SAP AG or an SAP affiliate company. All rights reserved. Public 13


Simplify Technology Stack with the SAP HANA
Platform

Insight to Action
Contextual. Real-time. Closed-loop.

Applications Analytics

SAP HANA Platform

© 2014 SAP AG or an SAP affiliate company. All rights reserved. Public 14


SAP HANA Database Background

BWA / BIA

Trex
Enterprise
Search
NewDB BW on Suite on HANA
/ HANA HANA HANA Platform

MaxDB

PTime

Sybase IQ/ASE/SA/RS/etc.

Ancient times 2000-2009 2010 2011 2012 now

© 2014 SAP AG or an SAP affiliate company. All rights reserved. Public 15


SAP HANA DB Architecture
SAP HANA DB Processes

© 2014 SAP AG or an SAP affiliate company. All rights reserved. Public 18


Business Applications

Connection and Session Management

SQL SQL Script MDX …

Authori- Calculation Engine


zation
Manager
Optimizer and Plan Generator
Trans-
action
Execution Engine
Manager

In-Memory Processing Engines


Metadata
Manager
Column Engine Row Engine Text Engine

Persistency Logging and Recovery Data Storage

© 2014 SAP AG or an SAP affiliate company. All rights reserved. 19


Distributed Share-Nothing In-Memory Computing

NewDB NewDB
Database Server Database Server
Execution Execution
Layer Layer
R R
NewDB
Database Server
In-Memory Stores In-Memory Stores
Execution
R R
Layer
R
Persistence Layer Persistence Layer
In-Memory Stores
R

Persistence Layer

© 2014 SAP AG or an SAP affiliate company. All rights reserved. Public 20


Column Store
& Compression
SAP HANA Technology
Hybrid Data Storage
SAP HANA Row Store SAP HANA Column Store
stores tables by row stores tables by column

Att1 Att2 Att3 Att4 Att5 Att1 Att2 Att3 Att4 Att5

Tuple 1 Tuple 1

Tuple 2 Tuple 2

Tuple 3 Tuple 3

Tuple n Tuple n

 Application often processes single records at once  Search and calculation on values of a few columns
 many selects and /or updates of single records  Big number of columns
 Application typically accesses the complete record  Big number of rows and columnar operations
 Columns contain mainly distinct values  aggregate, scan, etc.
 Aggregations and fast searching not required  High compression rates possible
 Small number of rows (e.g. configuration tables)  Most columns contain only few distinct values
© 2014 SAP AG or an SAP affiliate company. All rights reserved. Public 23
SAP HANA Technology
Dictionary Compression & N-bit Compression

Classical Row Store HANA Column Store

0 INTEL
0 A Dictionary for attribute/
Company Region Group 1 Siemens
[CHAR50] [CHAR30] [CHAR5] 2 SAP 1 B column „Group“
0 Europe
3 IBM 1 USA 2 C
INTEL USA A
0 1 0
Siemens Europe B 1 0 1 Index Vector
Stored in one memory chunk
Siemens Europe C 1 0 2 => data locality for fast scans
SAP Europe A 2 0 0

SAP Europe A 2 0 0

IBM USA A 3 1 0

© 2014 SAP AG or an SAP affiliate company. All rights reserved. Public 24


SAP HANA Technology
Compression with run length encoding

Classical Row Store HANA Column Store: HANA Column Store:


Difficult to compress Dictionary compressed Run length compressed*

0 INTEL 0 INTEL
1 Siemens 0 A 1 Siemens 0 A
Company Region Group
2 SAP 0 Europe 1 B 2 SAP 0 Europe 1 B
[CHAR50] [CHAR30] [CHAR5]
3 IBM 1 USA 2 C 3 IBM 1 USA 2 C
INTEL USA A 0 1 x „0“ 1 x „0“
0 1 1 x „1“
Siemens Europe B 1 0 1 2 x „1“ 4 x „0“ 1 x „1“

Siemens Europe C 1 0 2 2 x „2“ 1 x „1“ 1 x „2“

SAP Europe A 2 0 0 1 x „3“ 3 x „0“

SAP Europe A 2 0 0

IBM USA A 3 1 0

* Note that there is a variety of compression methods


and algorithms like run-length compression

© 2014 SAP AG or an SAP affiliate company. All rights reserved. Public 25


Snapshot Isolation
DATA-D……………DATA-D ATA-DA TA-

time
base list of rows visible to all
111011……………111101

inserted
deleted 11111
100010……………01000000010

© 2014 SAP AG or an SAP affiliate company. All rights reserved.


oldest reader tx1 commit tx2 begin
111
000001……………100000000001000

tx3 commit

011001……………101101111011
Initial Design – set oriented, optimized for OLAP

tx2 access

Public

011000……………001101111100111
30
tx4 begin
& access
New Design – OLTP friendly

valid valid
from to
tx3: delete where … tx2 tx3
tx2: insert n rows …
New
rows
tx1: insert 1 row New row tx1

Problems to solve tx3


 Memory overhead
DATA
– Valid from/to for every row?
 Tx identity: TID vs. CID
– If TID: visibility rules, TCB memory overhead
– If CID: DML time ID, atomic commit, post-commit
 L2/3 cache friendly
– Stay local, avoid dereferencing pointers
 OLAP performance txn: reader

© 2014 SAP AG or an SAP affiliate company. All rights reserved. Public 31


Outlook
Where is HANA going next?
Continuing Challenges of Emerging Hardware

 Challenge 1: Parallelism: Take advantage of tens, hundreds, thousands of cores


 Challenge 2: Large memories & data locality/NUMA
– Yes, DRAM is 125,000 times faster than disk…
– But DRAM access is still 10-80 times slower than on-chip caches

© 2014 SAP AG or an SAP affiliate company. All rights reserved. Public 33


HANA Platform On-Going Architectural Evolution

Data models
 Flexible schemas, graph functionality, geospatial, time series, historical data,
Big Data, external libraries

Resource and workload management


 Memory, threads, scheduling, admission control, service level management, data aging

Application services
 XS Engine, CDS and River

Continuing performance improvements


 Hardware advances, NUMA, improved modularization and architecture

Cloud and multi-tenancy

© 2014 SAP AG or an SAP affiliate company. All rights reserved. Public 34


Co-innovating the Next Big Wave in Hardware Evolution

Multi-Core and Large “Memory” Footprints

Storage Class Memories / Non-Volatile Memory


 Leverage as DRAM and/or as persistent storage

On-Board DIMMs
 Very high density, byte-addressable
 DRAM like (< 3X) latency and bandwidth; similar endurance
 Compete with disk on cost/bit by 2020

Extreme Speed Network Fabric/Interconnects


 Inter-socket NUMA gets worse while inter-host NUMA gets better
 Inter-socket and Inter-host latencies converge

Exploiting Dark Silicon for Database Hardware Acceleration


 Also exploit GPUs for specific use cases, such as regression analysis

© 2014 SAP AG or an SAP affiliate company. All rights reserved. Public 35


Thank you!
Contact information:

Arne Schwarz, arne.schwarzy@sap.com


Mihnea Andrei, mihnea.andrei@sap.com
Richard Pledereder, richard.pledereder@sap.com

http://www.careersatsap.com/
http://jobs.sap.com
https://www.saphana.com
http://www.sap.com/pc/tech/in-memory-computing-hana.html

© 2014 SAP AG or an SAP affiliate company. All rights reserved.


© 2014 SAP AG or an SAP affiliate company.
All rights reserved.

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG or an
SAP affiliate company.

SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG
(or an SAP affiliate company) in Germany and other countries. Please see http://global12.sap.com/corporate-en/legal/copyright/index.epx for additional
trademark information and notices.

Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.

National product specifications may vary.

These materials are provided by SAP AG or an SAP affiliate company for informational purposes only, without representation or warranty of any kind,
and SAP AG or its affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP AG or
SAP affiliate company products and services are those that are set forth in the express warranty statements accompanying such products and
services, if any. Nothing herein should be construed as constituting an additional warranty.

In particular, SAP AG or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related
presentation, or to develop or release any functionality mentioned therein. This document, or any related presentation, and SAP AG’s or its affiliated
companies’ strategy and possible future developments, products, and/or platform directions and functionality are all subject to change and may be
changed by SAP AG or its affiliated companies at any time for any reason without notice. The information in this document is not a commitment,
promise, or legal obligation to deliver any material, code, or functionality. All forward-looking statements are subject to various risks and uncertainties
that could cause actual results to differ materially from expectations. Readers are cautioned not to place undue reliance on these forward-looking
statements, which speak only as of their dates, and they should not be relied upon in making purchasing decisions.

© 2014 SAP AG or an SAP affiliate company. All rights reserved. Public 37

You might also like