Page Replacement Mechanism for Small Foot-Print Database in Android - - PowerPoint PPT Presentation

page replacement mechanism for small foot print database
SMART_READER_LITE
LIVE PREVIEW

Page Replacement Mechanism for Small Foot-Print Database in Android - - PowerPoint PPT Presentation

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion Page Replacement Mechanism for Small Foot-Print Database in Android Devices Pratik Patodi M. Tech Project


slide-1
SLIDE 1

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Page Replacement Mechanism for Small Foot-Print Database in Android Devices

Pratik Patodi

  • M. Tech Project

under the guidance of

  • Prof. Deepak B. Phatak

Computer Science & Engineering Indian Institute of Technology, Bombay

June 23, 2013

Page Replacement Mechanism for Small Foot-Print Database in Android Devices 1

slide-2
SLIDE 2

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

1 Introduction

Android Flash Drives Motivation

2 SQLite Internals

SQLite Architecture Query Execution Plane Updating Content

3 Our Approach

Overview

4 Experiments and Results

Challenges

5 Adaptive Logging

Working

6 Object Oriented Database 7 Conclusion and Future Work 8 References

Outline Page Replacement Mechanism for Small Foot-Print Database in Android Devices 2

slide-3
SLIDE 3

Introduction

slide-4
SLIDE 4

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Introduction

“What is Android?”

  • A Complete operating environment based upon the Linux kernel 2.6

provides[Bhu10]:

  • Powerful operation system.
  • Comprehensive Library Set.
  • Multimedia User Interface.
  • Phone Application.

Introduction Page Replacement Mechanism for Small Foot-Print Database in Android Devices 4

slide-5
SLIDE 5

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Introduction

“What is Android?”

  • A Complete operating environment based upon the Linux kernel 2.6

provides[Bhu10]:

  • Powerful operation system.
  • Comprehensive Library Set.
  • Multimedia User Interface.
  • Phone Application.
  • It consists of 4 layers:
  • Linux Kernel.
  • Libraries and Android Runtime.
  • Application Framework.
  • Applications.

Introduction Page Replacement Mechanism for Small Foot-Print Database in Android Devices 4

slide-6
SLIDE 6

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Android Architecture

Figure: System Architecture [Arc]

Introduction Page Replacement Mechanism for Small Foot-Print Database in Android Devices 5

slide-7
SLIDE 7

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion Introduction Page Replacement Mechanism for Small Foot-Print Database in Android Devices 6

slide-8
SLIDE 8

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Introduction

  • SQLite
  • Native Android Database.

Introduction Page Replacement Mechanism for Small Foot-Print Database in Android Devices 7

slide-9
SLIDE 9

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Introduction

  • SQLite
  • Native Android Database.
  • Light weight.

Introduction Page Replacement Mechanism for Small Foot-Print Database in Android Devices 7

slide-10
SLIDE 10

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Introduction

  • SQLite
  • Native Android Database.
  • Light weight.
  • Executes SQL like commands.

Introduction Page Replacement Mechanism for Small Foot-Print Database in Android Devices 7

slide-11
SLIDE 11

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Introduction

  • SQLite
  • Native Android Database.
  • Light weight.
  • Executes SQL like commands.
  • written in C, Requires JNI

Introduction Page Replacement Mechanism for Small Foot-Print Database in Android Devices 7

slide-12
SLIDE 12

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Introduction

  • SQLite
  • Native Android Database.
  • Light weight.
  • Executes SQL like commands.
  • written in C, Requires JNI
  • Provides Journaling Mechanism (Update-in-place).

Introduction Page Replacement Mechanism for Small Foot-Print Database in Android Devices 7

slide-13
SLIDE 13

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Introduction

  • SQLite
  • Native Android Database.
  • Light weight.
  • Executes SQL like commands.
  • written in C, Requires JNI
  • Provides Journaling Mechanism (Update-in-place).
  • Lighter from of Mysql.

Introduction Page Replacement Mechanism for Small Foot-Print Database in Android Devices 7

