Top Banner
Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000
28

Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Dec 26, 2015

Download

Documents

Tracey Wilkins
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Selecting and Implementing An Embedded Database

System

Presented by Jeff Webb

March 2005

Article written by Michael Olson

IEEE Software, 2000

Page 2: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

OverviewKey Strategy – Focus on application

requirementsEmbedded DB products vary

Some do less than what you need Some will do more

Choose the tool that most closely matches your needs

Page 3: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

OverviewAfter choosing OS, HW platform and DB

you must design for reliabilityDesign for performance up frontEvaluate performance once the

application is built

Page 4: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Evaluate Database Services Available High end RDM systems provide:

Concurrency Transaction processing Disaster recovery

Although these features may be needed, enterprise systems are seldom a good choice due to: platform differences packaging differences

Page 5: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Evaluate Database Services AvailableSeveral embedded DB systems use the

same techniques as enterprise systems but in smaller packages.

Often, full blown disaster recovery is not needed

Many embedded databases are configurable allowing inclusion or exclusion of services

Page 6: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Consider Services RequiredNow… consider which services you

need. For example:Locking?

Will run faster without lockingRecovery from failures matter?

Lack of, or disabling will increase performance

Page 7: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Operating Systems For Embedded systems Hundreds of OS for variety of processor

hardware DB developers have an enormous job porting

their software to the variety of platforms Few OS dominate the market

MS Win CE Neutrino VxWorks Wind Rivers

Page 8: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Databases For Embedded systemsClassification

Client Server relational systems Client Server OO systems Embedded libraries

Page 9: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

ClassificationClient Server relational systems

+ Programmers already know SQL - Extra run-time cost of client server

communications

Page 10: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Classification Client Server OO systems

Appear to be a good choice however Most are designed for Unix systems and

their deeply engrained assumptions about memory management and interprocess communications are difficult to port to embedded OS.

Page 11: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

ClassificationEmbedded libraries

Created specifically for embedded systems Provide simple language API that does not

require SQL + Faster execution, increased reliability - Require developers to master

nonstandard programming interfaces

Page 12: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Platform Support Consider combination of:

OS Processor Storage system Exotic processor boards

Rare combinations can be difficult to fit Often embedded OS vendors maintain lists of

partner companies whose products run on their systems

Page 13: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Performance ConsiderationsHigh concurrency?Size of databaseMultiple control threads?Can not rely on standard benchmark

measuring systemsEvaluation of actual performance is a

must

Page 14: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Designing the ApplicationDesign for performanceConsider:

Speed Predictability & Reliability

Page 15: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Designing the Application Speed Predictability & Reliability

Data representationAccess patternsConfiguration

Page 16: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Designing for SpeedData representation/Access patterns/Configuration

Most embedded DB tools operate on a fixed set of data types

Every fetch and store may require translation

A few systems, mostly library types allow storage in program-native format

Page 17: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Designing for Speed Data representation/Access patterns/Configuration

Consider the queries that the application will need to make

Data should be laid out accordinglyCan keys be used that will allow related

records to be physically stored together?

B+tree storage typically performs faster than hash table algorithms

Page 18: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Designing for Speed Data representation/Access patterns/Configuration

Must understand the chosen systems configuration options Memory use for secondary cache Write data to disk or store in memory? Locking system granularity Entire locking system on/off Vendors often choose the wrong defaults

Page 19: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Designing the ApplicationDesign for performanceConsider:

Speed

Predictability & Reliability

Page 20: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Predictability & ReliabilityMay need to run with no humans

presentNot easyFanatically check return values and

error indicatorsResource exhaustion

More common in embedded systems Track and release resources yourself

Page 21: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Predictability & ReliabilityAre transactions required so that

changes won’t be lost after a crash?

The recovery system must be callable from the application program on start up?

Page 22: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Performance tuningCommon causes for poor performance

Contention – 2 or more threads contending for same data

Disk-to-memory transfers Deadlocks

Page 23: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Contention/Disk-to-memory transfers/ Deadlocks

When several threads are waiting for the same resources Use record level locking if possible Use smaller pages if possible to make

page level locks more like record level locks

Touch the Hot data last and hold it for short periods of time

Page 24: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Contention/Disk-to-memory transfers/ Deadlocks

Disk latency – mechanicalFlash RAMMore memory for buffer cache Indexes

Page 25: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Contention/Disk-to-memory transfers/ Deadlocks

Obj O1 locked

T1

Obj O2 locked

T2

T1 waits for a lock on O2

T2 waits for a lock on O1

Page 26: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Deadlocks Turn off locking if it is not needed and if the

application permits Break large transactions into several smaller

transactions Write transactions so that they all acquire the

same resources in the same order Consider Optimistic Concurrency Control

Page 27: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Price Helps make final decision Some are available at no cost Licensing methods vary

Per developer Per application using it Per deployment platform Per user is less common in embedded systems

During development / deployment

Page 28: Selecting and Implementing An Embedded Database System Presented by Jeff Webb March 2005 Article written by Michael Olson IEEE Software, 2000.

Questions