44
Feb 12, 2007 Feb 12, 2007 1 ECET 581/CPET/ECET 499 ECET 581/CPET/ECET 499 Mobile Computing Technologies & Mobile Computing Technologies & Apps Apps Data Dissemination and Management Data Dissemination and Management 4 of 4 4 of 4 Lecture 9 Lecture 9 Paul I-Hai Lin, Professor Paul I-Hai Lin, Professor Electrical and Computer Engineering Technology Electrical and Computer Engineering Technology Indiana University-Purdue University Fort Wayne Indiana University-Purdue University Fort Wayne

Feb 12, 20071 ECET 581/CPET/ECET 499 Mobile Computing Technologies & Apps Data Dissemination and Management 4 of 4 Lecture 9 Paul I-Hai Lin, Professor

Embed Size (px)

Citation preview

Feb 12, 2007Feb 12, 2007 11

ECET 581/CPET/ECET 499ECET 581/CPET/ECET 499 Mobile Computing Technologies & AppsMobile Computing Technologies & Apps

Data Dissemination and Management Data Dissemination and Management 4 of 44 of 4

Lecture 9Lecture 9

Paul I-Hai Lin, Professor Paul I-Hai Lin, Professor Electrical and Computer Engineering TechnologyElectrical and Computer Engineering Technology

Indiana University-Purdue University Fort WayneIndiana University-Purdue University Fort Wayne

Feb 12, 2007Feb 12, 2007 22

Data Dissemination and Management - Data Dissemination and Management - TopicsTopics

Mobile Data CachingMobile Data Caching Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes Mobile Web CachingMobile Web Caching SummarySummary

Feb 12, 2007Feb 12, 2007 33

Mobile Data CachingMobile Data Caching Memory HierarchyMemory Hierarchy

• Processor (CPU) RegistersProcessor (CPU) Registers• Main memory (RAM/ROM)Main memory (RAM/ROM)• Mass storages: disks, tapesMass storages: disks, tapes

CacheCache• Small, Fast memory for holding frequently Small, Fast memory for holding frequently

used dataused data• ImprovementsImprovements

Improving Data Access LatenciesImproving Data Access Latencies Improving Data AvailabilityImproving Data Availability

• Cache management schemesCache management schemes

Feb 12, 2007Feb 12, 2007 44

Mobile Data CachingMobile Data Caching Cache management schemesCache management schemes

• Predict/estimate which data items are most Predict/estimate which data items are most likely to be used in the futurelikely to be used in the future

• Copy them to the cache memory (closer to the Copy them to the cache memory (closer to the processor)processor)

• Cache missCache miss• LRU (Least-Recently Used) and Prefetching LRU (Least-Recently Used) and Prefetching

algorithms algorithms

Feb 12, 2007Feb 12, 2007 55

Mobile Data CachingMobile Data Caching Caching in Traditional Distributed SystemsCaching in Traditional Distributed Systems

Distributed Systems and Network Computing Distributed Systems and Network Computing EnvironmentsEnvironments

Scenario 1Scenario 1• Data in the shared memory or serversData in the shared memory or servers• Data can be read or written by different clients Data can be read or written by different clients

concurrently (Distributed File System)concurrently (Distributed File System) Scenario 2Scenario 2

• Data in the shared memory or serversData in the shared memory or servers• Data are read-only for the clients (WWW)Data are read-only for the clients (WWW)

Data may be replicated onto multiple servers: Data may be replicated onto multiple servers: improve fault tolerance and availabilityimprove fault tolerance and availability

A client just modified the data item before A client just modified the data item before another client access it another client access it

Feb 12, 2007Feb 12, 2007 66

Mobile Data Caching Mobile Data Caching Caching in Traditional Distributed SystemsCaching in Traditional Distributed Systems

Distributed Systems and Network Computing Distributed Systems and Network Computing EnvironmentsEnvironments

Most Crucial Problem for cachingMost Crucial Problem for caching• How to maintain data consistency among the clients How to maintain data consistency among the clients

and serversand servers• Complexity arises from the various failuresComplexity arises from the various failures