slide-14
SLIDE 14

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Introduction

  • SQLite
  • Native Android Database.
  • Light weight.
  • Executes SQL like commands.
  • written in C, Requires JNI
  • Provides Journaling Mechanism (Update-in-place).
  • Lighter from of Mysql.

Many of the functionalities of Mysql are not present in SQLite as mentioned below[MyS13].

  • User management

Introduction Page Replacement Mechanism for Small Foot-Print Database in Android Devices 7

slide-15
SLIDE 15

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Introduction

  • SQLite
  • Native Android Database.
  • Light weight.
  • Executes SQL like commands.
  • written in C, Requires JNI
  • Provides Journaling Mechanism (Update-in-place).
  • Lighter from of Mysql.

Many of the functionalities of Mysql are not present in SQLite as mentioned below[MyS13].

  • User management
  • Database Capabilities: SQLite does not have right outer join.

Introduction Page Replacement Mechanism for Small Foot-Print Database in Android Devices 7

slide-16
SLIDE 16

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Introduction

  • SQLite
  • Native Android Database.
  • Light weight.
  • Executes SQL like commands.
  • written in C, Requires JNI
  • Provides Journaling Mechanism (Update-in-place).
  • Lighter from of Mysql.

Many of the functionalities of Mysql are not present in SQLite as mentioned below[MyS13].

  • User management
  • Database Capabilities: SQLite does not have right outer join.
  • Alter command: Rename and Add column.

Introduction Page Replacement Mechanism for Small Foot-Print Database in Android Devices 7

slide-17
SLIDE 17

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Introduction

  • SQLite
  • Native Android Database.
  • Light weight.
  • Executes SQL like commands.
  • written in C, Requires JNI
  • Provides Journaling Mechanism (Update-in-place).
  • Lighter from of Mysql.

Many of the functionalities of Mysql are not present in SQLite as mentioned below[MyS13].

  • User management
  • Database Capabilities: SQLite does not have right outer join.
  • Alter command: Rename and Add column.
  • Data type: Boolean, binary, data time, enum, and set.

Introduction Page Replacement Mechanism for Small Foot-Print Database in Android Devices 7

slide-18
SLIDE 18

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Introduction

  • Flash memory
  • Internal + External
  • Non-volatile, shock-resistant, and uses little power.
  • Potable.
  • Chip and easily available now a days.

Introduction Page Replacement Mechanism for Small Foot-Print Database in Android Devices 8

slide-19
SLIDE 19

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Introduction

  • Flash memory
  • Internal + External
  • Non-volatile, shock-resistant, and uses little power.
  • Potable.
  • Chip and easily available now a days.
  • Limitations
  • Block Write.
  • Rewrite = Erase + Write.
  • Fixed number of writes.

Introduction Page Replacement Mechanism for Small Foot-Print Database in Android Devices 8

slide-20
SLIDE 20

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Introduction

“Motivation”

Introduction Page Replacement Mechanism for Small Foot-Print Database in Android Devices 9

slide-21
SLIDE 21

SQLite Internals

slide-22
SLIDE 22

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

SQLite Architecture

Figure: Initial State [sql13]

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 11

slide-23
SLIDE 23

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Query Execution Plane

  • Each SQL Statement is converted into an intermediate program.
  • Each instruction of the program is having an Opcode, and upto five
  • perands.
  • pcode

P1 P2 P3 P4 P5

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 12

slide-24
SLIDE 24

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Query Execution Plane

  • Each SQL Statement is converted into an intermediate program.
  • Each instruction of the program is having an Opcode, and upto five
  • perands.
  • pcode

P1 P2 P3 P4 P5

  • P1 , P2, and P3 - Holds integer value.
  • P4- Table name.
  • P5- Flag.

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 12

slide-25
SLIDE 25

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Query Execution Plane

Insert Statement

INSERT INTO tbl1 VALUES(01,pratik!); Addr

  • pcode

