Using Lua for Stored Procedures in a High Availability Database VeriSign I2S Team Name of Presenter: John Rodriguez Date: July 14, 2008.

Slides:



Advertisements
Similar presentations
Chapter 7 Constructors and Other Tools. Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 7-2 Learning Objectives Constructors Definitions.
Advertisements

Relational Database and Data Modeling
6 Copyright © 2005, Oracle. All rights reserved. Building Applications with Oracle JDeveloper 10g.
Data recovery 1. 2 Recovery - introduction recovery restoring a system, after an error or failure, to a state that was previously known as correct have.
Data Definition and Integrity Constraints
Database Systems: Design, Implementation, and Management
1 Lecture 5: SQL Schema & Views. 2 Data Definition in SQL So far we have see the Data Manipulation Language, DML Next: Data Definition Language (DDL)
Information Systems Today: Managing in the Digital World
Chapter 18 Methodology – Monitoring and Tuning the Operational System Transparencies © Pearson Education Limited 1995, 2005.
Overview of performance tuning strategies Oracle Performance Tuning Allan Young June 2008.
State of Connecticut Core-CT Project Query 8 hrs Updated 6/06/2006.
INTRODUCTION TO SIMULATION WITH OMNET++ José Daniel García Sánchez ARCOS Group – University Carlos III of Madrid.
An overview of Data Warehousing and OLAP Technology Presented By Manish Desai.
Database System Concepts and Architecture
Chapter 16: Recovery System
The Top 10 Reasons Why Federated Can’t Succeed And Why it Will Anyway.
Big Data Working with Terabytes in SQL Server Andrew Novick
Prentice Hall, Database Systems Week 1 Introduction By Zekrullah Popal.
Visibility Information Exchange Web System. Source Data Import Source Data Validation Database Rules Program Logic Storage RetrievalPresentation AnalysisInterpretation.
A Fast Growing Market. Interesting New Players Lyzasoft.
1 Cheriton School of Computer Science 2 Department of Computer Science RemusDB: Transparent High Availability for Database Systems Umar Farooq Minhas 1,
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
Modern Systems Analysis and Design Third Edition
Transactions and Recovery
Passage Three Introduction to Microsoft SQL Server 2000.
Slide 1 of 9 Presenting 24x7 Scheduler The art of computer automation Press PageDown key or click to advance.
INTRODUCTION TO TRANSACTION PROCESSING CHAPTER 21 (6/E) CHAPTER 17 (5/E)
Highly Available ACID Memory Vijayshankar Raman. Introduction §Why ACID memory? l non-database apps: want updates to critical data to be atomic and persistent.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall 9.1.
ISV Innovation Presented by ISV Innovation Presented by Business Intelligence Fundamentals: Data Loading Ola Ekdahl IT Mentors 9/12/08.
Sofia, Bulgaria | 9-10 October SQL Server 2005 High Availability for developers Vladimir Tchalkov Crossroad Ltd. Vladimir Tchalkov Crossroad Ltd.
Chapter 7: Database Systems Succeeding with Technology: Second Edition.
1 Moshe Shadmon ScaleDB Scaling MySQL in the Cloud.
OpenACS: Porting Oracle Applications to PostgreSQL Ben Adida
Lecture 12 Designing Databases 12.1 COSC4406: Software Engineering.
Copyright 2006 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Third Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter.
Discovering Computers Fundamentals Fifth Edition Chapter 9 Database Management.
IT 456 Seminar 5 Dr Jeffrey A Robinson. Overview of Course Week 1 – Introduction Week 2 – Installation of SQL and management Tools Week 3 - Creating and.
Overview – Chapter 11 SQL 710 Overview of Replication
1 CS 430 Database Theory Winter 2005 Lecture 16: Inside a DBMS.
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
INFO1408 Database Design Concepts Week 15: Introduction to Database Management Systems.
Concurrency Control. Objectives Management of Databases Concurrency Control Database Recovery Database Security Database Administration.
Week 7 : Chapter 7 Agenda SQL 710 Maintenance Plan:
ESRI User Conference 2004 ArcSDE. Some Nuggets Setup Performance Distribution Geodatabase History.
What is a Package? A package is an Oracle object, which holds other objects within it. Objects commonly held within a package are procedures, functions,
GLOBEX INFOTEK Copyright © 2013 Dr. Emelda Ntinglet-DavisSYSTEMS ANALYSIS AND DESIGN METHODSINTRODUCTORY SESSION EFFECTIVE DATABASE DESIGN for BEGINNERS.
MGA Duplica Replication Tool. 1. High Availability and Avoidance of Data Loss  Replicate to alternate databases 2. Split activities across databases.
Copyright 2001 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter 9 Designing Databases.
Database technology Introduction ER Modeling Database objects (intro) SQL.
Text TCS INTERNAL Oracle PL/SQL – Introduction. TCS INTERNAL PL SQL Introduction PLSQL means Procedural Language extension of SQL. PLSQL is a database.
CPSC-310 Database Systems
Definition CASE tools are software systems that are intended to provide automated support for routine activities in the software process such as editing.
Maximum Availability Architecture Enterprise Technology Centre.
A Technical Overview of Microsoft® SQL Server™ 2005 High Availability Beta 2 Matthew Stephen IT Pro Evangelist (SQL Server)
# - it’s not about social media it’s about temporary tables and data
# - it’s not about social media it’s about temporary tables and data
Software Architecture in Practice
The Top 10 Reasons Why Federated Can’t Succeed
Working with Very Large Tables Like a Pro in SQL Server 2014
SQL 2014 In-Memory OLTP What, Why, and How
Re-Indexing - The quest of ultimate automation
The PROCESS of Queries John Deardurff
The PROCESS of Queries John Deardurff Website: ThatAwesomeTrainer.com
The PROCESS of Queries John Deardurff
H-store: A high-performance, distributed main memory transaction processing system Robert Kallman, Hideaki Kimura, Jonathan Natkins, Andrew Pavlo, Alex.
Lecture 20: Intro to Transactions & Logging II
Chapter 11 Managing Databases with SQL Server 2000
Concurrency Control.
Presentation transcript:

Using Lua for Stored Procedures in a High Availability Database VeriSign I2S Team Name of Presenter: John Rodriguez Date: July 14, 2008

2 Agenda 1 VeriSign High Availability Database Background (VHAD) – Simplicity 2 Why Choose Lua for Stored Procedures? 3 VHAD Integrated Development Environment – IDE

3 Introduction + VeriSigns mission is making the Internet and telecommunications networks more reliable, more intelligent, and more secure. + VeriSign runs the registry (database) for the.com,.net,.cc, and.tv TLDs. + The motivation for VHAD was driven by historic and projected transactional growth and system availability requirements + VHAD is a very high availability ( %), very fast, replicated, memory- based database, optimized for Online Transaction Processing (OLTP). + Are you crazy? Why write your own database? Big, replicated commercial database systems just have too many moving parts. Cost rises exponentially when we push well beyond normal availability levels. + I still think youre crazy. What makes you think you can actually do this? Carefully, aggressively simplify the design and architecture. Target only the critical subset of system functionality.

4 Mission + Continuous Availability Availability is achieved by minimal administration, narrowly focused scope, simple and clear design, in-memory architecture Approach is NOT added redundancy over a lower-availability database. + High Performance Designed for 1+ billion update transactions per day (~ 50K/second). Designed for an unlimited volume of read-only transactions. + Online Transaction Processing Assumes Insertion/Update of approximately 10 rows per transaction. Not designed for general purpose set processing – no huge transactions. + Storage Engine is fully ACID compliant Atomicity– Transactional commit/abort – all or nothing. Consistency – Foreign key / uniqueness relationships are enforced. Isolation– A transaction never sees someone elses partial change. Durability– Acknowledgement of a commit guarantees data persistence.

5 + What kinds of things dont stop but just keep going, going, going…? The moon keeps orbiting. Simple tools just work. What makes them different from things that break, or must be stopped occasionally? + Continuous Availability: No maintenance windows, no fine print. No excuses, it doesnt matter why. Not an affirmation that we will fix it, but a guarantee that we wont need to. + How targeting really high availability effects design choices. Running Continuously

6 Continuous Availability + Commercial Availability - routine outages 90%2 hours down/day- nightly batch jobs 99%1 hour down/week- weekly backups 99.9%1 hour down/month- monthly reorganization + High Availability- occasional outages 99.95%1 hour down/quarter- quarterly upgrade 99.99%1 hour down/year- reboot after failure, + Continuous Availability- no scheduled outages %5 minutes down/year- automated switch over %2 minutes down/year- Project Goal %30 seconds down/year- Wow + Perfect Availability- no visible failures % failure is never visible to work in progress