Server FailureServer Failure Network FailureNetwork Failure Client FailureClient Failure

Approaches used to maintain data consistencyApproaches used to maintain data consistency Polling every timePolling every time Adaptive time to liveAdaptive time to live Leases-based invalidationLeases-based invalidation

Feb 12, 2007Feb 12, 2007 77

Mobile Data Caching Mobile Data Caching Cache Consistency MaintenanceCache Consistency Maintenance

Data Currency RequirementData Currency Requirement Cache Consistency Maintenance Cache Consistency Maintenance

SchemesSchemes• WWWWWW• Distributed File SystemsDistributed File Systems• Client-Server Databases Client-Server Databases

Cache Consistency ModelsCache Consistency Models• Classic TechniquesClassic Techniques• Strong ConsistencyStrong Consistency

Feb 12, 2007Feb 12, 2007 88

Mobile Data Caching Mobile Data Caching Cache Consistency MaintenanceCache Consistency Maintenance

Cache Consistency ModelsCache Consistency Models• Classic TechniquesClassic Techniques

Distributed computing environment connected via Distributed computing environment connected via reliable wired links reliable wired links

Call backs and Validity ChecksCall backs and Validity Checks Not suitable for Mobile client (lost connection, etc)Not suitable for Mobile client (lost connection, etc) Refetching data – wasting bandwidthRefetching data – wasting bandwidth

• Strong Cache Consistency Model: Strong Cache Consistency Model: Data x(t) is the most recent x(t)? Checked with the Data x(t) is the most recent x(t)? Checked with the

server before accessserver before access Mobile computing environment – make it unusable Mobile computing environment – make it unusable

when disconnections become frequentwhen disconnections become frequent

Feb 12, 2007Feb 12, 2007 99

Mobile Data CachingMobile Data Caching Performance and Architectural IssuesPerformance and Architectural Issues

Various issues and Considerations for Various issues and Considerations for Designing Mobile Caching StrategiesDesigning Mobile Caching Strategies

1.1. Data access patternData access pattern2.2. Data update rateData update rate3.3. Communication/access costCommunication/access cost4.4. Mobility pattern of the clientMobility pattern of the client5.5. Connectivity characteristics (disconnection Connectivity characteristics (disconnection

frequency, available bandwidth)frequency, available bandwidth)6.6. Data currency requirements of the User Data currency requirements of the User

(user expectations)(user expectations)7.7. Context dependence of the informationContext dependence of the information

Feb 12, 2007Feb 12, 2007 1010

Mobile Data CachingMobile Data Caching Performance and Architectural IssuesPerformance and Architectural Issues

Need to address the following problemsNeed to address the following problems• How to reduce client-side latencyHow to reduce client-side latency• How to maintain cache consistency between How to maintain cache consistency between

various cache and the serversvarious cache and the servers Being studied extensively in distributed Being studied extensively in distributed

systems and wired networking systems and wired networking environmentsenvironments

Not new to mobile computing Not new to mobile computing environmentsenvironments

Feb 12, 2007Feb 12, 2007 1111

Mobile Data Caching Mobile Data Caching Performance and Architectural IssuesPerformance and Architectural Issues

Need to address the following problemsNeed to address the following problems• How to ensure high data availability in the How to ensure high data availability in the

presence of frequent disconnectionspresence of frequent disconnections• How to achieve high energy/bandwidth How to achieve high energy/bandwidth

efficiencyefficiency• How to determine the cost of a cache miss How to determine the cost of a cache miss

and how to incorporate this cost in the cache and how to incorporate this cost in the cache management schememanagement scheme

• How to manage location-dependent data in How to manage location-dependent data in the cachethe cache

These 4-problems are new to the mobile These 4-problems are new to the mobile computing environmentcomputing environment

Feb 12, 2007Feb 12, 2007 1212

Mobile Data Caching Mobile Data Caching Performance and Architectural IssuesPerformance and Architectural Issues

Need to address the following problemsNeed to address the following problems• How to enable cooperation between multiple How to enable cooperation between multiple

peer cachespeer caches Need to consider Need to consider