P1 P2 P3 P4 P5 Trace 1 Goto 10 2 OpenWrite 2 2 3 NewRowid 1 4 Integer 1 2 5 String8 3 pratik! 6 MakeRecord 2 2 4 da 7 Insert 4 1 tbl1 1b 8 Close 9 Halt 10 Transaction 1 11 VerifyCookie 1 12 TableLock 2 1 tbl1 13 Goto 2

Table: Opcode program for INSERT statement

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 13

slide-26
SLIDE 26

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Query Execution Plane

Update Statement

UPDATE tbl1 SET value = ’bye pratik’ WHERE key = 01; Addr

  • pcode

P1 P2 P3 P4 P5 Trace 1 Goto 24 2 Null 1 2 3 OpenWrite 2 1 4 Rewind 11 5 Column 5 6 Integer 1 6 7 Ne 6 10 5 collseq(BINARY) 6c 8 Rowid 2 9 RowSetAdd 1 2 10 Next 5 1 11 Close 12 OpenWrite 2 2 13 RowSetRead 1 22 2

Table: Opcode program for UPDATE statement

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 14

slide-27
SLIDE 27

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Query Execution Plane

Update Statement cont.

UPDATE tbl1 SET value = ’bye pratik’ WHERE key = 01; Addr

  • pcode

P1 P2 P3 P4 P5 14 NotExists 13 2 15 Null 3 4 16 Column 3 17 String8 4 bye pratik 18 NotExists 19 2 19 MakeRecord 3 2 5 da 20 Insert 5 2 tbl1 5 21 Goto 13 22 Close 23 Halt 24 Transaction 1 25 VerifyCookie 1 26 TableLock 2 1 tbl1 27 Goto 2

Table: Opcode program for UPDATE statement

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 15

slide-28
SLIDE 28

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Updating Content

“Initial State”

Figure: Initial State [Ato]

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 16

slide-29
SLIDE 29

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Updating Content

“Acquiring A Read Lock”

Figure: Acquiring A Read Lock [Ato]

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 17

slide-30
SLIDE 30

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Updating Content

“Reading Data from the Database ”

Figure: Reading Data from the Database [Ato]

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 18

slide-31
SLIDE 31

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Updating Content

“Obtaining A Reserved Lock”

Figure: Obtaining A Reserved Lock [Ato]

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 19

slide-32
SLIDE 32

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Updating Content

“Creating A Journal File”

Figure: Journal File[Ato]

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 20

slide-33
SLIDE 33

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Updating Content

“Changing Database Pages In User Space”

Figure: Changing Database Pages In User Space[Ato]

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 21

slide-34
SLIDE 34

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Updating Content

“Flushing The Journal File To Mass Storage”

Figure: Flushing The Journal File To Mass Storage[Ato]

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 22

slide-35
SLIDE 35

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Updating Content

“Exclusive Lock”

Figure: Exclusive Lock [Ato]

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 23

slide-36
SLIDE 36

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Updating Content

“Writing Changes To The Database File”

Figure: Writing Changes To The Database File [Ato]

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 24

slide-37
SLIDE 37

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Updating Content

“Flushing Changes To Mass Storage”

Figure: Flushing Changes To Mass Storage [Ato]

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 25

slide-38
SLIDE 38

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Updating Content

“Deleting The Journal file”

Figure: Deleting The Journal File[Ato]

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 26

slide-39
SLIDE 39

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Updating Content

“Releasing Aquired Lock”

Figure: Releasing Aquired Lock [Ato]

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 27

slide-40
SLIDE 40

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Rollback

“When Something Goes Wrong...”

Figure: When Something Goes Wrong... [Ato]

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 28

slide-41
SLIDE 41

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Rollback

“Hot Rollback Journal”

Figure: Hot Rollback Journal [Ato]

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 29

slide-42
SLIDE 42

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Rollback

“Obtaining An Exclusive Lock On The Database”

Figure: Obtaining An Exclusive Lock On The Database [Ato]

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 30

slide-43
SLIDE 43

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Rollback

“Rolling Back Incomplete Changes”

Figure: Rolling Back Incomplete Changes [Ato]

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 31

slide-44
SLIDE 44

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Rollback

“Deleting The Hot Journal”

