1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
4 <title>DLIFE distributed architecture reference</title>
7 <body bgcolor="#ffffff">
8 <h1>DLIFE distributed architecture reference</h1>
11 DLIFE is distributed, meaning that many people
12 may allocate their spare computing cycles and
13 memory in order to form something which approximates
14 a very large single soup. Actually modelling a
15 very large soup, however, would be very difficult:
16 such a program would have a high communication
17 overhead, would be totally unsuitable to run on
18 the Internet, and adding nodes to this would bring
19 diminishing returns. Therefore DLIFE uses a simpler
20 model: individual computers run small soups, and
21 from time to time, soups exchange a few cells at
22 random with each other. In effect we form a series
23 of islands connected by archipelagoes.
29 There are currently three processes involved:
33 <li> <b>dlife_soup</b>: This program runs continuously,
34 one on each client CPU, simulating a single soup.
35 It is written in C and designed to be as small and
36 fast as possible. This is the only part of DLIFE which
37 clients need to run all the time.
38 <li> <b>dlife_client.pl</b>: This is a Perl script which
39 runs infrequently (normally once per hour, but it
40 could be more or less often, or it could be run
41 on-demand when a PPP connection is brought up). The Perl script is
42 responsible for exchanging cells with the DLIFE server.
43 <li> <b>dlife_server.pl</b>: This is the DLIFE server
44 script. It only runs on servers (obviously). It acts
45 as a repository for cells being exchanged between
50 The following diagram shows the interaction between these
54 <img src="archproc.gif"
55 alt="[Diagram] Interaction between DLIFE processes"
59 As shown, there are five client computers and two
60 servers. The second client computer has two CPUs,
61 and runs dlife_soup continuously on both. The
62 third client computer is connected to the Internet
63 by a modem, and so runs dlife_client.pl from
64 <tt>/etc/ppp/ip-up.local</tt> (this script runs whenever
65 the Internet connection is brought up). All the
66 other computers are permanently connected to the
67 Internet, and dlife_client.pl runs periodically
68 from <tt>cron</tt>. Clients may connect and exchange
69 cells with more than one server. In the diagram
70 above, the third client computer connects to
74 <h2>Cells in files</h2>
77 The long-running dlife_soup program does not
78 contain any network code. All network communications
79 are handled by dlife_client.pl. Instead, dlife_soup
80 contains code to save and load cells to files.
84 dlife_soup saves (by default) six cells per hour,
85 at random, into the directory:
89 <tt>/var/spool/dlife/outgoing/</tt>
93 dlife_soup loads (by default) four cells per hour,
94 at random, from the directory:
98 <tt>/var/spool/dlife/incoming/</tt>
102 The dlife_client.pl program takes some cells at
103 random from the <tt>outgoing</tt> spool
104 directory and uploads them to one or more servers
105 (see the <a href="#conf">configuration section</a>
106 below). It then asks the server(s) to send some
107 cells, and it saves these in the <tt>incoming</tt>
112 The dlife_server.pl program listens for client
113 connections, and uploads or downloads cells. It
114 saves its cells in the directory:
118 <tt>/var/spool/dlife/store/</tt>
121 <h2>DLIFE network protocol</h2>
124 The DLIFE network protocol is a very simple
125 ASCII based protocol, similar to (but much
126 more limited than) FTP.
130 Servers listen for connections on port 5904.
131 When a client connects, they send back the following
136 DLIFE SERVER <version> <protocol> <CR> <LF>
140 <tt><version></tt> is the server version, for
145 <tt><protocol></tt> is the protocol version. The
146 protocol described below is version 1.x (for some digit
147 ``x''). If a server reports a different major version
148 number (eg. 2.x) then this is an indication that the
149 protocol has changed dramatically and current clients
150 should give up and abort.
154 Clients connect to servers on port 5904 and
155 issue a series of simple four letter commands.
156 Each command should take the form:
160 <command> [ <space> <arguments ...> ] <CR> <LF>
164 There are currently four commands: <tt>HELO</tt>,
165 <tt>STOR</tt>, <tt>RETR</tt> and <tt>QUIT</tt>.
169 Servers respond to commands with a three digit
170 response code and some optional human-readable text:
174 XYZ [ <space> text ... ] <CR> <LF>
178 Of the response code, only the first digit (``<tt>X</tt>'')
179 is meaningful to clients. As for FTP, this digit can
180 have the following meanings:
185 <th> Response code </th> <th> Meaning </th>
189 <td> Command OK. Ready to send data, <i>or</i> ready
195 <td> Command OK. Ready for your next command.
200 <td> Temporary error. The client can retry the last command
201 without modification and it may well succeed next time.
206 <td> Error. The client should not just retry the same
207 command, but needs to reformulate the command or
208 cancel the operation and report an error back to the
214 <h3>The HELO command</h3>
217 The <tt>HELO</tt> command has the following form:
221 HELO <space> <client_hostname>
222 <space> <client_version> <CR> <LF>
226 where <client_hostname> is the client
227 hostname (or the client may just send "-" character)
228 and <client_version> is the client version
229 number, used just for information only.
233 The server should always respond with 2xx to
238 A typical interaction:
246 <h3>The STOR command</h3>
249 The <tt>STOR</tt> command is used to upload a single
254 The format of the command is:
258 STOR <CR> <LF>
262 If the server accepts the command and is ready to
263 upload a cell, it will reply with a 1xx response.
264 The client should then send the cell as a series
265 of hex nybbles, terminated by the sequence
266 <tt><CR> <LF> . <CR> <LF></tt>.
270 A typical interaction:
275 < 100 Send me the cell, terminated by ".".
276 > 00000000010901010100002227
277 > 0000000100FFFFFFFFFFFFFFFF
280 > 00010000002402020202020202022027
283 < 200 Cell was uploaded OK.
287 Servers will typically have limitations on the
288 number and type of cells that they will accept.
289 Generally they will only accept a small number
290 of uploads per session, and each cell will be
291 limited to 8192 bytes or less.
294 <h3>The RETR command</h3>
297 The <tt>RETR</tt> command is used to download
298 a cell from the cell bank. The format of the command
303 RETR <CR> <LF>
307 If the server is ready to serve a cell, it will
308 reply with a 1xx response, followed by a series
309 of hex nybbles and terminated by the
311 <tt><CR> <LF> . <CR> <LF></tt>
312 and immediately followed by a 2xx response.
316 A typical interaction:
321 < 100 OK. Sending you a cell.
322 < 00000000010901010100002227
323 < 0000000100FFFFFFFFFFFFFFFF
326 < 00010000002402020202020202022027
329 < 200 Cell was sent OK.
332 <h3>The QUIT command</h3>
335 The <tt>QUIT</tt> command terminates a session
336 (clients may also just close a session).
340 The format of the command is:
344 QUIT <CR> <LF>
348 The server responds with a 2xx message and then
349 closes its end of the connection.
353 A typical interaction:
359 <i>(socket is closed)</i>
362 <a name="conf"><h2>Configuration files</h2></a>
364 <h3>/etc/dlife/client.conf</h3>
367 This file is used to configure the network client.
368 The file tells the client which server or servers
373 The client can be configured to:
377 <li> Download a list of servers from a web page.
378 <li> Contact only servers in the current ``zone'' (eg.
379 only servers in the UK or Europe). And/or:
380 <li> Contact servers directly by name.
383 <h4>server_url command</h4>
386 The <tt>server_url</tt> command may be optionally
387 given. It directs the client to download the web
388 page given in the URL. The web page should contain
389 a master list of servers.
393 server_url <a href="http://dlife.annexia.org/servers.txt">http://dlife.annexia.org/servers.txt</a>
396 <h4>server_zone command</h4>
399 The <tt>server_zone</tt> command is optional. It
400 should be used in conjunction with the
401 <tt>server_url</tt> command. It
402 directs the client to only consider servers
403 in the particular zone or zones listed.
411 server_zone <zone> [<zone> [...]]
415 Each <tt><zone></tt> argument should have the
420 <li> An ISO3166 country code, eg. <tt>uk</tt>, <tt>us</tt>. Or:
421 <li> A geographical continent, eg. <tt>eu</tt>. Or:
422 <li> A domain name, preceeded by a dot ("."),
423 eg. <tt>.bibliotech.net</tt>.
426 <h4>server command</h4>
429 The <tt>server</tt> command directs the client to
430 connect directly the server or servers listed.
434 server dlife1.bibliotech.co.uk dlife2.bibliotech.co.uk
437 <h4>max_cells_upload_per_pass command</h4>
440 The <tt>max_cells_upload_per_pass</tt> directs
441 the client to attempt to upload this many cells
442 in a pass. Note that the server probably imposes
446 <h4>max_cells_download_per_pass command</h4>
449 The <tt>max_cells_download_per_pass</tt> directs
450 the client to attempt to download this many cells
451 in a pass. Note that the server probably imposes
452 its own limit. It is a good idea to ensure that
453 <tt>max_cells_upload_per_pass</tt> >
454 <tt>max_cells_download_per_pass</tt>.
457 <h3>/etc/dlife/soup.conf</h3>
460 The <tt>soup.conf</tt> file configures various
461 internal aspects of the DLIFE virtual machine.
462 For full documentation, please see the example
463 file provided with the source distribution.
466 <h2>Typical configurations</h2>
468 <h3>Default configuration</h3>
483 <address><a href="mailto:rich@annexia.org">Richard Jones</a></address>
484 <!-- Created: Sat Oct 7 10:12:59 BST 2000 -->
486 Last modified: Wed Oct 11 23:19:19 BST 2000