• Peer-to-Peer paradigmPeer-to-Peer paradigm• Ad Hoc NetworksAd Hoc Networks

Feb 12, 2007Feb 12, 2007 1313

Mobile Data Caching Mobile Data Caching Performance and Architectural IssuesPerformance and Architectural Issues

Cache Organization IssuesCache Organization Issues1.1. Where do we cache? Where do we cache?

• Server? Proxy? Client?Server? Proxy? Client?• Frequency, Pattern, Cost of accessFrequency, Pattern, Cost of access• At server: aggregated access pattern, retrieving At server: aggregated access pattern, retrieving

costcost• At proxy and client: access pattern, At proxy and client: access pattern,

communication cost, update ratecommunication cost, update rate

2.2. How many levels of caching do we use How many levels of caching do we use (hierarchical caching)?(hierarchical caching)?

3.3. What do we cache (when to cache a data What do we cache (when to cache a data item and for how long)?item and for how long)?

4.4. How do we invalidate cached items?How do we invalidate cached items?

Feb 12, 2007Feb 12, 2007 1414

Mobile Data Caching Mobile Data Caching Performance and Architectural IssuesPerformance and Architectural Issues

Cache Organization IssuesCache Organization Issues5.5. Who is responsible for invalidations? What Who is responsible for invalidations? What

is the granularity at which the invalidation is is the granularity at which the invalidation is done?done?

6.6. What data currency guarantees can the What data currency guarantees can the system provide to users?system provide to users?

7.7. What are the cost involved? How do we What are the cost involved? How do we charge users?charge users?

8.8. What is the effect on query delay (response What is the effect on query delay (response time) and system throughput (query time) and system throughput (query completion rate) completion rate)

Feb 12, 2007Feb 12, 2007 1515

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes A Taxonomy of Cache Maintenance A Taxonomy of Cache Maintenance

Schemes (classification)Schemes (classification)• Cache Consistency RequirementsCache Consistency Requirements

Strong Cache Consistency (always up-to-date)Strong Cache Consistency (always up-to-date)• Polling Every Time SchemePolling Every Time Scheme• Invalidating Data On Modification SchemeInvalidating Data On Modification Scheme

Weak Cache Consistency (some degree of Weak Cache Consistency (some degree of inconsistency)inconsistency)

• TTL (Time-To-Live) -based Consistency TTL (Time-To-Live) -based Consistency StrategiesStrategies

Pre-assigned TTL valuePre-assigned TTL value Adaptive TTL ApproachAdaptive TTL Approach

Feb 12, 2007Feb 12, 2007 1616

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes Polling Every Time StrategiesPolling Every Time Strategies

• A special case of TTL with TTL fieldA special case of TTL with TTL field Invalidating-Based StrategiesInvalidating-Based Strategies

• Stateless Approach – server does not maintain info Stateless Approach – server does not maintain info (how long) about the cache contents of the clients(how long) about the cache contents of the clients

Stateless Asynchronous approachStateless Asynchronous approach Stateless Synchronous approachStateless Synchronous approach

• Stateful Approach – server keep tracking the cache Stateful Approach – server keep tracking the cache contents of its clientscontents of its clients

Stateful Asynchronous approach – use a Home Stateful Asynchronous approach – use a Home Location CacheLocation Cache

Stateful Synchronous approachStateful Synchronous approach

Feb 12, 2007Feb 12, 2007 1717

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes

TTL-based Consistency StrategiesTTL-based Consistency Strategies Pre-assigned TTL valuePre-assigned TTL value Adaptive TTL ApproachAdaptive TTL Approach

Feb 12, 2007Feb 12, 2007 1818

Mobile Cache Maintenance Schemes Mobile Cache Maintenance Schemes Cache Maintenance for Push-Based Cache Maintenance for Push-Based

Information DisseminationInformation Dissemination A ScenarioA Scenario

• Data item x is accessed 1% of the time at a Data item x is accessed 1% of the time at a client C and x is also broadcast 1% of the timeclient C and x is also broadcast 1% of the time