Figure: Deleting The Hot Journal [Ato]

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 32

slide-45
SLIDE 45

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Rollback

“Continue As If The Uncompleted Writes Had Never Happened”

Figure: Continue As If The Uncompleted Writes Had Never Happened [Ato]

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 33

slide-46
SLIDE 46

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

SQLite File structure

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 34

slide-47
SLIDE 47

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Flash Drive Limitations

Limitations

  • Block Write.
  • Rewrite = Erase + Write.
  • Fixed number of writes.

SQLite Internals Page Replacement Mechanism for Small Foot-Print Database in Android Devices 35

slide-48
SLIDE 48

Our Approach

slide-49
SLIDE 49

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Our Approach

How it works

  • All the updates in a new/free leaf pages and add original pages to

clean list.

  • Update page map table, by entering these new/free page address,

that to in new/free intermediate page, and add the original page map table in the clean list.

  • Update the page no of the root page of the table in the schema

table, using journaling mechanism.

  • Erase all the page present in the clean list.
  • Set COMMIT flag.
  • Failure before COMMIT- remove at the pages from clean list and

add the new pages to clean list.

  • Failure after COMMIT- database already consistent.

Our Approach Page Replacement Mechanism for Small Foot-Print Database in Android Devices 37

slide-50
SLIDE 50

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Our Approach

Our Approach Page Replacement Mechanism for Small Foot-Print Database in Android Devices 38

slide-51
SLIDE 51

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Our Approach

Our Approach Page Replacement Mechanism for Small Foot-Print Database in Android Devices 39

slide-52
SLIDE 52

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Our Approach

Our Approach Page Replacement Mechanism for Small Foot-Print Database in Android Devices 40

slide-53
SLIDE 53

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Our Approach

Our Approach Page Replacement Mechanism for Small Foot-Print Database in Android Devices 41

slide-54
SLIDE 54

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Our Approach

Our Approach Page Replacement Mechanism for Small Foot-Print Database in Android Devices 42

slide-55
SLIDE 55

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

SQLite File structure

Our Approach Page Replacement Mechanism for Small Foot-Print Database in Android Devices 43

slide-56
SLIDE 56

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Functional Flow

Our Approach Page Replacement Mechanism for Small Foot-Print Database in Android Devices 44

slide-57
SLIDE 57

Experiments And results

slide-58
SLIDE 58

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Schema used

Experiments and Results Page Replacement Mechanism for Small Foot-Print Database in Android Devices 46

slide-59
SLIDE 59

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Entries

The tables are populated with following entries.

  • 5 departments - Electrical, Mechanical, Civil, Maths, Computer

Science.

  • 10,000 students with 2,000 in each department. tot grades is zero

for all students.

  • 15 courses - 3 courses with name basic, intermediate and advance

for in each department.

  • 17 instructors.
  • 15 entries in teaches table - 1 for each subject.
  • 20,000 entries of student in takes table distributed evenly.

Experiments and Results Page Replacement Mechanism for Small Foot-Print Database in Android Devices 47

slide-60
SLIDE 60

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Case 1: Small Delete

Query- DELETE FROM instructor where ins id NOT IN (SELECT DISTINCT ins id FROM teaches); Technique used Time in mil- liseconds Database Size in KB Expected no.

  • f

pages ef- fected Journaling 3796 788 1 Shadow Paging 5468 790 1

Table: Time Taken and DB size for Small delete (1 Page)

Experiments and Results Page Replacement Mechanism for Small Foot-Print Database in Android Devices 48

slide-61
SLIDE 61

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Case 2: Small Delete different pages-

Query- DELETE FROM student where name = ‘Pratik Patodi; Technique used Time in mil- liseconds Database Size in KB Expected no.

  • f

pages ef- fected Journaling 6478 788 3 Shadow Paging 6592 790 3

Table: Time Taken and DB size for Small delete (3 Page)

Experiments and Results Page Replacement Mechanism for Small Foot-Print Database in Android Devices 49

slide-62
SLIDE 62

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Case 3: Small Update