7 Topology Prime processes changes and manages data consistency + Prime performs all changes. If the Prime fails, a Mirror is automatically selected to be promoted to Prime. + Mirrors confirm persistence. Provide persistence in memory. Must include a separate site. + Guard only writes log to disk. Protects against poison data. Not subject to errors in the database logic. + Replicas support massive read-only access. Replicas dont vote, which simplifies recovery analysis. Replicas can be promoted to Mirror when needed. PrimeGuardReplica Mirror Replica Replicas support unlimited read access Mirrors confirm persistence Guard defends against poison data As many levels as desired

8 Agenda 1 VeriSign High Availability Database Background (VHAD) – Simplicity 2 Why Choose Lua for Stored Procedures? 3 VHAD Integrated Development Environment – IDE

9 Rationale for Choosing Lua for Stored Procedures + Lua shares major VHAD design principle – keep it small and simple. + Lua is mature and very stable – critical core code is not expanding. + Most databases realistically require a service outage when a stored procedure is added or modified, and that change isnt transactional. + VHAD requires more dynamic behavior there, because anything that compromises even a single transaction is considered an outage. + Lua gives us the dynamic behavior we need – different interpreters can have different code in use simultaneously for a procedure name. + Highly parallel operation is needed: thousands of threads at once – Lua interpreter is fully thread safe and reentrant, unlike most others. + Lua Garbage Collection via interpreter heap – its a huge advantage not to have to explicitly deallocate or use reference counts. + Efficient direct access to C++ objects gives a big speed advantage.

10 Cursor Example – The Schema in SQL + Assume there is a database table like the following: CREATE TABLE DOMAIN_T ( DOMAINNAME VARCHAR(256), REGISTRAR VARCHAR(256), DATE TIMESTAMP );

11 Cursor Example – Userdata and Metatable + One of the basic types that Lua supports is userdata. + Lua provides APIs to create userdata types and associate a metatable of metamethods to a userdata type: Static const struct luaL_reg cursor_metatable[] = { {__newindex, setColumn}, {__index, getColumn}, {__gc, cleanup}, {NULL, NULL} } luaL_newmetatable(lstate, Session.Cursor) luaL_register(lstate, NULL, cursor_metatable) + Associating metamethods to userdata: luaL_getmetatable(lstate, Session.Cursor) Lua_setmetatable(lstate, -2)

12 Cursor Example - Lua Stored Procedure + A sample metamethod in C: int setColumn (lua_state *lstate) { luaL_checkudata(lstate, 1, Session.Cursor) colName = lua_tostring(lstate, 2) colData = lua_tonumber(lstate, 3) } + A sample stored procedure that uses the Cursor type: function INSERT_DOMAIN (args) domain = Cursor.new (REGY, DOMAIN) domain.DOMAINNAME = args.DOMAINNAME domain.RESISTRAR = args.REGISTRAR domain.DATE = args.DATE Cursor.insert(domain) commit() end

13 Agenda VeriSign High Availability Database (VHAD) Background – Simplicity Why Choose Lua for Stored Procedures? VHAD Integrated Development Environment – IDE

14 VHAD Integrated Development Environment - IDE + Need an environment that lets a user: Write a stored procedure Load a stored procedure dynamically Debug a stored procedure List schemas, tables, column values, etc. Rapid prototyping of stored procedures + Developing a database tool like sqlplus – but better Display schemas, stored procedures, etc. Display columnar data Execute a stored procedure Sqlplus does not have a stored procedure debugger!

15 ldb + Developed a command line Lua debugger - ldb + The ldb language list firstline [lastline] break line clear line display [varname] step continue print stack|trace|breakpoints quit help

16 ldb Example ldb> break 11 setting breakpoint at./sort.lua line local i=l+1 ldb> continue original Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec stopping at breakpoint in./sort.lua line local i=l+1 ldb> display m Find local name m: name m, type number, value Find global m: Did not find global m

17 ldb Example - continued ldb> print stack 7: 2 6:`Jan' 5: 1 4: function 3: 12 2: 1 1: table ldb> print trace level# name,type,language,source,currentline,linedefinedat 0# qsort,global,Lua,./sort.lua,12,5 1# testsorts,global,Lua,./sort.lua,55,51 2#,,main,./sort.lua,66,0

18 Conclusion – Difficulties Faced + Execution of stored procedures from memory. + Thread pools of Lua_states are reused. + Decimal adaptation and other numeric types. + Debugging stored procedures.

19 Questions + Answers

Thank You "Make everything as simple as possible, but not simpler." Albert Einstein