-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharticle-distributed.html
More file actions
executable file
·455 lines (421 loc) · 27.9 KB
/
article-distributed.html
File metadata and controls
executable file
·455 lines (421 loc) · 27.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
<!DOCTYPE html>
<html lang="en">
<head>
<!--__RIM_REDIRECT__-->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@300..700&display=swap" rel="stylesheet">
<title>How to write distributed applications</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="HandheldFriendly" content="True"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="canonical" href="https://rimstone-lang.com/article-distributed.html" />
<style>
body, html {
font-family: Quicksand,monospace,Helvetica, Arial, sans-serif;
line-height: 150%;
font-size:16px;
}
body {
padding-left:1vw;
padding-right:1vw;
}
.ncode {
letter-spacing: 0px;
font-family: monospace;
font-size:83%;
display:inline-block;
max-width:99%;
min-width:90%;
margin:0;
padding:0;
padding-left:5px;
padding-top:3px;
padding-bottom:3px;
margin-bottom:8px;
margin-top:8px;
border: 2px solid #d6d6d6;
background-color:#f5f7f4;
white-space:nowrap;
}
.shcode {
letter-spacing: 0px;
font-family: monospace;
font-size:83%;
display:inline-block;
max-width:99%;
min-width:90%;
margin:0;
padding:0;
padding-left:5px;
padding-top:3px;
padding-bottom:3px;
margin-bottom:8px;
margin-top:8px;
border: 2px solid #d6d6d6;
background-color:#f5f7f4;
white-space:nowrap;
}
.sqlcode {
letter-spacing: 0px;
font-family: monospace;
font-size:83%;
display:inline-block;
max-width:99%;
min-width:90%;
margin:0;
padding:0;
padding-left:5px;
padding-top:3px;
padding-bottom:3px;
margin-bottom:8px;
margin-top:8px;
border: 2px solid #d6d6d6;
background-color:#f5f7f4;
white-space:nowrap;
}
.htmlcode {
letter-spacing: 0px;
font-family: monospace;
font-size:83%;
display:inline-block;
max-width:99%;
min-width:90%;
margin:0;
padding:0;
padding-left:5px;
padding-top:3px;
padding-bottom:3px;
margin-bottom:8px;
margin-top:8px;
border: 2px solid #d6d6d6;
background-color:#f5f7f4;
white-space:nowrap;
}
.code {
letter-spacing: 0px;
font-family: monospace;
font-size:83%;
display:inline-block;
max-width:99%;
min-width:90%;
margin:0;
padding:0;
padding-left:5px;
padding-top:3px;
padding-bottom:3px;
margin-bottom:8px;
margin-top:8px;
border: 2px solid #d6d6d6;
background-color:#f5f7f4;
white-space:nowrap;
}
/*Just like h1 but for pdf conversion it would be indented this way it's not*/
.vhub {
display: block;
font-size: 1.6em;
margin-top: 0.63em;
margin-bottom: 0.63em;
margin-left: 0;
margin-right: 0;
font-weight: bold;
}
/*Just like h2 but for pdf conversion it would be indented this way it's not*/
.vsub {
display: block;
font-size: 1.25em;
margin-top: 0.53em;
margin-bottom: 0.53em;
margin-left: 0;
margin-right: 0;
font-weight: bold;
}
ul {
margin-left: 0.75vw;
padding-left: 0;
}
li {
margin-left: 0.75vw;
padding-left: 0;
}
/* this must be last, as it overrides previous settings, for mobile */
@media (hover: none) {
a {
display: inline-block;
padding-top: 3px;
padding-bottom: 2px;
}
body {
padding-left:2vw;
padding-right:2vw;
letter-spacing: 1px;
}
}
/*The following is for code snippets that are highlighted by 2html vim*/
pre { overflow-x: scroll; margin:0; padding:0; font-family:monospace; }
.Identifier { color: #008b8b; }
.Statement { color: #af5f00; }
.PreProc { color: #5fd7ff; }
.Type { color: #005f00; }
.Comment { color: blue ; }
.Constant { color: #ff00ff; }
/*end of highlighted snippets*/
a {
text-decoration:none;
padding-bottom: 0px;
color:inherit;
border-bottom: 2px solid #6cb8f0;
}
a:hover {
text-decoration: none;
color:black;
border-bottom: 1px solid red;
}
/*do not underline links nor should they be active*/
pre a {
text-decoration:none;
color:black;
border-bottom: none;
pointer-events: none;
cursor: default;
}
.golfSnippet {display:none;}
ul {
list-style-type:square;
list-style-position: outside;
}
</style>
</head>
<body>
<div id="google_translate_element" style='float:right'></div>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
<script>
function rim_copy(gt, eid, gc) {
gt.textContent = eid.textContent;
gt.select();
document.execCommand("copy");
gc.style.visibility="visible"
setTimeout(()=>{ gc.style.visibility="hidden"; }, 1000);
}
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
}
</script>
<!--RIMMENU13-->
<!--RIMENDMENU13-->
<!--BEGVDOC90-->
<div class='vhub' style='margin-top:10px;margin-right:20px;text-align:left;background-color:white;'><a href='https://rimstone-lang.com' style='border-bottom:0px'><img src='https://rimstone-lang.com/rimstone.png' style='width:180px;height:auto'/></a></div><div class='vhub' style='margin-top:10px;'>How to write distributed applications</div><hr/><br/>
<br/><div class='vimg'><img class='imgs' src='distributed_computing.png' alt='RimStone'></img>
</div><br/>
<div class="vsub"><a id="What is distributed computing"></a>What is distributed computing</div>
Distributed computing is two or more servers communicating for a common purpose. Typically, some tasks are divvied up between a number of computers, and they all work together to accomplish it. Note that "separate servers" may mean physically separate computers. It may also mean virtual servers such as Virtual Private Servers (VPS) or containers, that may share the same physical hardware, though they appear as separate computers on the network. <br/>
<br/>
There are many reasons why you might need this kind of setup. It may be that resources needed to complete the task aren't all on a single computer. For instance, your application may rely on multiple databases, each residing on a different computer. Or, you may need to distribute requests to your application because a single computer isn't enough to handle them all at the same time. In other cases, you are using remote services (like a REST API-based for instance), and those by nature reside somewhere else.<br/>
<br/>
In any case, the computers comprising your distributed system may be on a local network, or they may be worldwide, or some combination of those. The throughput (how many bytes per second can be exchanged via network) and latency (how long it takes for a packet to travel via network) will obviously vary: for a local network you'd have a higher throughput and lower latency, and for Internet servers it will be the opposite. Plan accordingly based on the quality of service you'd expect.<br/>
<div class="vsub"><a id="How servers communicate"></a>How servers communicate</div>
Depending on your network(s) setup, different kinds of communication are called for. If two servers reside on a local network, then they would typically used the fastest possible means of communication. A local network typically means a secure network, because nobody else has access to it but you. So you would not need TSL/SSL or any other kind of secure protocol as that would just slow things down.<br/>
<br/>
If two servers are on the Internet though, then you must use a secure protocol (like TSL/SSL or some other) because your communication may be spied on, or worse, affected by man-in-the-middle attacks. <br/>
<div class="vsub"><a id="Local network distributed computing"></a>Local network distributed computing</div>
Most of the time, your distributed system would be on a local network. Such network may be separate and private in a physical sense, or (more commonly) in a virtual sense, where some kind of a Private Cloud Network is established for you by the Cloud provider. It's likely that separation is enforced by specialized hardware (such as routers and firewalls) and secure protocols that keep networks belonging to different customers separate. This way, a "local" network can be established even if computers on it are a world apart, though typically they reside as a part of a larger local network. <br/>
<br/>
Either way, as far as your application is concerned, you are looking at a local network. Thus, the example here will be for such a case, as it's most likely what you'll have. A local network means different parts of your application residing on different servers will use some efficient protocol based on TCP/IP. One such protocol is FastCGI, a high-performance binary protocol for communication between servers, clients, and in general programs of all kinds, and that's the one used by RimStone. So in principle, the setup will look like this (there'll be more details later):<br/>
<br/><div class='vimg'><img class='imgs' src='distributed_principle.png' alt='RimStone'></img>
</div><br/>
Next, in theory you should have two servers, however in this example both servers will be on the same localhost (i.e. "127.0.0.1"). This is just for simplicity; the code is exactly the same if you have two different servers on a local network - simply use another IP (such as "192.168.0.15" for instance) for your "remote" server instead of local "127.0.0.1". The two servers do not even necessarily need to be physically two different computers. You can start a Virtual Machine (VM) on your computer and host another virtual computer there. Popular free software like VirtualBox or KVM Hypervisor can help you do that. <br/>
<br/>
In any case, in this example you will start two simple application servers; they will communicate with one another. The first one will be called "local" and the other one "remote" server. The local application server will make a request to the remote one.<br/>
<div class="vsub"><a id="Local server"></a>Local server</div>
On a local server, create a new directory for your local application server source code:<br/>
<div class="shcode" style='position:relative;padding-right:16px;'>
<pre id='code_103' class=notranslate>
<span class="Statement">mkdir</span> <span class="PreProc">$HOME</span>/local_server
<span class="Statement">cd</span> <span class="PreProc">$HOME</span>/local_server</pre>
<span id=rimstone_copied_103 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='rimstonet_103' style='position: absolute;left: -500%;'></textarea>
<img src='https://rimstone-lang.com/rimstone-copy-small-1.png' id='rimstoneb' onclick='rim_copy(rimstonet_103, code_103, rimstone_copied_103)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
and then a new file "status.rim" will be created with the following:<br/>
<div class='code' style='position:relative;padding-right:16px;'>
<pre id='code_102' class=notranslate>
cat << '<span class="Constant">EOF</span>' > status.rim
<span class="Statement">begin-handler</span> /status<span class="Identifier"> public</span>
<span class="Statement"> silent-header</span>
<span class="Statement"> get-param</span> server
<span class="Statement"> get-param</span> days
<span class="Statement"> print-format</span> <span class="Constant">"/server/remote-status/days=</span><span class="Special">%s</span><span class="Constant">"</span>, days<span class="Identifier"> to</span> payload
<span class="Statement"> print-format</span> <span class="Constant">"</span><span class="Special">%s</span><span class="Constant">:3800"</span>, server<span class="Identifier"> to</span> srv_location
<span class="Statement"> new-remote</span> srv<span class="Identifier"> location</span> srv_location \
<span class="Identifier"> method</span> <span class="Constant">"GET"</span><span class="Identifier"> url-path</span> payload \
<span class="Identifier"> timeout</span> <span class="Constant">30</span>
<span class="Statement"> call-remote</span> srv
<span class="Statement"> read-remote</span> srv<span class="Identifier"> data</span> dt
<span class="Statement"> @</span>Output is: [<span class="Statement"><<print-out</span> dt<span class="Statement">>></span>]
<span class="Statement">end-handler</span>
<span class="Constant">EOF</span></pre>
<span id=rimstone_copied_102 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='rimstonet_102' style='position: absolute;left: -500%;'></textarea>
<img src='https://rimstone-lang.com/rimstone-copy-small-1.png' id='rimstoneb' onclick='rim_copy(rimstonet_102, code_102, rimstone_copied_102)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
The code here is very simple. <a href='https://rimstone-lang.com/new-remote.html'>new-remote</a> will create a new connection to a remote server, running on IP address given by input parameter "server" (and obtained with <a href='https://rimstone-lang.com/get-param.html'>get-param</a>) on TCP port 3800. URL payload created in string variable "payload" is passed to the remote server. If it doesn't reply in 30 seconds, then the code would timeout. Then you're using <a href='https://rimstone-lang.com/call-remote.html'>call-remote</a> to actually make a call to the remote server (which is served by application "server" and by request handler "remote-status.rim" below), and finally <a href='https://rimstone-lang.com/read-remote.html'>read-remote</a> to get the reply from it. For simplicity, error handling is omitted here, but you can easily detect a timeout, any network errors, any errors from the remote server, including error code and error text, etc. See the above statements for more on this.<br/>
<div class="vsub"><a id="Make and start the local server"></a>Make and start the local server</div>
Next, create a local application:<br/>
<div class="shcode" style='position:relative;padding-right:16px;'>
<pre id='code_109' class=notranslate>
rim <span class="Special">-k</span> client</pre>
<span id=rimstone_copied_109 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='rimstonet_109' style='position: absolute;left: -500%;'></textarea>
<img src='https://rimstone-lang.com/rimstone-copy-small-1.png' id='rimstoneb' onclick='rim_copy(rimstonet_109, code_109, rimstone_copied_109)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
Make the application (i.e. compile the source code and build the native executable):<br/>
<div class="shcode" style='position:relative;padding-right:16px;'>
<pre id='code_111' class=notranslate>
rim <span class="Special">-q</span></pre>
<span id=rimstone_copied_111 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='rimstonet_111' style='position: absolute;left: -500%;'></textarea>
<img src='https://rimstone-lang.com/rimstone-copy-small-1.png' id='rimstoneb' onclick='rim_copy(rimstonet_111, code_111, rimstone_copied_111)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
Finally, start the local application server:<br/>
<div class="shcode" style='position:relative;padding-right:16px;'>
<pre id='code_112' class=notranslate>
mrim <span class="Special">-w</span> <span class="Constant">2</span> client</pre>
<span id=rimstone_copied_112 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='rimstonet_112' style='position: absolute;left: -500%;'></textarea>
<img src='https://rimstone-lang.com/rimstone-copy-small-1.png' id='rimstoneb' onclick='rim_copy(rimstonet_112, code_112, rimstone_copied_112)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
This will start 2 server instances of a local application server.<br/>
<div class="vsub"><a id="Remote server"></a>Remote server</div>
Okay, now you have a local server. Next, you'll setup a remote server. Login to your remote server and create a new directory for your remote application server:<br/>
<div class="shcode" style='position:relative;padding-right:16px;'>
<pre id='code_113' class=notranslate>
<span class="Statement">mkdir</span> <span class="PreProc">$HOME</span>/remote_server
<span class="Statement">cd</span> <span class="PreProc">$HOME</span>/remote_server</pre>
<span id=rimstone_copied_113 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='rimstonet_113' style='position: absolute;left: -500%;'></textarea>
<img src='https://rimstone-lang.com/rimstone-copy-small-1.png' id='rimstoneb' onclick='rim_copy(rimstonet_113, code_113, rimstone_copied_113)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
Then a file "remote-status.rim" with this code is created:<br/>
<div class='code' style='position:relative;padding-right:16px;'>
<pre id='code_108' class=notranslate>
cat << '<span class="Constant">EOF</span>' > remote-status.rim
<span class="Statement">begin-handler</span> /remote-status<span class="Identifier"> public</span>
<span class="Statement"> silent-header</span>
<span class="Statement"> get-param</span> days
<span class="Statement"> print-format</span> <span class="Constant">"Status in the past </span><span class="Special">%s</span><span class="Constant"> days is okay"</span>, days
<span class="Statement">end-handler</span>
<span class="Constant">EOF</span></pre>
<span id=rimstone_copied_108 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='rimstonet_108' style='position: absolute;left: -500%;'></textarea>
<img src='https://rimstone-lang.com/rimstone-copy-small-1.png' id='rimstoneb' onclick='rim_copy(rimstonet_108, code_108, rimstone_copied_108)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
This is super simple, and it just replies that the status is okay; it accepts the number of days to check for status and displays that back. In a real service, you might query a database to check for status (see <a href='https://rimstone-lang.com/run-query.html'>run-query</a>).<br/>
<div class="vsub"><a id="Make and start remote server"></a>Make and start remote server</div>
First create your application:<br/>
<div class="shcode" style='position:relative;padding-right:16px;'>
<pre id='code_114' class=notranslate>
rim <span class="Special">-k</span> server</pre>
<span id=rimstone_copied_114 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='rimstonet_114' style='position: absolute;left: -500%;'></textarea>
<img src='https://rimstone-lang.com/rimstone-copy-small-1.png' id='rimstoneb' onclick='rim_copy(rimstonet_114, code_114, rimstone_copied_114)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
Then make your program:<br/>
<div class="shcode" style='position:relative;padding-right:16px;'>
<pre id='code_115' class=notranslate>
rim <span class="Special">-q</span></pre>
<span id=rimstone_copied_115 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='rimstonet_115' style='position: absolute;left: -500%;'></textarea>
<img src='https://rimstone-lang.com/rimstone-copy-small-1.png' id='rimstoneb' onclick='rim_copy(rimstonet_115, code_115, rimstone_copied_115)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
And finally start the server:<br/>
<div class="shcode" style='position:relative;padding-right:16px;'>
<pre id='code_116' class=notranslate>
mrim <span class="Special">-w</span> <span class="Constant">2</span> <span class="Special">-p</span> <span class="Constant">3800</span> server</pre>
<span id=rimstone_copied_116 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='rimstonet_116' style='position: absolute;left: -500%;'></textarea>
<img src='https://rimstone-lang.com/rimstone-copy-small-1.png' id='rimstoneb' onclick='rim_copy(rimstonet_116, code_116, rimstone_copied_116)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
This will start 2 daemon processes running as background servers. They will serve requests from your local server.<br/>
<br/>
Note that if you're running this example on different computers, some Linux distributions come with a firewall, and you may need to use ufw or firewall-cmd to make port 3800 accessible here. <br/>
<div class="vsub"><a id="Run distributed calls"></a>Run distributed calls</div>
There is a number of ways you can call the remote service you created. These are calls made from your <span style="font-style:italic">local</span> server, so change directory to it:<br/>
<div class="shcode" style='position:relative;padding-right:16px;'>
<pre id='code_117' class=notranslate>
<span class="Statement">cd</span> <span class="PreProc">$HOME</span>/local_server</pre>
<span id=rimstone_copied_117 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='rimstonet_117' style='position: absolute;left: -500%;'></textarea>
<img src='https://rimstone-lang.com/rimstone-copy-small-1.png' id='rimstoneb' onclick='rim_copy(rimstonet_117, code_117, rimstone_copied_117)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
Here's various way to call the remote application server:<br/>
<ul><li>Execute a command-line program on local server that calls remote application server:<br/>
<br/><div class='vimg'><img class='imgs' src='distributed_command_line.png' alt='RimStone'></img>
</div><br/>
To do this, use "-r" option of <a href='https://rimstone-lang.com/rim.html'>rim</a> utility to generate shell commands you can use to call your program:<br/>
<div class="shcode" style='position:relative;padding-right:16px;'>
<pre id='code_103' class=notranslate>
<span class="Statement">mkdir</span> <span class="PreProc">$HOME</span>/local_server
<span class="Statement">cd</span> <span class="PreProc">$HOME</span>/local_server</pre>
<span id=rimstone_copied_103 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='rimstonet_103' style='position: absolute;left: -500%;'></textarea>
<img src='https://rimstone-lang.com/rimstone-copy-small-1.png' id='rimstoneb' onclick='rim_copy(rimstonet_103, code_103, rimstone_copied_103)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
Here, you're saying that you want to make a request "status" (which is in source file "status.rim" on your local server). You are also saying that input parameter "days" should have a value of "18" and also that input parameter "server" should have a value of "127.0.0.1" - see <a href='https://rimstone-lang.com/get-param.html'>get-param</a> statements in the above file "status.rim". If you actually have a different server with a different IP, use it instead of "127.0.0.1". <br/>
The result will be:<br/>
<div class='ncode' style='position:relative;padding-right:16px;'>
<pre id='code_101' class=notranslate>
Output is: [Status in the past 18 days is okay]</pre>
<span id=rimstone_copied_101 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='rimstonet_101' style='position: absolute;left: -500%;'></textarea>
<img src='https://rimstone-lang.com/rimstone-copy-small-1.png' id='rimstoneb' onclick='rim_copy(rimstonet_101, code_101, rimstone_copied_101)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
where the part in between "[..]" comes from the remote server, and the "Output is: " part comes from the command line RimStone program you executed.<br/>
</li><li>Call remote application server directly from a command-line program:<br/>
<br/><div class='vimg'><img class='imgs' src='distributed_command_utility.png' alt='RimStone'></img>
</div><br/>
Do this:<br/>
<div class="shcode" style='position:relative;padding-right:16px;'>
<pre id='code_103' class=notranslate>
<span class="Statement">mkdir</span> <span class="PreProc">$HOME</span>/local_server
<span class="Statement">cd</span> <span class="PreProc">$HOME</span>/local_server</pre>
<span id=rimstone_copied_103 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='rimstonet_103' style='position: absolute;left: -500%;'></textarea>
<img src='https://rimstone-lang.com/rimstone-copy-small-1.png' id='rimstoneb' onclick='rim_copy(rimstonet_103, code_103, rimstone_copied_103)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
The result is, as expected:<br/>
<div class='ncode' style='position:relative;padding-right:16px;'>
<pre id='code_107' class=notranslate>
Status in the past 18 days is okay</pre>
<span id=rimstone_copied_107 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='rimstonet_107' style='position: absolute;left: -500%;'></textarea>
<img src='https://rimstone-lang.com/rimstone-copy-small-1.png' id='rimstoneb' onclick='rim_copy(rimstonet_107, code_107, rimstone_copied_107)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
In this case, the output comes straight from the remote server, so the "Output is: " part is missing. The above simply copies the output from a remote service to the standard output.<br/>
</li><li>Use a command-line utility to contact local application server, which then calls the remote server, which replies back to local application server, which replies back to your command-line utility:<br/>
<br/><div class='vimg'><img class='imgs' src='distributed_command_local.png' alt='RimStone'></img>
</div><br/>
You will use <a href='https://rimstone-lang.com/rim.html'>rim</a> to do this:<br/>
<div class="shcode" style='position:relative;padding-right:16px;'>
<pre id='code_103' class=notranslate>
<span class="Statement">mkdir</span> <span class="PreProc">$HOME</span>/local_server
<span class="Statement">cd</span> <span class="PreProc">$HOME</span>/local_server</pre>
<span id=rimstone_copied_103 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='rimstonet_103' style='position: absolute;left: -500%;'></textarea>
<img src='https://rimstone-lang.com/rimstone-copy-small-1.png' id='rimstoneb' onclick='rim_copy(rimstonet_103, code_103, rimstone_copied_103)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
The result is:<br/>
<div class='ncode' style='position:relative;padding-right:16px;'>
<pre id='code_110' class=notranslate>
Output is: [Status in the past 10 days is okay]</pre>
<span id=rimstone_copied_110 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='rimstonet_110' style='position: absolute;left: -500%;'></textarea>
<img src='https://rimstone-lang.com/rimstone-copy-small-1.png' id='rimstoneb' onclick='rim_copy(rimstonet_110, code_110, rimstone_copied_110)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
which is what you'd expect. In this case we first send a request to your local application server, which sends it to a remote service, so there is "Output is: " output.<br/>
</li></ul>
You have different options when designing your distributed systems, and this article shows how easy it is to implement them.<br/>
<!--ENDVDOC90-->
<br/><div style='width:100%;clear:both;'>
<hr/>
<!--RIMFOOT77--><span style='font-size:80%'><a href="https://rimstone-lang.com/copyright.html">Copyright</a> (c) 2019-2025 Gliim LLC. All contents on this web site is "AS IS" without warranties or guarantees of any kind.</span>
</div><br/></body></html>