!~
Informaticsand ComputerScience
NOR'II-I..H(KI~N~
Perfoixnance Analysis of Adaptive Caching Algorithms in Mobile Environments OMRAd~ BUKHRES and JIN JING Depa~ment of Computer Sciences, Purdue University, West Lafayette, Indiana 47907
Communicated by Ahmed Elmagarmid
ABSTRACT In this paper, we address the problem of cache invalidation in mobile environments, where such system environment parameters as client disconnection times and update/query rates vary dynamically. We propose two adaptive caching algorithms that are the extensions of the Timestamps (TS) algorithm proposed in [4]. We implement a simul~tion model of a client-server system that supports mobile hosts over wireless communication channels. We use this model to compare these adaptive algorithms under conditions of changing environmental parameters. The results of this simulation provide some interesting insights into how these adaptive algorithms adjust dynamically to changing parameters. ©Elsevier Science Inc. 1996
1.
INTRODUCTION
Data management in mobile computing environments has recently become an area of increased interest to the database community [1, 4, 7]. In the mobile computing environment of the future, we can anticipate that a large number of users carrying low-powered palmtop machines will query databases over narrow bandwidth wireless channels. In such a context, caching of frequently accessed data items will be a useflll technique that will reduce contention on these narrow bandwidth wireless channels. However, cache invalidation strategies will be severely INFORMATION SCIENCES 95, 1-27 (1996)
© Els,zvier Science Inc. 1996 655 Avenue of the Americas, New York, NY 10010
0020-0255/96/$15.00 SSDI 0020-0255(95)00049-U
2
O. B U K H R E S AND J. JING
hampered by the disconnection and mobility of clients, since a server may be unaware of the current locations and connection status of clients [4]. It is difficult for a server to send invalidation messages directly to mobile clients that have cached the data items to be updated, since these clients often disconnect to conserve battery power and are frequently on the move between different locations. Furthermore, the narrow bandwidth wireless network will be clogged if massive numbers of clients attempt to query a server to validate cached data. Therefore, the existing caching algorithms employed in the traditional client-server architecture, where the locations and connections of clients do not change, may not be readily applicable to mobile environments. In [4], Barbara and Imielinski provided an alternate approach to the problem of invalidating caches in mobile environments. In this approach, a server periodically broadcasts an invalidation report in which the data items that have been changed are indicated. Rather than querying a server directly regarding the validation of cached copies, clients listen to these invalidation reports over wireless channels. This approach is attractive in the mobile environment because (1) a server need not know the location and connection status of its clients and (2) the clients need not establish an "uplink" connection to a server to invalidate their caches. One interesting new issue, however, arises when clients use these invalidation reports to invalidate their caches. This issue is the false invalidation of client caches. Since an invalidation report can include only limited or partial information regarding data changes or the current database state, caches that are actually valid may be invalidated. When a client has disconnected for a substantial period of time, the report may not cover all updates to data items that have occurred since the time of disconnection. In this case, the client may invalidate a cache that is actually valid. Once a cache is invalidated, the client must seek verification or updating of the cache from the data server. In this paper, we will present two adaptive algorithms for cache invalidation. Both algorithms are extensions of the Timestamps (TS) algorithm presented in [4]. Unlike the TS algorithm, they dynamically adjust to the changing parameters of the mobile environment, ensuring that mobile clients with long disconnection times would not suffer from a high falseinvalidation ratio. The first algorithm, called Basic Adaptive TS (BATS), adapts to changing environmental parameters by adjusting the window size of the database according to changes in the false invalidation and update rates. The second, called Hybrid Adaptive TS (HATS), differs from the first in that data items are dynamically partitioned into two groups, one consisting of " h o t " items of updates and the other of "cold" items of updates. This algorithm adapts to changing environmental parameters by
ADAPTIVE CACHING ALGORITHMS
3
dynamically assigning different window sizes to the two groups on the basis of feedback regarding the false invalidation ratio of client caches. We are interested in the TS-based adaptive caching algorithms here, because the TS algorithm has a very attractive property: the sizes of invalidation reports are small when the update rate is low. There are actually many information system applications in which the update rate is very low. In this low-update environment, it is possible to increase the window size of "cold" items without producing large-sized invalidation reports. It is therefore beneficial to use a TS-based caching algorithm in such low update-rate environments. To study in detail the effects of disconnection time and update pattern on the performance of these adaptive algorithms, we have implemented a simulation model of a client-server system that supports mobile hosts over wireless communication channels. In this paper, we use this simulation model to compare the performance of these algorithms. This analysis is intended to assess the extent to which the performance of adaptive algorithms can surpass that of the basic TS algorithm in conditions of changing environmental parameters. Furthermore, the analysis will provide interesting insights into how these adaptive algorithms adjust dynamically to changing environmental parameters. In :a mobile environment, it is desirable to provide a cache invalidation algorithm whose performance will not be severely affected by long client disconnection times. Mobile units will frequently be "off," with substantial periods of disconnection intended for battery conservation. A high rate of false invalidation will usually reduce the cache hit rate in query processing, resulting in increased traffic on the narrow wireless networks and decreased query processing throughput. The remainder of this paper is organized as follows. Section 2 describes the two adaptive algorithms. In Section 3, we present a simulation model that i:s used in Section 4 to compare the performance of these algorithms. Concluding remarks and directions for future work are presented in Section 5.
2. •J)APTIVE CACHE INVALIDATION ALGORITHMS In this section, we describe both the BATS and HATS algorithms. The system model for cache management in a mobile environment will be outlined first. We then describe the data structure and procedures associated with the algorithms. We conclude the section with a summary of the key differences between the two algorithms.
4
O. B U K H R E S A N D J. J I N G
2.1. CACHING MANAGEMENT MODEL
Following the concepts and terms introduced in [2, 4, 7], a mobile computing environment consists of two distinct sets of entities: mobile hosts and fixed hosts. Some of the fixed hosts, called Mobile Support Stations (MSSs), are augmented with a wireless interface to communicate with mobile hosts, which are located within a radio coverage area called a cell. A mobile host can move within a cell or b e t w e e n two cells while retaining its network connections. There is a set of database servers each covering a cell. The database, which consists of n n a m e d data items, is fully replicated at each data server. Each server can only service users that are currently located in its cell. A large number of mobile hosts resides in each cell; all issue queries to read the most recent copy of a data item. We assume that the database is updated only by the servers. Each server will periodically broadcast invalidation reports. To answer a query, the client on a mobile host will wait for the next invalidation report, which it will use to determine the validity of its cache. If there is a valid cached copy that can be used to answer the query, the client will return the result immediately. Invalid caches must be refreshed via a query to the server. 2.z
THE BASIC ADAPTIVE TS ALGORITHM
In the TS algorithm presented in [4], a server broadcasts the timestamps of the latest changes in items that have been updated within the last w seconds. The mobile clients listen to this " r e p o r t " and update their caches by discarding changed items mentioned in the report (with timestamps larger than those stored in the cache). For items not mentioned in the report, the clients update timestamps to the timestamp of the latest report. Clients that are "awake" constantly monitor these reports and update their caches accordingly, even if they are not actively querying the server. The basic TS algorithm has a number of significant shortcomings. To illustrate these problems, let us consider a scenario in which most data items never change. These data items will thus not be included in any invalidation report broadcast after timestamp t = w (assuming that time starts from zero). If a client cached these items earlier and then disconnected from the server, it will lose some invalidation reports and must submit an uplink request upon the next query. Frequent queries on these items by clients who are often disconnected will result in a great deal of unnecessary uplink traffic. This problem may be addressed by expanding
ADAPTIVE CACHING ALGORITHMS
5
the window size for items frequently queried by clients with long disconnection times. On the other hand, if these items are frequently queried by clients that are often connected, there is no need to include them in invalidation reports with large window sizes. In the Basic Adaptive TS (BATS) Algorithm, clients transmit information regarding their cache invalidation status along with any uplinked queries. Using the client invalidation information piggybacked with the uplinked queries, the server can then recognize uplink queries, which correspond to items whose caches were falsely invalidated at the client. The ~;erver uses this information to periodically adjust the database window :size. The period of adjustment is called the evaluationperiod of the window size of the database. In this BATS algorithm, each invalidation report will include the window size (in seconds) of the database and the names and timestamps of the d,ata items updated within the window. The window size is included in the :report as a necessary prerequisite for client action. To correctly invalidate its caches, the client must know the exact window size for each data item. For example, suppose that the window size for a data item has been decreased during the disconnection period of a client. After the client reconnects, it may falsely conclude that the data item is still valid if information regarding the new window size is lacking. Therefore, as opposed to the basic TS algorithm, invalidation reports in the BATS algorithm should contain the window size of the database. Formally, the window size is periodically evaluated according to the following equations, l e t Q(D) be the total number of uplink queries on the database that clients issued for items whose caches were falsely invalidated during the last evaluation period. Let R(i) be the number of times that the data item i was mentioned in the invalidation reports during the last evaluation period and R(D) be the sum of R(i) for all i in the item set D. We oow define
G( D) =Q( D)bq-R( D)(log( N) +bT)
(1)
where N is a number of data items in the database, bq is the average size in bits of the uplinked query, and br is the size of the timestamp. G(D) represents the overall difference between the number of bits transmitted for these queries due to false cache invalidation and the number of bits sent downlink in the form of the invalidation reports during the last evaluation period. If the difference is positive (above a certain threshold E), then we will increase the size of the window W(D) by a small
6
O. BUKHRES AND J. JING
integer e; otherwise we will decrease the size of the window W ( D ) by a small integer E. Formally,
w(o) +, w(o)
=
w(D) -,
if G ( D ) > 0 otherwise
if W ( D ) >1e
We can easily confirm that, for never or rarely changing data items, the window will increase if the query rate is high and clients have long disconnection periods. On the other hand, if the update rate is high and the false invalidation ratio is low, the window will shrink.
2.3. THE HYBRID ADAPTIVE TS ALGORITHM
The BATS algorithm as presented above does suffer from a shortcoming, which can be illustrated with a scenario combining a mixture of rarely changing and frequently changing data items. In this situation, the database window size may be unable to be increased, because of the unnecessary inclusion of frequently changing data items in the invalidation reports. In this scenario, clients that have cached rarely changing data items may falsely invalidate most of these items, if they have been disconnected for a period longer than the database window size. This problem may be addressed by extending the window size only for "cold" data items of updates or by not including "hot" data items in invalidation reports. In the Hybrid Adaptive TS (HATS) algorithm, the server partitions the database into two groups, one consisting of "hot" data items of updates and the other of "cold" data items of updates. The server computes the window size for each group separately. As in the BATS algorithm, these window sizes are periodically evaluated and included in each evaluation report that is broadcast over the wireless channels. Formally, the window sizes are evaluated according to the following equations. Let D c be the set of "cold spot" items and D h be the set of "hot spot" items. The server partitions the data item set D into D c and D h using the following simple rule. Let W ( D c) be the window size of the "cold" data items. Then, D c consists of those data items that have not been updated within the preceding W(D¢) seconds and D h includes the remaining data items.
ADAPTIVE CACHING ALGORITHMS
7
The window size W ( D h) of the "hot" data items is adjusted in a manner similar to the approach in the BATS algorithm, where D is replaced by O h . That is,
W( D h ) = [ W( D'h) + E t W( D'h) - E
if G( Dh) >~0 otherwise
if W(D~,) >/E
where G(Dh)=Q(Dh)b q - R ( D h ) ( l o g ( N ) + b T ) and W(D'h) is the window size f~r the "hot spot" set D~, in the last evaluation period ( D h is not neces:sarily the same as D~,). The window size W(D c) of the "cold spot" items is defined by the following equation:
W(D ) = [ LDT/BroadcastPeriod ~W(D'c) - ,
if L D T > W( D'c) * BroadcastPeriod otherwise if W(D') >~
where BroadcastPeriod is the broadcast period of invalidation reports, and L D T is the longest disconnection time in seconds of the client that sent an uplink to the server in the last evaluation period (note that the window size is defined as the number of broadcast periods). Note that some data items in D h may belong to the "cold spot" set D'c in the last evaluation period. Therefore, R ( D h) includes the number of times that these data items were mentioned in invalidation reports with window size W(D'c). Q(D h) is the total number of uplink queries for item set D h issued by clients after the caches of these items were falsely invalidated during the last evaluation period. Similarly, some data items in Dc may belong to the "hot spot" set D~, in the last evaluation period.
2.4. DISCUSSION In summary, these adaptive algorithms have the following key features that distinguish them from the basic AT algorithm: • The window sizes of the data items in both the BATS and HATS algorithms are dynamically adjusted according to the update frequencies of items. All data items share a common window size in the BATS algorithm, while there are two window sizes in the HATS
8
O. BUKHRES AND J. JING algorithm, one for "hot" data items and the other for remaining items in the database. • The size of an invalidation report in the TS algorithm can be expressed, as in [4], as nw(log(N) + by), where n w is the number of data items updated within w seconds (the window size of the TS algorithm), N is the number of data items in the database, and b v is the size in bits of each timestamp. The sizes of invalidation reports in the BATS and HATS algorithms are n w , ( l o g ( N ) + bT~) + b w and ( n c + n h ) ( l o g ( N ) + b y ) + 2 b w, respectively, where n w, is the number of data items updated within w' seconds (the window size of the BATS algorithm), n c and n h are the numbers of"cold" and "hot" data items updated within W ( D c) and W ( D h) seconds, respectively, and b w is the window length size in bits (note that both the BATS and HATS algorithms must broadcast the dynamically updated window sizes in their invalidation reports). • When the update rate is very low, the window sizes in both adaptive algorithms are expected to be larger than that in the TS algorithm. The HATS algorithm is expected to be able to distinguish the less frequently updated items (the "cold spot" items) from the frequently updated items (the "hot spot" items). The window size of "cold spot" items would be larger than that of the "hot spot" items.
These adaptive algorithms are anticipated to offer a low false cache invalidation ratio and higher cache hit ratio than the TS algorithm. We will explore these features of adaptive algorithms through our simulation experiments, which will be described in the rest of this paper.
3.
SIMULATION MODEL
The performance analysis presented here has been designed to compare the effects of different environmental parameters, such as disconnection time and query/update pattern, on the relative performances of the BATS and HATS algorithms and the TS algorithm proposed in [4]. Our model is similar to that employed in [5, 6] but has been extended to support message broadcasting over wireless channels. Our model also simplifies aspects of resource management in both client and server so that only CPU times are modeled in each. Such a simplification is appropriate to an assessment of algorithm performance in terms of the false invalidation ratio, buffer hit ratio, and wireless channel delay rather than I / O delay. In this simulation model, we assume that the system consists of a central data server and a fixed number of clients. As shown in Figure 1,
ADAIrFIVE C A C H I N G A L G O R I T H M S
9
Mobile ClientModel Query Generator
I
i ~anag~r I I ~e~anager I ResourceManager
Otheriiiit
Mobile Client,;
ListeningManager
Other Mobile Clients
Wireless NetworkManager
ResourceManager
BroadcastingManager
I
ServerManager "l
I
I
Update Generator
]
ServerModel Fig. 1. Simulation model.
each client comprises five modules. These are a ResourceManager, which models the client CPU time devoted to query processing; a Query Source, which generates query requests; a Client Manager, which executes the query requests, processes disconnection and reconnection operations, and monitors messages received from the server; a ListeningManager, which is
10
O. B U K H R E S A N D J. J I N G
in charge of listening for invalidation reports over the wireless channels; and a Cache Manager, which manages the client cache pool. The central server model has four modules: A Resource Manager models the server CPU time devoted to query and update processing; a Server Manager component coordinates the query requests from clients and updates requests from Update Source; an Update Source generates these update requests; and a Broadcasting Manager produces and broadcasts the invalidation reports. Client queries are submitted from mobile hosts. Each query requests only one data item and is submitted individually to the client. Upon the completion of one query, the client pauses for a random think time (with mean ThinkTime) or a random disconnection time (with mean DisconnectTime) and then begins a new query. For each query, the Client Manager must first call the Listening Manager, which will wait for the next invalidation report. The caches will be validated according to the received report. If a valid cache can be used to answer the query, the client returns the result immediately; otherwise, the query will be forwarded to the server and the cache will be refreshed. A client can enter a disconnection mode only after the current query has finished; if a query is processed at the server, then the client will wait for the return before it can go into a sleep mode.
3.1. DATABASE AND PHYSICAL RESOURCE MODEL The model parameters that specify the database and physical resources of the system are listed in Table 1. The database is modeled as a collection of DatabaseSize data items of ItemSize bytes each: We assume that there is
TABLE 1 Database and Resource Parameters Parameter ItemSize DatabaseSize NumClients ClientQryTime ClientBufSize ServerQryTime ServerUpdTime NetworkBandwidth ControlMsgSize BroadcastPeriod
Meaning Size of a data item in bytes Size of database in data items Number of mobile client hosts Service time for a query in a mobile client Per-client buffer size (% of database) Service time for a query in the data server Service time for an update in the data server Wireless network bandwidth Size of a control message on network, in bytes Broadcast period of invalidation reports, in seconds
ADA~I'IVE CACHING ALGORITHMS
11
one central data server that manages the database. In the Resource Manager module of the central data server, the CPU time (which is a constant) for processing a query is specified by the parameter ServerQryTime. The CPU time (which is a constant) for processing an update is specified by the parameter ServerUpdTime. All query and update requests are processed with the same priority on a first-come first-served basis. Although in reality there may be additional I / O time, this has been ignored for simplicity. We assume that the buffer pool in the central server is large enough to hold the entire database. T]ae number of mobile client hosts is specified by the NumClients parameter. In the Resource Manager module of each mobile client host, the CPU time (which is a constant) for processing a query is specified by the parameter ClientQryTime. Again, no I / O time is modeled in the Resource module. The size of client buffer pools (ClientBufSize) is specified as a percentage of the database size. The buffer pools are managed using an L R U replacement policy. In the Wireless Network Manager component, the network is modeled as a P1;'E_RES server (i.e., the service discipline is preempt resume, based on prio:rity) with a service rate of NetworkBandwidth. Invalidation report broadcasts have higher priority than other messages, ensuring that these reports can always be broadcast over the wireless channels with an exact bro~.dcast period specified by the parameter BroadcastPeriod. All other messages are of equal priority and will be served on a first-come first-served basis.
3.2. WORKLOAD MODELS Table 2 presents the parameters used to model access workloads. Each mobile client host generates a single stream of queries. The arrival of a new query is separated from the completion of the previous query by either an exponentially distributed think time with a mean of ThinkTime or an exponentially distributed disconnection time with a mean of DisconnectTime. Our model assumes that each client will enter into a disconnection mode once for every three consecutive queries. In other words, each group of three queries will be separated by a disconnection time, and these thre, e queries are separated from each other by a think time. At the server, a single stream of updates is generated. These updates are separated by an exponentially distributed update interarrival time with a mean of UpdateArrTime. The server will broadcast an invalidation report every BroadcastPeriod seconds.
12
O. B U K H R E S A N D J. J I N G TABLE 2 Workload Parameters Parameter
ThinkTime DisconnectTime HotQueryBounds ColdQueryBounds HotQueryProb UpdateArrTime HotUpdateBounds ColdUpdateBounds HotUpdateProb
Meaning Mean think time (in seconds) between queries in a connect mode Mean disconnect time (in seconds) between queries Data item bounds of hot query range Data item bounds of cold query range Probability of querying a data item in the hot query range Mean Interarrival Time (in seconds) between Updates Data item bounds of hot update range Data item bounds of cold update range Probability of updating a data item in the hot update range
Our model can specify the item access patterns of workloads, thus allowing different client locality types and different server update patterns to be easily specified. For each client, two (possibly overlapping) database regions can be specified. These regions are specified by the HotQueryBounds and ColdQueryBounds parameters. The HotQueryProb p a r a m e t e r specifies the probability that a query will address a data item in the client's " h o t " database region. Within each region, data items are chosen through a uniform distribution. For the data server, the HotUpdateBounds and ColdUpdateBounds parameters are used to specify the " h o t " and "cold" regions, respectively, for update requests. The HotUpdateProb p a r a m e t e r specifies the probability that an update will address a data item in the update's " h o t " database region.
4.
EXPERIMENTS AND RESULTS
A number of simulations were run to study the behavior of different cache invalidation algorithms under the conditions of various disconnection times and query and update r a t e s / p a t t e r n s . These experiments were designed to compare the effect of these parameters on such aspects of the performance of cache algorithms as the false invalidation ratio, cache hit ratio, query response time, and wireless network delay. No attempt was made to fully model an actual system. All simulations were performed on Sun Sparc Workstations running SunOS and using a CSIM simulation package [9].
ADAPTIVE CACHING ALGORITHMS 4.1.
13
ldETRICS A N D P A R A M E T E R SETTINGS
The primary performance metric is the false invalidation ratio in mobile clients, which is defined as the ratio of the number of all-dropping invalidation actions to the total number of both all-dropping and windowdropping invalidation actions. An all-dropping action will invalidate the entire cache of a client, while a window-dropping action only invalidates the stale caches that are indicated in the invalidation reports. The ratio is computed by dividing the sum of the all-dropping invalidation actions by the sum of all invalidation actions (including both all-dropping and window-dropping) in the simulation, Another metric in this study is the average query response time in the system. Query response time is computed by subtracting the time at which the query was requested from the time at which it was answered. In the invalidation report-based caching algorithms, a large invalidation report that contains more update information can reduce the false invalidation ratio but will increase traffic over the narrow wireless channels. This response time metric will help in understanding the performance trade-offs introduced by the invalidation report. Further insight on the performance of caching algorithms is provided by two additional metrics: the average wireless network delay per message and the cache hit ratio. The network delay is computed by subtracting the time at which the message transmission was requested from the time at which the transmission was completed over the network. Invalidation report messages are not included in this calculation. This metric is used to mea:~ure the effect of report sizes on query message delays. The cache hit ratio, is defined as the ratio of the number of queries that are answered using client caches to the total number of queries. Tables 3 and 4 present the database and workload parameter settings used in our simulation experiments. Table 3 contains default settings that are common to all experiments, except where otherwise specified. The database size is 1000 data items with a data item size of 8 kilobytes. The number of mobile clients is set at 100, and the mean client think time is 100 seconds. The client buffer size is set at 25% of database size. The client CPU time for processing a query is set at 0.01 seconds. The server CPU times for processing a query and an update are set at 0.01 seconds and 0.02 seconds, respectively. The control message size is 512 bytes. The broadcasting period for invalidation reports is 10 seconds. To observe the effects of the update rate and the disconnection time on the false invalidation ratio in various caching algorithms, the update interarrival time is set to 10,000 seconds and the disconnection time is varied from 200 to 10,000 seconds.
14
O. B U K H R E S AND J. JING TABLE 3 Simulation Parameter Settings Parameter
Setting
ItemSize DatabaseSize ClientBufSize NumClients ThinkTime ClientQryTime ServerQryTime ServerUpdTime NetworkBandwidth ControlMsgSize BroadcastPeriod DisconnectTime UpdateArrTime
8192 bytes 1000 data items 25% of database size 100 mobile client hosts 100 seconds 0.01 seconds 0.01 seconds 0.02 seconds 10,000 bits per second 512 bytes 10 seconds 200 to 10,000 seconds 10,000 seconds
Table 4 describes the range of workloads associated with access patterns considered in this study. These workloads are very similar to those described under the same names in [6]. The U N I F O R M workload is a low-locality workload, in which caching is not expected to reap significant benefits. The H O T C O L D workload has a high degree of locality of client queries. In our experiments, we will examine how changing access workloads will impact the false invalidation ratio of each algorithm. To simulate the BATS, HATS, and TS algorithms, additional algorithm-specified parameters rameters and their settings.
are needed.
Table 5 describes these pa-
TABLE 4 Workload Parameter Settings Parameter HotQueryBounds ColdQueryBounds HotQueryProb HotUpdateBounds ColdUpdateBounds HotUpdateProb
UNIFORM
HOTCOLD
-all DB --all DB --
-all DB -1 to 200 remainder of DB 0.8
ADAPTIVE CACHING ALGORITHMS
15
TABLE 5 Algorithm Parameter Settings Parameter
Meaning
Setting
a, e •
The time period during which updates are reported in TS The time period during which the window sizes are evaluated The threshold for the adjustment of window sizes
100 100 2
4.2.
,EXPERIMENT 1: UNIFORM W O R K L O A D
We will first examine the performance results for the U N I F O R M workload. In this workload, as indicated in Table 4, each query reads a data item chosen uniformly from among all the data items in the database. Also.. each update request chooses a data item uniformly from all the data items. In this workload, both query and update parameters display no locality of access. Figures 2 through 5 show the experimental results achieved with the U N I F O R M access workload and a mean update interarrival time of 10,000 seconds.
H []
: HATS [ ] : BATS
1.0 0.9 0.8 0.7 o
0.6 --~ 0.5 ~ 0.4 0.3 0.2
X
..'"
>(
v
X. . . .
v
_.-E]
0.1 2000 4000 6000 8000 10000 Mean Disconnection Time Fig. 2.
All-dropping invalidation ratio ( U N I F O R M , update rate = 0.0001).
16
O. B U K H R E S A N D J. JING ~,~ ~ " T S 1.0 °
0.90.8o
0.70.60.5 0.4 0.30.2 0"llM
M "~
~
~
I~
I~
~]
2000 4000 6000 80})0 10000 Mean Disconnection Time Fig. 3.
Buffer hit ratio (UNIFORM, update rate = 0.0001).
2,0"
1.8 1.6 1.41.21.00.8 0.6 0.40.22(k)0 4000 6(k)0 8(J00 10000 Mean Disconnection Time Fig. 4.
Network delay per message (UNIFORM, update rate = 0.0001).
ADAPTIVE CACHING ALGORITHMS
17
: HATS : BATS 1~ ~.~: TS 2.0 1,81 1,6 1.4 ~ 1.2 ~ ].0
S°.fi 0"6 0.4t 0.2 2(J00 4000 6000 8000 10(~00 Mean DisconnectionTime Fig. 5. Response time per query (UNIFORM, update rate = 0.0001).
As expected, the false invalidation ratio of the TS algorithm is very close to 1:3. Approximately one query in three is processed after the entire cache has been dropped. This observation is consistent with our query workload model, in which a client will enter into a disconnection mode once for every three consecutive queries and these three queries are separated from each other by a think time. The model implies that the entire cache will be dropped once for every three queries. In the simulation, the mean think time is much shorter than the disconnection time. Only window droppings are needed for the two additional queries that follow a think time. The false invalidation ratios of both the BATS and HATS algorithms are lower than that for TS. The false invalidation ratio of t t A T S is consistently lower than that of BATS for all disconnection times. These results indicate that both the BATS and HATS algorithms effectively reduce the false invalidation rate of caching algorithms and that the HATS algorithm performs better than BATS in terms of the false invalidation rate.
18
O. B U K H R E S AND J. JING
A comparison of Figure 2 to Figure 3 reveals that an algorithm that has a lower false invalidation ratio will have a higher buffer hit ratio. However, the increasing rate of the false invalidation ratio is not necessarily proportional to the decreasing rate of the buffer hit ratio. For example, throughout the increase in disconnection time from 200 to 10,000, the false invalidation ratio of HATS increases very slowly, while the buffer hit ratio decreases from approximately 0.43 to 0.05. This discrepancy arises because the buffer hit ratio is impacted not only by the false invalidation ratio, but also by other factors such as the server update rate, client access pattern, buffer replacement, etc. Here, increases in disconnection time are accompanied by a decrease in buffer hit ratio, since more cached data is likely to be updated. We also observe that a disconnection time between 200 and 2000 is associated with a rapid increase in the buffer hit ratios of both the BATS and the HATS algorithms. Two elements contribute to this behavior. First, the false invalidation ratios of both algorithms are low when disconnection times are short. Second, in this simulation, a client that sleeps less will generate a larger number of queries. Because the update rate does not vary with changes in client disconnection time, the ratio of updates to queries in the simulation will decrease when client disconnection times decrease. Consequently, the low ratio of updates to queries will increase the buffer hit ratio. Figure 4 indicates that the disconnection time has little impact on the network delays involved with any of the algorithms. This is because network traffic is not very high, even when disconnection times increase and buffer hit ratios decrease. Furthermore, it is evident that the network delay has little impact on the query response time, since the network delays for all three algorithms are almost identical for all disconnection times. As a result, the differences of response times among the TS, BATS, and HATS algorithms noted in Figure 5 can be explained as the result of the differing buffer hit ratios of these algorithms.
4.3.
E X P E R I M E N T 2: H O T C O L D WORKLOAD
A second set of experiments was conducted with the H O T C O L D workload. In this workload, 80% of the server updates are directed to 20% of the database. Each query request chooses a data item uniformly from all data items. Thus, this workload represents a situation in which server updates favor disjoint local hot regions of the database.
ADAPTIVE CACHING ALGORITHMS
19
Figures 6 through 9 depict the experimental results achieved with the HOTCOLD workload. A comparison with the previous experiment indicates that the behavior of the HATS algorithm remains almost unchanged with different access workloads (UNIFORM versus HOTCOLD). Although the performance of the HATS exceeds that of both the BATS and TS algorithms for either workload, its own performance parameters (including buffer hit ratio and response time) remain almost unchanged for the two workloads. The low update rate in these experiments does not perr~it the HATS algorithm to clearly distinguish the "hot spot" from the "uniform" access. Nonetheless, the HATS algorithm does perform better than both the BATS and TS algorithms for both workloads. This suggests that the HATS algorithm does indeed provide a larger window for some "updatecold" items than do the BATS and TS algorithms. This large window provides HATS with superior performance in increases of long client disconnection times in these workloads. As was found for the UNIFORM workload, the disconnection time has little impact on the network delays associated with all the simulated
: HATS : BATS ~,~ : TS 1,00.90.80.7.2 "~ 0.6 ~0.5 -
~
0
.
4
0.3 0.2 0.1 2000 Fig. 6.
4000 6000 8000 113000 Mean Disconnection Time
A l l - d r o p p i n g invalidation ratio ( H O T C O L D ,
u p d a t e rate = 0.0001).
20
O. B U K H R E S A N D J. JING ~--~: TS 1.00.90.8.~ 0.7 ° .*~
0.6 0.5 0.4 0.3 0.2
m
~
5"
5"
0.1
2~
40bo 6000 8000 10000
Mean Disconnection Time Fig. 7.
Buffer hit ratio ( H O T C O L D , update rate = 0.0001).
2.0 1.8 1.6
~
1.4 1.2 1.0
~: 0.8 0.6 0.4
B~-~_"
_--~
..~
_"
_--~
2000 4000 6000 8000 Mean Disconnection Time
10(~0
0.2 i
Fig. 8.
.......
i
N e t w o r k delay per message ( H O T C O L D , update rate = 0.0001).
ADAPTIVE CACHING ALGORITHMS
21
2.0-
1.81.61.4I
.~. 1.2-
o6t 0.4 0.2 I
I
!
!
2000 4000 6000 8000 Mean Disconnection Time
I
10000
Fig. 9. Response time per query (HOTCOLD, update rate = 0.0001).
algorithms. Again, this is because network traffic will not reach very high levels, even when the disconnection time increases and the buffer hit ratio decreases in the experiment.
4.4. EXPERIMENT 3: UNIFORM VERSUS HOTCOLD, HIGHER UPDATE RATE
I:a a final experiment, the simulation program was run with both U N I F O R M and H O T C O L D workloads at an increased update rate of 0.0131. Figures 10 and 11 show the buffer hit ratio and query response time of the HATS and BATS algorithms with these parameters. This experimerit demonstrates that the HATS algorithm is indeed capable of adapting to [he changed workload parameter. Figure 10 illustrates that at an update rate of 0.001, the buffer hit ratio of HATS under the H O T C O L D workload is between 0.03 and 0.05 higher than under the U N I F O R M workload. The HATS algorithm under the H O T C O L D workload offers a consistently superior performance in response time than under the U N I F O R M workload. In contrast, the performance of the BATS algorithm under different access workload parameters changes so little that the changes are undetectable in these figures.
22
O. B U K H R E S AND J. JING
H
: HATS,HOTCOLD : HATS,UNIFORM
1.0-
0.90.80.7o
0.60.50.40.3 ~
0
.
2
~
0.1 2000 4000 6000 8000 10000 Mean DisconnectionTime Fig. 10. Buffer hit ratio (UNIFORM versus HOTCOLD, update rate = 0.001).
The increased update rate employed in these last experiments makes highly evident the capability of the HATS algorithm to adjust to changes in workload parameters.
5.
PREVIOUS WORK
Many caching algorithms have been recently proposed for the conventional client-server architecture in which the positions and wired-network connections of clients are fixed. A comprehensive discussion and comparison of caching algorithms in the conventional client-server architecture can be found in [6]. The issue of false invalidation does not exist in this architecture because, as shown in the algorithms discussed in [6], either the server can directly invalidate client caches or clients can query the server for the validation of their caches. In both cases, only obsolete caches will be invalidated. In [4], issues of caching in a wireless mobile environment were first introduced. An invalidation report approach was proposed for managing
ADAPTIVE CACHING ALGORITHMS
23
: BATS, HOTCOLD O--"Q) : BATS, UNIFORM 2.0-
1.8],6-
1.4..~ 1.2~ 1.0~ ~ , , . _ ~ ,
.
.
.
.
0,6 0"4t 0.2 ,
,
2 4000 6000 8 Mean Disconnection Time
,
10000
Fig. 1!~. Response time per query (UNIFORM versus HOTCOLD, update rate = 0.001).
caching in this environment. Three algorithms incorporating invalidation reports were presented. The first, called Broadcasting Timestamps (TS), periodically broadcasts the timestamps of the latest changes for items that have been updated in the last w seconds. The second algorithm, called Amnesic Terminals (AT), broadcasts only the identifiers of those items that have changed since the last invalidation report. The third algorithm, called Signatures (SIG), broadcasts a set of combined signatures of data items. 1 Changes to items are revealed by comparing the cached and broadcast signatures. In both the TS and A T algorithms, clients must invalidate their entire cache when their disconnection period exceeds a specified length (w seconds for TS and L seconds for AT). In the SIG
Signatures are checksums computed over the value of data items in the database. A combined signature is the Exclusive OR of ~1 set of individual signatures. Each combined signature, therefore, represents a subset of data items. In the SIG algorithm, rn combined signatures are computed such that an item i is in the set of combined signature Sj (1 ~
24
O. BUKHRES AND J. JING
algorithm, the structure and size of these signatures are designed to diagnose up to f different items. If more than f different items in the data server were updated since the combined signatures were last cached, most items cached by the clients will be invalidated by the SIG algorithm, although many are in fact valid. An explanation of this observation can be found in [8]. Thus, these existing algorithms are effective for a client in terms of a low ratio of false invalidation to the total invalidation only if the client has not disconnected for a period that exceeds an algorithmspecified parameter (e.g., w or L) or if the number of updated items during the disconnection period is not greater than an algorithm-specified parameter (e.g., f). It has been shown in [4] that when the update rate is low, the SIG algorithm is best suited to clients that are often disconnected, while the TS algorithm is advantageous for clients that are usually connected. The AT algorithm is best suited to update intensive scenarios, provided that the clients are awake most of the time. In [8], we presented a caching invalidation algorithm, called Bit-Sequences (BS), that offers a lower false invalidation rate than the AT, TS, and SIG algorithms in situations with changing client disconnection times and update rates. However, the BS algorithm, like the SIG algorithm, must periodically broadcast an invalidation report of fixed size, regardless of the real number of data items updated or the update rate. In comparison to the BS or SIG algorithms, TS-based adaptive algorithms offer numerous advantages in an environment in which the update rate is very low. These adaptive algorithms are designed to support long client disconnections in such an environment with small invalidation reports. While the AT algorithm would also broadcast small invalidation reports in a low update environment, this algorithm is not well suited for long disconnections. It is generally difficult to support such long disconnections by extending the window size of the AT algorithm, since the window size within which the updates are broadcasted is equal to the broadcast period of invalidation reports. In the AT algorithm, a large window size results in extended query-processing latencies, since clients must listen to the invalidation report before they can answer a query. Support of long disconnections should not be achieved by sacrificing query processing response time. The idea of adapting the window size of the TS algorithm to support long client disconnections is not new. The motivation for such an adaptation was discussed in [3], where two approaches to adaptive invalidation reports were provided. These approaches adjust the window size for each data item according to changes in update rates and reference frequencies
ADAPTIVE CACHING ALGORITHMS
25
for the item. While similar in spirit, the algorithms presented here differ in that tlhe window size is adjusted for the entire database (in the BATS algorithm) or for the "hot spot" or "cold spot" portions of the database (in the I-]~ATS algorithm) rather than for each data item. This difference results in highly streamlined algorithm performance. With the approach presented in [3], a client must know the exact window size for each item before using an invalidation report. These sizes must therefore be contained in each report for the client to be able to correctly invalidate its caches. Difficulties might arise if the window size for a data item is decreased during a client disconnection period. After the client wakes up, the absence of information regarding the new window size may cause it to falsely conclude the data item is still valid. The approaches in [3] will therefore require the invalidation reports to allocate extensive space to window size information for all data items. For this reason, we did not conduct simulation experiments to compare these algorithms with those proposed in this paper.
6.
SUMMARY AND CONCLUDING REMARKS
In this paper, we have presented two adaptive cache invalidation algorithms, called Basic Adaptive TS (BATS) and Hybrid Adaptive TS (HATS), in which a periodically broadcast invalidation report is organized with adjustable window sizes. The performance of the two algorithms has been compared to that of its progenitor, the Broadcasting Timestamps (TS) algorithm proposed in [4]. The two adaptive algorithms were shown to be more effective than the TS algorithm in that they offer a low false invalidation ratio in a context of such unpredictable workload parameters as update rate and pattern and client disconnection time. Furthermore, the size of the invalidation report used in these algorithms is dynamically adju,;ted. The experiments presented in Sections 4.2 through 4.4 examined the performance of the TS, BATS, and HATS algorithms under different disconnection times, update rates, and access workloads. In general, the HATS algorithm performs better than the BATS and TS algorithms. The false invalidation ratio of the TS algorithm depends heavily on the parameters of disconnection time and the update rate. It must be noted that the HATS algorithm adapts well to changes in workload parameters only when the update rate is not very low, although it performs consistently better than both the BATS and TS algorithms under
26
O. B U K H R E S A N D J. JING
different workload parameters. This performance suggests that the HATS algorithm cannot readily distinguish between the "hot spot" and "uniform" access. The research presented here will be extended to the development of an algorithm better capable of distinguishing "hot spots" and "cold spots." Nonetheless, the HATS algorithm does perform better than both the BATS and TS algorithms under two different workload parameters. This behavior suggests that the HATS algorithm indeed provides a larger window for some less frequently updated items than do the BATS and TS algorithms. This large window size for the "cold" items of updates enables the HATS algorithm to perform better than the BATS and TS algorithms with long client disconnections. In this paper, we have not discussed the performance of these algorithms in a situation in which clients are often connected. This aspect has not been addressed as in this paper. We are more interested in the false invalidation of these algorithms and its effect on their performance. The false invalidation problem becomes serious only when these algorithms are placed under conditions of long client disconnection times and changing update and query rates. In a mobile environment, it is highly desirable to provide a cache invalidation algorithm that adapts dynamically when environment parameters change unexpectedly. This adaptability is motivated by the observation that the frequent disconnection and movement of mobile clients renders the system environment highly unpredictable. A flexible algorithm will be less severely impacted by these changing environmental parameters. In this paper, we have shown that this adaptability can be improved by utilizing information regarding both the update rate and the query workload.
REFERENCES 1. R. Alonso and H. Korth, Database issues in nomadic computing, in Proc. A C M SIGMOD Conf. on Management of Data, 1993, pp. 388-392. 2. B. R. Badrinath, A. Acharya, and T. Imielinski, Structuring distributed algorithms for mobile hosts, in Proc. 14th Internat. Conf. on Distributed Computing Systems, Poznan, Poland, June 1994. 3. D. Barbara and T. Imielinski, Adaptive stateless caching in mobile environments: An example, Technical Report MITL-TR-60-93, Matsushita Information Technology Laboratory, 1993. 4. D. Barbara and T. Imielinski, Sleepers and workaholics: Caching strategies for mobile environments, in Proc. A C M SIGMOD Conf. on Management of Data, 1994, pp. 1-12. 5. M. J. Carey, M. J. Franklin, M. Livny, and E. Shekita, Data caching tradeoffs in client-server dbms architectures, in Proc. A C M SIGMOD Internat. Conf. on Management of Data, 1991.
ADAPTIVE
CACHING
ALGORITHMS
27
6. M. 3. Franklin, Caching and memory management in client-server database systems, Ph.D. dissertation, University of Wisconsin, Madison, WI, 1993. 7. T. lmielinski and B. R. Badrinath, Wireless mobile computing: Challenges in data management, Comrnun. of ACM 37(10) (1994). 8. J. Jing, O. Bukhres, and A. Elmagarmid, Bit-sequences: A cache invalidation algorithm in mobile environments, Technical Report CSD-TR-94-074, Department of Computer Science, Purdue University, 1994. 9. H. Schwetman, Csim user's guide (version 16), MCC Corporation, 1992. Received 1 May 1994