• Date item y is accessed 0.5% of the time at Date item y is accessed 0.5% of the time at client C, but is broadcast only 0.1% of the client C, but is broadcast only 0.1% of the timetime

• The time period of two occurrence of data The time period of two occurrence of data items:items:

Data item y time ty = 10 * tx of data item xData item y time ty = 10 * tx of data item x

• Cache x instead of y?Cache x instead of y? Affect the average data access delayAffect the average data access delay

Feb 12, 2007Feb 12, 2007 1919

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes Cache Maintenance for Push-Based Cache Maintenance for Push-Based

Information DisseminationInformation Dissemination New Cache Management Schemes New Cache Management Schemes

for Push-based Information Systemfor Push-based Information System• Consider the cost of a cache missConsider the cost of a cache miss

• All misses – not the same costAll misses – not the same cost

Feb 12, 2007Feb 12, 2007 2020

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes Cache Maintenance for Push-Based Cache Maintenance for Push-Based

Information DisseminationInformation Dissemination

Metrics used in Mobile Computing Metrics used in Mobile Computing EnvironmentEnvironment• Hit Ratio Hit Ratio

The fraction of total data requests satisfied from The fraction of total data requests satisfied from the cachethe cache

• Depends on cache management algorithmsDepends on cache management algorithms• Cache sizeCache size• Request patternRequest pattern

Assume that all cache misses have the same cost Assume that all cache misses have the same cost (not necessary hold in weakly connected (not necessary hold in weakly connected environment)environment)

• Miss cost – depends on data size and timingMiss cost – depends on data size and timing

Feb 12, 2007Feb 12, 2007 2121

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes Cache Maintenance for Push-Based Cache Maintenance for Push-Based

Information DisseminationInformation Dissemination

New Metrics Representing Different New Metrics Representing Different Cache Costs in Mobile Computing Cache Costs in Mobile Computing EnvironmentEnvironment• PIXPIX

The access probability of data item d is PThe access probability of data item d is P The broadcast frequency – XThe broadcast frequency – X PIX of data item d is P/XPIX of data item d is P/X

• Cost-Based Page-Replacement Cost-Based Page-Replacement Algorithm using PIXAlgorithm using PIX

Feb 12, 2007Feb 12, 2007 2222

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes Broadcasting Invalidation ReportsBroadcasting Invalidation Reports

Cache Consistency Management Schemes Cache Consistency Management Schemes based on Broadcasting Invalidation Reportsbased on Broadcasting Invalidation Reports• Broadcasting Timestamp (BT) Scheme – Fig 3.7Broadcasting Timestamp (BT) Scheme – Fig 3.7• A Variant of Broadcasting Invalidation Report (Jing A Variant of Broadcasting Invalidation Report (Jing

and Colleagues, 1997) - and Colleagues, 1997) - Adjust the sizeAdjust the size of the of the invalidation report to minimize the use of wireless invalidation report to minimize the use of wireless bandwidthbandwidth while retaining the effectiveness of cache while retaining the effectiveness of cache validationvalidation

• Two-Level Caching Scheme based on mobility agents Two-Level Caching Scheme based on mobility agents that takes into account the that takes into account the Mobility PatternMobility Pattern (Liu and (Liu and Maguire, 1996)Maguire, 1996)

• Broadcasting Invalidation Report methods take into Broadcasting Invalidation Report methods take into account the account the update and query rate/patterns and client update and query rate/patterns and client disconnection time to optimize query costdisconnection time to optimize query cost (Hue and (Hue and Lee 1998)Lee 1998)

Feb 12, 2007Feb 12, 2007 2323

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes Broadcasting Timestamp SchemeBroadcasting Timestamp Scheme

Figure 3.7 Problem with callback invalidation scheme in mobile computing environment

Adapted from the Text: Fundamentals of Mobile and Pervasive Computing, 2005, by Frank Adelstein, et. al, McGraw-Hill

Base-stationData Server

Get x

x = 10

x=10

Base-stationData ServerX = 10

invalidate x

x=15

Base-stationData Server

Use xx=15