Query- UPDATE instructor SET salary = salary + 5000 WHERE dept id = (SELECT dept id FROM department WHERE dept name = ‘Computer Science’); Technique used Time in mil- liseconds Database Size in KB Expected no.

  • f

pages ef- fected Journaling 3894 788 1 Shadow Paging 5643 790 1

Table: Time Taken and DB size for Small delete (1 Page)

Experiments and Results Page Replacement Mechanism for Small Foot-Print Database in Android Devices 50

slide-63
SLIDE 63

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Case 4: Large Delete

Query- DELETE FROM department WHERE dept name = ‘Computer Science’); Technique used Time in mil- liseconds Database Size in KB Expected no.

  • f

pages ef- fected Journaling 69149 788 77 Shadow Paging 39236 863 77

Table: Time Taken and DB size for Mass delete (Approx 77 Pages)

Experiments and Results Page Replacement Mechanism for Small Foot-Print Database in Android Devices 51

slide-64
SLIDE 64

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Case 5: Mass Update-

Query- UPDATE student as s SET tot grade = (SELECT sum(grade) FROM takes where s.roll no = takes.roll no GROUP BY roll no); Technique used Time in mil- liseconds Database Size in KB Expected no.

  • f

pages ef- fected Journaling 259396 788 233 Shadow Paging 149086 1021 233

Table: Time Taken and DB size for Mass update (Approx 233 Pages)

Experiments and Results Page Replacement Mechanism for Small Foot-Print Database in Android Devices 52

slide-65
SLIDE 65

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Case 6: Select after update-

Query- SELECT name,CNT FROM student AS A JOIN (SELECT roll no,COUNT(*) AS CNT FROM takes GROUP BY roll no) B ON A.roll no=B.roll no; Technique used Time in milliseconds Database Size in KB Journaling 15223 788 Shadow Paging 15325 1021

Table: Time Taken and DB size for Mass update (Approx 233 Pages)

Experiments and Results Page Replacement Mechanism for Small Foot-Print Database in Android Devices 53

slide-66
SLIDE 66

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Comparison

Figure: comparison

Experiments and Results Page Replacement Mechanism for Small Foot-Print Database in Android Devices 54

slide-67
SLIDE 67

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Analysis

  • In case of small update/delete Journaling Mechanism is more

efficient then our approach.

  • In case of Large update/delete our approach out performance

journaling approach.

  • In case of reading from database- both techniques performs equally.

Experiments and Results Page Replacement Mechanism for Small Foot-Print Database in Android Devices 55

slide-68
SLIDE 68

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Challenges

Distorted file structure Solution: On flash memory, data location is not important than data access speed.[BCH05] Extra Space Required This extra overhead can be compromised at the cost of decreased response time. storing log records is not required. Large Number of Small Updates Solution: Use Adaptive logging.

Experiments and Results Page Replacement Mechanism for Small Foot-Print Database in Android Devices 56

slide-69
SLIDE 69

Adaptive Logging

slide-70
SLIDE 70

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Adaptive Logging

Overview

  • A-type update.

Adaptive Logging Page Replacement Mechanism for Small Foot-Print Database in Android Devices 58

slide-71
SLIDE 71

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Adaptive Logging

Overview

  • A-type update.
  • S-type update.

Adaptive Logging Page Replacement Mechanism for Small Foot-Print Database in Android Devices 58

slide-72
SLIDE 72

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Adaptive Logging

Overview

  • A-type update.
  • S-type update.
  • Default technique: Journaling.

Adaptive Logging Page Replacement Mechanism for Small Foot-Print Database in Android Devices 58

slide-73
SLIDE 73

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Adaptive Logging

Overview

  • A-type update.
  • S-type update.
  • Default technique: Journaling.
  • Journal size >Threshold, Switch to Our Approach.

Adaptive Logging Page Replacement Mechanism for Small Foot-Print Database in Android Devices 58

slide-74
SLIDE 74

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Adaptive Logging

Figure: Two Update Pattern [KJW10]

Adaptive Logging Page Replacement Mechanism for Small Foot-Print Database in Android Devices 59

