
Oracle Sharding Technical Deep Dive Y V Ravi Kumar Oracle ACE Director Oracle Certified Master (OCM) New York Oracle User Group (NYOUG) 04th October 2018 Patterns 1 Infolob Solutions Inc. Infolob Solutions Inc. About Infolob Infolob is a leading technology consulting organization that caters to companies looking for specialists who can help with their digital transformation agenda. We are headquartered in Irving, TX with offices in Harrisburg, PA., Atlanta, GA., Merida, Mexico and Hyderabad, India. Our Innovation labs are in Irving, TX and Merida, MX. Infolob Solutions Inc. was founded in 2009 as a certified small business specializing in Oracle technologies. Based on rapid growth and niche competency, Infolob acquired Oracle Platinum Partner status in 2012. We have grown substantially and have established ourselves as a premier provider of Oracle services in the United States. Patterns 2 Y V Ravi Kumar Oracle Certified Master (OCM) Oracle ACE Director Oracle ACE Spotlight for the month – June 2016 Oracle Magazine – July 2017 Oracle Speaker . Oracle Open World 2017 (OOW 2017) . Independent Oracle User Group (IOUG) . New York Oracle User Group (NYOUG) ME ABOUT ORACLE CERTIFICATIONS . Sun Coast Oracle User Group (SOUG) Oracle Certified Master (OCM) . Oracle Technology Network (OTN) Oracle 10g & 11g: RAC Certified Expert . Sangam (Largest Oracle Event in India) Oracle 11g: Performance Tuning Certified Expert . All India Oracle User Group (AIOUG) Oracle Exadata 11g Essentials Oracle Golden Gate 10 Essentials Author of 100+ articles Oracle Database 11g: SQL Tuning Certified Expert . Oracle Technology Network (OTN) Oracle 9i & 10g: Oracle On Linux Certified Expert . Toad World - Connected-Driven Innovation OCP – Oracle 12c, 11g, 10g, 9i and 8i . All things ORACLE from Redgate SUN Certified – Solaris System Administrator in SUN Solaris 9 . UKOUG Library Patterns 3 ORACLE SHARDING Oracle Sharding Technical Deep Dive Patterns 4 What is Oracle Sharding ? Oracle Sharding is a scalability and availability feature for custom-designed OLTP applications. Sharding enables distribution and replication of data across a pool of Oracle databases (shards) Oracle Sharding will not share no hardware or software Adding shards The pool of databases is presented to the application as a single logical database. to the pool Applications elastically scale (data, transactions and users) to any level, on any platform Sharding currently scaling up to 1,000 shards is supported (12.2) Patterns 5 Oracle Database with Sharding Architecture EMPLOYEE Transformation to Sharding Architecture EMPLOYEE EMPLOYEE Shard Database – PROD-A EMPLOYEE Traditional Oracle Database Sharded Catalog Database Shard Database – PROD-B Patterns 6 Oracle Sharding – Elastic Database Architecture Sharding Architecture Horizontal partitioning of data across up to 1000 independent Oracle Databases (shards) Horizontal partitioning splits a database table across shards so that each shard contains the table with the same columns but a different subset of rows. Shared-nothing hardware architecture •Each shard runs on commodity server •No shared storage components •No clusterware components Data is partitioned using a sharding key (i.e. account_id in Account Table). NoSQL databases made it easy to deploy Sharding, Oracle Database Native Sharding makes it easy for full-featured RDBMS. Patterns 7 Oracle Sharding – One Giant Database to many small DBs Table that is partitioned into smaller and more manageable pieces among multiple databases Server 1 Server 2 Server 3 Server 4 CONTDBA B CONTDBC D CONTDBE F CONTDBG H Partitions PartitionsA B PartitionsA B PartitionsA B Shard01: Table A Shard02: Table A Shard03: Table A Shard0N: Table A Patterns 8 Oracle Sharding – Benefits One mission critical database partitioned into many small databases (shards) o Extreme scalability by adding shards (independent databases) o Rolling upgrades with independent availability of shards. Customers Americas o Global-Scale OLTP applications prefer to shard massive databases into a farm of smaller databases o Native SQL for sharding tables across up to 1000 Shards Customers Europe o Routing of SQL based on shard key, and cross shard queries Customers o Online addition and reorganization of shards. Customers Asia Patterns 9 Oracle Sharding – Benefits Linear Scalability Add shards online to increase database … size and throughput. … Online split and rebalance. Extreme Availability Shared-nothing hardware architecture. … Fault of one shard has no impact on … others. Distribution of Data globally User defined data placement for performance, availability, DR or to meet regulatory requirements. Patterns 10 Oracle Sharding – Benefits Auto deployment & Replication used for shard-level HA Multiple sharding methods Centralized schema maintenance (sharded and duplicated data) A single global service accesses any shard Direct routing and proxy routing Elastic scaling with automatic rebalance Patterns 11 Oracle Sharding – Advantages High Availability (HA) features Compression and Advanced Security Backup and Recovery at Enterprise-Scale Database Partitioning applicable Online schema changes Guarantees ACID properties and read consistency Rolling upgrades with independent availability of shards Patterns 12 Oracle Sharding – Application Profile Custom OLTP Applications Large billing systems Airline ticketing systems Online financial services Media companies Online information services Social media companies Characteristics / Implementation Application must specify a sharding key for optimal performance Sharding is not application transparent method Patterns 13 Oracle Sharding Methods System Managed Sharding User Defined Sharding Composite Sharding Based on partitioning by Based on partitioning by RANGE or Provides two-levels of data CONSISTENT HASH LIST organization Range of hash values assigned to List or Range of sharding key Partitions are distributed among each chunk values assigned to each chunk by buckets by LIST or RANGE (specified the user by the user) Data is uniformly sharded / re- Need to manually maintain Within a bucket, a range of hash values sharded automatically balanced data distribution is automatically assigned to each chunk User has no control on location of Full control on location of data Requires two sharding keys data provides (super_sharding_key and sharding_key) Patterns 14 Oracle Sharding – Creating sharded tables System managed Sharding does not require the user to specify mapping of data to Shards. SQL> CREATE SHARDED TABLE customers( Supported data types for the sharding Customer_No NUMBER NOT NULL, key Customer_Name VARCHAR2(50), NUMBER Customer_Address VARCHAR2(250), INTEGER, CONSTRAINT Cust_PK PRIMARY KEY(Customer_No) SMALLINT, ) RAW, PARTITION BY CONSISTENT HASH (Customer_No) (N)VARCHAR, PARTITIONS AUTO TABLESPACE SET tbs1; (N)CHAR, DATE & TIMESTAMP Patterns 15 Oracle Sharding – User Defined Sharding User has control over database means user specifies the mapping of data to individual Shards. SQL> create tablespace tbs1; SQL> create tablespace tbs2; SQL> CREATE TABLE orders ( id NUMBER, country_code VARCHAR2(5), customer_id NUMBER, order_date DATE, order_total NUMBER(8,2), CONSTRAINT orders_pk PRIMARY KEY (id)) PARTITION BY LIST (country_code) ( PARTITION part_usa VALUES ('USA') tablespsce tbs1, PARTITION part_uk_and_ireland VALUES ('GBR', 'IRL') tablespace tbs2); Patterns 16 Oracle Sharding – Composite Sharding Composite Sharding is a combination of system managed and user defined Sharding. SQL> create tablespace tsp_set_1; SQL> create tablespace tsp_set_; SQL> alter session enable shard ddl; SQL> CREATE SHARDED TABLE Customers ( CustId VARCHAR2(60) NOT NULL, Set partitionsets and FirstName VARCHAR2(60), tablespace sets LastName VARCHAR2(60), for composite Class VARCHAR2(10), partitioning Geo VARCHAR2(8), CustProfile VARCHAR2(4000), Passwd RAW(60), CONSTRAINT pk_customers PRIMARY KEY (CustId), CONSTRAINT json_customers CHECK (CustProfile IS JSON)) partitionset by list(GEO) partition by consistent hash(CustId) partitions auto (partitionset america values ('AMERICA') tablespace set tsp_set_1, partitionset europe values ('EUROPE') tablespace set tsp_set_2); Patterns 17 Oracle Sharding License Requirements Oracle Enterprise Edition is a pre-requisite Each shard is a standalone Oracle Database Each shard must be licensed for either Active Data Guard, GoldenGate or RAC Additional Active Data Guard or RAC licenses are required for catalog DB if used for catalog HA No separate license for Oracle Partitioning No separate license for Oracle Partitioning is required for sharded or duplicated tables created using Oracle Sharding Patterns 18 Oracle Sharding – Compatibility Requirements for Shards Each shard is an independent Oracle Database. Oracle Sharding requires a minimum release of Oracle DB 12.2.0.1 and Oracle Client 12.2.0.1. For the first release of Oracle Sharding, Oracle recommends using the same OS for all the shards. This recommendation will be lifted in future releases. The initial release of Oracle Sharding (12.2.0.1) does not support Oracle Multitenant. Patterns 19 Oracle Database 12c R2 - Choices ORACLE RAC ORACLE DB ORACLE DB ORACLE DB 1. Single logical Single physical database database 2. Supports OLTP Supports any applications ORACLE GRID INFRASTRUCTURE application designed to shard OS OS OS OS OS 3. Each shard has its own CPU, memory & disk. 4. Presented to the application as a single logical ORACLE ASM database SHARED STORAGE Patterns 20 Components of Sharding
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages45 Page
-
File Size-