Feb 12, 2007Feb 12, 2007 2424

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes Broadcasting Timestamp SchemeBroadcasting Timestamp Scheme

Data server periodically broadcasting Data server periodically broadcasting invalidation reportsinvalidation reports• All the invalidations in a time window of the last w All the invalidations in a time window of the last w

time unitstime units• Window size w: how long a client can sleep Window size w: how long a client can sleep

(disconnected from the network)(disconnected from the network) An invalidation notification from the server: (id, An invalidation notification from the server: (id,

ts) ts) • id: identifier of a data itemid: identifier of a data item• ts: timestamp denoting the time when data item was ts: timestamp denoting the time when data item was

modified, i.e.modified, i.e.• t: the time when the invalidation report was sent by t: the time when the invalidation report was sent by

the serverthe server• t – w t – w ≤ ts ≤ t≤ ts ≤ t

Feb 12, 2007Feb 12, 2007 2525

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes Broadcasting Timestamp SchemeBroadcasting Timestamp Scheme

A Mobile Client mA Mobile Client m• Received an Invalidation Report with Received an Invalidation Report with

timestamp t: IR(t); within w time units from last timestamp t: IR(t); within w time units from last invalidation reportinvalidation report

• Performs (For each data item id in m’s cache)Performs (For each data item id in m’s cache) Find each data item id in m’s cache with (id, ts) Find each data item id in m’s cache with (id, ts)

found in report IR(t)found in report IR(t) If timestamp < ts, stale the cache entry for id, and If timestamp < ts, stale the cache entry for id, and

delete the data itemdelete the data item Otherwise set the timestamp = t for the cached Otherwise set the timestamp = t for the cached

entryentry

Feb 12, 2007Feb 12, 2007 2626

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes Broadcasting Timestamp SchemeBroadcasting Timestamp Scheme

A Mobile Client mA Mobile Client m• Sleeping window size w time units Sleeping window size w time units

(disconnected from the network)(disconnected from the network)• Sleeping longer than w time units Sleeping longer than w time units

On receipt of an IROn receipt of an IR Discard all the items in its cache (or revalidate Discard all the items in its cache (or revalidate

before use)before use) Validates the cache entryValidates the cache entry

Feb 12, 2007Feb 12, 2007 2727

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes Broadcasting Invalidation ReportsBroadcasting Invalidation Reports

Other Cache Consistency Management Other Cache Consistency Management Schemes based on Broadcasting Schemes based on Broadcasting Invalidation ReportsInvalidation Reports

• Common CharacteristicsCommon Characteristics Stateless server, and neglect the issue of Stateless server, and neglect the issue of

mobilitymobility The entire cache is invalid if the client is The entire cache is invalid if the client is

disconnected for a period longer than the disconnected for a period longer than the period of the broadcast period of the broadcast

Feb 12, 2007Feb 12, 2007 2828

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes Disconnection OperationDisconnection Operation

Some information is better than no informationSome information is better than no information Disconnection Operation Disconnection Operation

• Is permitted if data availability is more important than Is permitted if data availability is more important than data consistency data consistency

• Should not be permitted If obtaining current data is Should not be permitted If obtaining current data is more importantmore important

Trade-offTrade-off• AvailabilityAvailability• ConsistencyConsistency

Feb 12, 2007Feb 12, 2007 2929

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes Disconnection Operation – Coda SystemDisconnection Operation – Coda System

CODA CODA • A distributed file system, assumes a stateful serverA distributed file system, assumes a stateful server• Support disconnected operations on shared files in UNIX-Support disconnected operations on shared files in UNIX-

like environmentslike environments Coda ClientsCoda Clients

• Hoarding files (a cache maintenance scheme)Hoarding files (a cache maintenance scheme)• What data items (files) do we hoard? What data items (files) do we hoard?

use Prioritized Scheme with user assigned priorities on data itemsuse Prioritized Scheme with user assigned priorities on data items

• When and how often do we perform hoarding?When and how often do we perform hoarding?• How do we deal with cache misses?How do we deal with cache misses?• How do we reconcile the caches version of the data items How do we reconcile the caches version of the data items

