Debian Codegraph @

docs/programmer_reference/rep_clock_skew.html

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <title>Clock Skew</title>
7 <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9 <link rel="start" href="index.html" title="Berkeley DB Programmer's Reference Guide" />
10 <link rel="up" href="rep.html" title="Chapter 12.  Berkeley DB Replication" />
11 <link rel="prev" href="rep_ryw.html" title="Read your writes consistency" />
12 <link rel="next" href="repmgr_channels.html" title="Using Replication Manager message channels" />
13 </head>
14 <body>
15 <div xmlns="" class="navheader">
16 <div class="libver">
17 <p>Library Version 11.2.5.3</p>
18 </div>
19 <table width="100%" summary="Navigation header">
20 <tr>
21 <th colspan="3" align="center">Clock Skew</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="rep_ryw.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 12. 
26 Berkeley DB Replication
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="repmgr_channels.html">Next</a></td>
29 </tr>
30 </table>
31 <hr />
32 </div>
33 <div class="sect1" lang="en" xml:lang="en">
34 <div class="titlepage">
35 <div>
36 <div>
37 <h2 class="title" style="clear: both"><a id="rep_clock_skew"></a>Clock Skew</h2>
38 </div>
39 </div>
40 </div>
41 <p>Since master leases take into account a timeout that is used across
42 all sites in a replication group, leases must also take into account
43 any known skew (or drift) between the clocks on different machines
44 in the group. The guarantees provided by master leases take clock
45 skew into account. Consider a replication group where a client's
46 clock is running faster than the master's clock and the group has
47 a lease timeout of 5 seconds. If clock skew is not taken into
48 account, eventually, the client will believe that 5 seconds have
49 passed faster than the master and that client may then grant its
50 lease to another site. Meanwhile, the master site does not believe
51 5 seconds have passed because its clock is slower, and it believes
52 it still holds a valid lease grant. For this reason, Berkeley DB compensates
53 for clock skew.</p>
54 <p>The master of a group using leases must account for skew
55 in case that site has the slowest clock in the group. This computation
56 avoids the problem of a master site believing a lease grant is valid
57 too long. Clients in a group must account for skew in case they
58 have the fastest clock in the group. This computation avoids
59 the problem of a client site expiring its grant too soon and
60 potentially granting a lease to a different site. Berkeley DB uses
61 a conservative computation and accounts for clock skew on both
62 sides, yielding a double compensation.</p>
63 <p>The <a href="../api_reference/C/repclockskew.html" class="olink">DB_ENV-&gt;rep_set_clockskew()</a> method takes the values for both the fastest
64 and slowest clocks in the entire replication group as parameters.
65 The values passed in must be the same for all sites in the group.
66 If the user knows the maximum clock drift of their sites, then those
67 values can be expressed as a relative percentage. Or, if the user
68 runs an experiment then the actual values can be used.</p>
69 <p>For example, suppose the user knows that there is a maximum drift
70 rate of 2% among sites in the group. The user should pass in
71 102 and 100 for the fast and slow clock values respectively.
72 That is an unusually large value, so suppose, for example, the
73 rate is 0.03% among sites in the group. The user should pass in
74 10003 and 10000 for the fast and slow clock values. Those values
75 can be used to express the level of precision the user needs.</p>
76 <p>An example of an experiment a user can run to help determine skew
77 would be to write a program that started simultaneously on all
78 sites in the group. Suppose, after 1 day (86400 seconds), one
79 site shows 86400 seconds and the other site shows it ran faster
80 and it indicates 86460 seconds has passed.
81 The user can use 86460 and 86400 for their parameters for the
82 fast and slow clock values.</p>
83 <p>Since Berkeley DB is using those fast and slow clock values to compute
84 a ratio internally, if the user cannot detect or measure any
85 clock skew, then the same value should be passed in for both
86 parameters, such as 1 and 1.</p>
87 </div>
88 <div class="navfooter">
89 <hr />
90 <table width="100%" summary="Navigation footer">
91 <tr>
92 <td width="40%" align="left"><a accesskey="p" href="rep_ryw.html">Prev</a> </td>
93 <td width="20%" align="center">
94 <a accesskey="u" href="rep.html">Up</a>
95 </td>
96 <td width="40%" align="right"> <a accesskey="n" href="repmgr_channels.html">Next</a></td>
97 </tr>
98 <tr>
99 <td width="40%" align="left" valign="top">Read your writes consistency </td>
100 <td width="20%" align="center">
101 <a accesskey="h" href="index.html">Home</a>
102 </td>
103 <td width="40%" align="right" valign="top"> Using Replication Manager message channels</td>
104 </tr>
105 </table>
106 </div>
107 </body>
108 </html>