slide-75
SLIDE 75

Object Oriented Database

slide-76
SLIDE 76

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Object Oriented Database

  • Berkley DB JE: Berkley DB Java edition(JE) is developed at

Berkley university. It is written in Java. Hence, it does not uses any JNI to execute its instructions. It uses logging mechanism.

  • Perst DB: It is an Open Source Database Engine, developed by the

McOject company. This company has developed many embedded Database system for different framework like C#, .NET, Java, etc. Here, we have used its Java version.

Object Oriented Database Page Replacement Mechanism for Small Foot-Print Database in Android Devices 61

slide-77
SLIDE 77

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Object Oriented Database

Figure: Time Taken of 10 key-value Records

Object Oriented Database Page Replacement Mechanism for Small Foot-Print Database in Android Devices 62

slide-78
SLIDE 78

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Object Oriented Database

Figure: Time Taken of 100 key-value Records

Object Oriented Database Page Replacement Mechanism for Small Foot-Print Database in Android Devices 63

slide-79
SLIDE 79

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Object Oriented Database

Figure: Time Taken of 1,000 key-value Records

Object Oriented Database Page Replacement Mechanism for Small Foot-Print Database in Android Devices 64

slide-80
SLIDE 80

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Object Oriented Database

Figure: Time Taken of 10,000 key-value Records

Object Oriented Database Page Replacement Mechanism for Small Foot-Print Database in Android Devices 65

slide-81
SLIDE 81

Conclusion and Future Work

slide-82
SLIDE 82

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Conclusion and Future Work

Conclusion

  • Android Operating System provides a native database engine,

SQLite.

Conclusion and Future Work Page Replacement Mechanism for Small Foot-Print Database in Android Devices 67

slide-83
SLIDE 83

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Conclusion and Future Work

Conclusion

  • Android Operating System provides a native database engine,

SQLite.

  • SQLite uses Update-in-place Mechanism.

Conclusion and Future Work Page Replacement Mechanism for Small Foot-Print Database in Android Devices 67

slide-84
SLIDE 84

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Conclusion and Future Work

Conclusion

  • Android Operating System provides a native database engine,

SQLite.

  • SQLite uses Update-in-place Mechanism.
  • Our technique is better for flash memory, in case of large update.

Conclusion and Future Work Page Replacement Mechanism for Small Foot-Print Database in Android Devices 67

slide-85
SLIDE 85

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

Conclusion and Future Work

Future Work

  • Performance can further be enhanced by implementing Adaptive

logging.

  • Analysis of pros and cons of object oriented database.
  • Implement the concurrency part and experiment.

Conclusion and Future Work Page Replacement Mechanism for Small Foot-Print Database in Android Devices 68

slide-86
SLIDE 86

Outline Introduction SQLite Internals Our Approach Experiments and Results Adaptive Logging Object Oriented Database Conclusion

References I

Android Architecture. http://http://www.elinux.org/Android Architecture. [Online; accessed 3-Oct-2012]. Roolback Journal. http://www.sqlite.org/draft/atomiccommit.html. [Online; accessed 3-Oct-2012]. Siwoo Byun, Seongyun Cho, and Moonhaeng Huh. Flash memory shadow paging scheme for portable computers: Design and performance evaluation. ACM Trans. Database Syst., 39(3), October 2005. Vijay K. Madisetti Bhupinder S. Mongia. Reliable real-time applications on android os. http://www.ece.gatech.edu/~vkm/Android_Real_Time.pdf, 2010. Young-Seok Kim, Heegyu Jin, and Kyoung-Gu Woo. Adaptive logging for mobile device.

  • Proc. VLDB Endow., 3(1-2):1481–1492, September 2010.

MySQL-vs-SQLite. http://database-management-systems.findthebest.com/compare/30-53/MySQL-vs-SQLite, 2013. [Online; last accessed 20-June-2013]. Architecture Of SQLite. http://www.sqlite.org/arch.html, 2013. [Online; last accessed 20-June-2013]. References Page Replacement Mechanism for Small Foot-Print Database in Android Devices 69