with the version at the server? with the version at the server?

Feb 12, 2007Feb 12, 2007 3030

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes Disconnection Operation – Coda SystemDisconnection Operation – Coda System

What data items (files) do we hoard? What data items (files) do we hoard? • A prioritized scheme with user assigned priorities on A prioritized scheme with user assigned priorities on

data itemsdata items When and how often do we perform hoarding?When and how often do we perform hoarding? How do we deal with cache misses?How do we deal with cache misses? How do we reconcile the caches version of the How do we reconcile the caches version of the

data items with the version at the server? data items with the version at the server? • Periodical “Hoard Walk” is performed on the cachePeriodical “Hoard Walk” is performed on the cache• Ensure that no un-cached objects has a higher priority Ensure that no un-cached objects has a higher priority

than any cached objectsthan any cached objects

Feb 12, 2007Feb 12, 2007 3131

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes Asynchronous Stateful (AS) Scheme Asynchronous Stateful (AS) Scheme

AS Scheme ensures that the data returned to a AS Scheme ensures that the data returned to a mobile client is t most t second old, where t is mobile client is t most t second old, where t is the max latency of forwarding an I.R. from the the max latency of forwarding an I.R. from the server to the client via its HAserver to the client via its HA

Designed for applications that require strict data Designed for applications that require strict data currency guarantees and in which access to currency guarantees and in which access to stale data is undesirablestale data is undesirable

Such applications include access to critical data Such applications include access to critical data such as Bank Account info, and Air Traffic Info such as Bank Account info, and Air Traffic Info

Feb 12, 2007Feb 12, 2007 3232

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes Asynchronous Stateful (AS) Scheme Asynchronous Stateful (AS) Scheme

UseUse• Cache consistency maintenance through Cache consistency maintenance through

Asynchronous invalidation reports (call backs)Asynchronous invalidation reports (call backs) SendSend

• Invalidation reports to mobile client (MH) only when Invalidation reports to mobile client (MH) only when some data changessome data changes

Home AgentHome Agent• Keep track of what data have been locally cached at Keep track of what data have been locally cached at

its mobile hosts (cache state info of the mobile host)its mobile hosts (cache state info of the mobile host)• A HA can be maintained at any trusted static hostA HA can be maintained at any trusted static host• Pass all messages between the Mobile Host and Data Pass all messages between the Mobile Host and Data

serverserver• To assist with handling disconnectionsTo assist with handling disconnections

Feb 12, 2007Feb 12, 2007 3333

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes

Asynchronous Stateful (AS) Scheme Asynchronous Stateful (AS) Scheme Home Location CacheHome Location Cache

• HLC can be viewed as a ProxyHLC can be viewed as a Proxy• Hold a list of records for Mobile HostsHold a list of records for Mobile Hosts

(x, T, Invalid Tag)(x, T, Invalid Tag)

x – Identifier of a data itemx – Identifier of a data item

T – Timestamp of the last invalidation of xT – Timestamp of the last invalidation of x

Invalid Tag – TRUE (invalidation has been sent to Invalid Tag – TRUE (invalidation has been sent to the host, but no ACK yet)the host, but no ACK yet)

Feb 12, 2007Feb 12, 2007 3434

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes Asynchronous Stateful (AS) SchemeAsynchronous Stateful (AS) Scheme

Figure 3.8 Broadcasting timestamp scheme

Adapted from the Text: Fundamentals of Mobile and Pervasive Computing, 2005, by Frank Adelstein, et. al, McGraw-Hill

Mobile Host(MH)

Wireless Access Point

Data Server

w = kL

L Time

Queries

Data item ID and its updation timestamp

pair(ID,t) for all updated data items in

last w time units Invalidation

Report

Queries are batched and answered after

cache validation following the next invalidation report

Cache validationis performed

Feb 12, 2007Feb 12, 2007 3535

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes

Asynchronous Stateful (AS) Scheme Asynchronous Stateful (AS) Scheme Assume the following Computing Assume the following Computing (Operation) Scenario (Operation) Scenario • The application program runs on the client The application program runs on the client

and communicates with the data server and communicates with the data server through messagesthrough messages

• Client Request Data ItemClient Request Data Item Client Client → Uplink Request (Query) → Data Server→ Uplink Request (Query) → Data Server Client saves some data in its local memory to Client saves some data in its local memory to

minimize the number of data requestminimize the number of data request

• Data Server ReplyingData Server Replying Data Server → Downlink Reply (data) → ClientData Server → Downlink Reply (data) → Client

Feb 12, 2007Feb 12, 2007 3636

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes

Asynchronous Stateful (AS) Scheme Asynchronous Stateful (AS) Scheme AssumptionsAssumptions• No message is lost due to communication failure or No message is lost due to communication failure or

otherwise in the wired networkotherwise in the wired network• Data server Data server update any data items → Send an update any data items → Send an

Invalidation Message → all Home Agents via the Invalidation Message → all Home Agents via the wired networkwired network

• Home Agents forwards Invalidation Message to the Home Agents forwards Invalidation Message to the relevant Mobile Hostrelevant Mobile Host

• Mobile Host Mobile Host Can detect if connected to the network or notCan detect if connected to the network or not Receives the Invalidation Message (through Receives the Invalidation Message (through

roaming and is not disconnected) roaming and is not disconnected) Informs HA before it stores (or updates) any data Informs HA before it stores (or updates) any data

item in its local cacheitem in its local cache

Feb 12, 2007Feb 12, 2007 3737

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes

Asynchronous Stateful (AS) Scheme Asynchronous Stateful (AS) Scheme A Mobile Host (MH) operates in two modesA Mobile Host (MH) operates in two modes

• In the Sleep ModeIn the Sleep Mode Unable to receive any invalidation messagesUnable to receive any invalidation messages Suspends processing of any queries from the Suspends processing of any queries from the

applicationsapplications Each Mobile Host maintains a Cache timestamp Each Mobile Host maintains a Cache timestamp

for holding the timestamp of the last message for holding the timestamp of the last message received from its Home Agentreceived from its Home Agent

The HA uses the cache timestamp to discard The HA uses the cache timestamp to discard invalidations that is no longer needs invalidations that is no longer needs

Feb 12, 2007Feb 12, 2007 3838

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes

Asynchronous Stateful (AS) Scheme Asynchronous Stateful (AS) Scheme A Mobile Host (MH) operates in two modesA Mobile Host (MH) operates in two modes• Wake up after a SleepWake up after a Sleep

Send a probe message to its HA with its cache Send a probe message to its HA with its cache timestamptimestamp

The probe message is piggy backed on the 1The probe message is piggy backed on the 1stst query after the wakeup to avoid unnecessary query after the wakeup to avoid unnecessary probingprobing

• HA response to the probe message (invalidation HA response to the probe message (invalidation check)check)

Sends an invalidation reportSends an invalidation report• MH determines which data items changed while MH determines which data items changed while

disconnecteddisconnected• Defers answering all queries that it received, until it Defers answering all queries that it received, until it

has received all the invalidation report from its HAhas received all the invalidation report from its HA

Feb 12, 2007Feb 12, 2007 3939

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes

Asynchronous Stateful (AS) Scheme Asynchronous Stateful (AS) Scheme A Example Scenario (Figure 3.9)A Example Scenario (Figure 3.9) Cache Timestamp t0Cache Timestamp t0

• Two data items: IDs x and zTwo data items: IDs x and z Timestamp t1Timestamp t1

• The HLC received an I. Message noting that data item The HLC received an I. Message noting that data item x changed at the server at time t1x changed at the server at time t1

• Forward invalidation (x; t1) to HLC and MHForward invalidation (x; t1) to HLC and MH• MH updates its cache timestamp to t1, and delete x MH updates its cache timestamp to t1, and delete x

from the cachefrom the cache• MH wants to access y by sending a data request MH wants to access y by sending a data request

(y;t1) to the HLC(y;t1) to the HLC• HLC responds, fetches y, and send it (y; t2) HLC responds, fetches y, and send it (y; t2)

Feb 12, 2007Feb 12, 2007 4040

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes

Asynchronous Stateful (AS) Scheme Asynchronous Stateful (AS) Scheme Timestamp t2Timestamp t2• MH updates its timestamp to t2, adds y to the cacheMH updates its timestamp to t2, adds y to the cache

Timestamp t3Timestamp t3• MH get disconnected – sleep modeMH get disconnected – sleep mode• y changed, and Invalidation message for y is losty changed, and Invalidation message for y is lost

Timestamp t4Timestamp t4• WakeupWakeup• Z changed, and invalidation message for z is sentZ changed, and invalidation message for z is sent• Ignore all invalidation messages until the 1Ignore all invalidation messages until the 1stst query query• Query + Probe (*, t2)Query + Probe (*, t2)

Timestamp t5Timestamp t5• Invalidate message (y,x,t5)Invalidate message (y,x,t5)

Feb 12, 2007Feb 12, 2007 4141

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes

Asynchronous Stateful (AS) Scheme Asynchronous Stateful (AS) Scheme

Figure 3.9 AS scheme for cache consistency maintenanceAdapted from the Text: Fundamentals of Mobile and Pervasive Computing, 2005, by Frank Adelstein, et. al,

McGraw-Hill

Mobile Host(MH)

Wireless Access Point

Data Server

Time

Query(y,t1)

Invalidation(x,t1)

Ignored

Data Server

.

.

.

Internet

.. .

x changed

X

Z

*

*

F

F

X

Z

t0

*

Y

F Z * F

t0 t1 t2

(y,t2)

Data

Query+

Probe(*,t2)

t3 t4 t5

MH awake

Sleeping

(y,z,t5)

Y

Z *

T

T

t3 X

Z *

T

T

t3

y changed

z changed

1) Fetch y from server2) Add (y,t2) to HLC3) Forward y to MH

First query after wakeup

x

z

t0

z

t1

y

z

t2

*

t5

Cache

Data

Timestamp

Home Location Cache (HLC)

Maintaining in HA

Data ID

Tim

estam

p

Invalid

flag

Feb 12, 2007Feb 12, 2007 4242

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes

To Cache Or NotTo Cache Or Not If x is never modified – cache a copy at MH mIf x is never modified – cache a copy at MH m If x is modifiable? Decision to cache x? If x is modifiable? Decision to cache x?

• SA AlwaysSA Always• SA NeverSA Never

Online Algorithms (Dynamic Optimization)Online Algorithms (Dynamic Optimization)

Feb 12, 2007Feb 12, 2007 4343

Mobile Cache Maintenance SchemesMobile Cache Maintenance Schemes

To Cache Or NotTo Cache Or Not Sliding-Window Dynamic Data Allocation Scheme Sliding-Window Dynamic Data Allocation Scheme

(Sistla, Wolfson, and Huang – 1998): determine (Sistla, Wolfson, and Huang – 1998): determine when to cache a data item a mobile clientwhen to cache a data item a mobile client• Choose AS Always or SA Never based on the recent Choose AS Always or SA Never based on the recent

access pattern historyaccess pattern history• The history is maintained as a window of size k, and The history is maintained as a window of size k, and

relevant access operationsrelevant access operations Read operation at the mobile node (rm)Read operation at the mobile node (rm) Write operation at the server (ws)Write operation at the server (ws)

• The irrelevant operationsThe irrelevant operations Write operation at the mobile node (wm)Write operation at the mobile node (wm) Read operation at the server (rs)Read operation at the server (rs)

Feb 12, 2007Feb 12, 2007 4444

Mobile Cache Maintenance Schemes Mobile Cache Maintenance Schemes

Sliding-Window Dynamic Data Allocation SchemeSliding-Window Dynamic Data Allocation Scheme A Schedule A Schedule ψψ is a sequence of relevant is a sequence of relevant

operationsoperations• ΨΨ = (ws, rm, rm, ws) = (ws, rm, rm, ws)• Two write by the ServerTwo write by the Server• Two read by the mobile nodeTwo read by the mobile node