File: pool.html

package info (click to toggle)
erlang-doc-html 1%3A11.b.2-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 23,284 kB
  • ctags: 10,724
  • sloc: erlang: 505; ansic: 323; makefile: 62; perl: 61; sh: 45
file content (203 lines) | stat: -rw-r--r-- 5,430 bytes parent folder | download
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- This document was generated using DocBuilder 3.3.3 -->
<HTML>
<HEAD>
  <TITLE>pool</TITLE>
  <SCRIPT type="text/javascript" src="../../../../doc/erlresolvelinks.js">
</SCRIPT>
  <STYLE TYPE="text/css">
<!--
    .REFBODY     { margin-left: 13mm }
    .REFTYPES    { margin-left: 8mm }
-->
  </STYLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF00FF"
      ALINK="#FF0000">
<!-- refpage -->
<CENTER>
<A HREF="http://www.erlang.se">
  <IMG BORDER=0 ALT="[Ericsson AB]" SRC="min_head.gif">
</A>
<H1>pool</H1>
</CENTER>

<H3>MODULE</H3>
<DIV CLASS=REFBODY>
pool
</DIV>

<H3>MODULE SUMMARY</H3>
<DIV CLASS=REFBODY>
Load Distribution Facility
</DIV>

<H3>DESCRIPTION</H3>
<DIV CLASS=REFBODY>

<P><CODE>pool</CODE> can be used to run a set of Erlang nodes as a pool
of computational processors. It is organized as a master and a
set of slave nodes and includes the following features:
<P>
<UL>

<LI>
The slave nodes send regular reports to the master about
        their current load.
</LI>


<LI>
Queries can be sent to the master to determine which node
        will have the least load.
</LI>


</UL>

<P>The BIF <CODE>statistics(run_queue)</CODE> is used for estimating
future loads. It returns the length of the queue of ready to run
processes in the Erlang runtime system.
<P>The slave nodes are started with the <CODE>slave</CODE> module. This
effects, tty IO, file IO, and code loading.
<P>If the master node fails, the entire pool will exit.
</DIV>

<H3>EXPORTS</H3>

<P><A NAME="start/1"><STRONG><CODE>start(Name) -&#62;</CODE></STRONG></A><BR>
<A NAME="start/2"><STRONG><CODE>start(Name, Args) -&#62; Nodes</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Name = atom()</CODE></STRONG><BR>
<STRONG><CODE>Args = string()</CODE></STRONG><BR>
<STRONG><CODE>Nodes = [node()]</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Starts a new pool. The file <CODE>.hosts.erlang</CODE> is read to
         find host names where the pool nodes can be started. See
         section <A HREF="#files">Files</A> below. The
         start-up procedure fails if the file is not found.
<P>The slave nodes are started with <CODE>slave:start/2,3</CODE>,
         passing along <CODE>Name</CODE> and, if provided, <CODE>Args</CODE>.
         <CODE>Name</CODE> is used as the first part of the node names,
         <CODE>Args</CODE> is used to specify command line arguments. See
         <A HREF="slave.html#start/2">slave(3)</A>.
<P>Access rights must be set so that all nodes in the pool have
         the authority to access each other.
<P>The function is synchronous and all the nodes, as well as
         all the system servers, are running when it returns a value.
        
</DIV>

<P><A NAME="attach/1"><STRONG><CODE>attach(Node) -&#62; allready_attached | attached</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Node = node()</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>This function ensures that a pool master is running and
         includes <CODE>Node</CODE> in the pool master's pool of nodes.
</DIV>

<P><A NAME="stop/0"><STRONG><CODE>stop() -&#62; stopped</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY>

<P>Stops the pool and kills all the slave nodes.
</DIV>

<P><A NAME="get_nodes/0"><STRONG><CODE>get_nodes() -&#62; Nodes</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Nodes = [node()]</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Returns a list of the current member nodes of the pool.
</DIV>

<P><A NAME="pspawn/3"><STRONG><CODE>pspawn(Mod, Fun, Args) -&#62; pid()</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Mod = Fun = atom()</CODE></STRONG><BR>
<STRONG><CODE>Args = [term()]</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Spawns a process on the pool node which is expected to have
         the lowest future load.
</DIV>

<P><A NAME="pspawn_link/3"><STRONG><CODE>pspawn_link(Mod, Fun, Args) -&#62; pid()</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY><P>Types:
  <DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Mod = Fun = atom()</CODE></STRONG><BR>
<STRONG><CODE>Args = [term()]</CODE></STRONG><BR>

  </DIV>
</DIV>

<DIV CLASS=REFBODY>

<P>Spawn links a process on the pool node which is expected to
         have the lowest future load.
</DIV>

<P><A NAME="get_node/0"><STRONG><CODE>get_node() -&#62; node()</CODE></STRONG></A><BR>

<DIV CLASS=REFBODY>

<P>Returns the node with the expected lowest future load.
</DIV>
<A NAME="files"><!-- Empty --></A>
<H3>Files</H3>
<DIV CLASS=REFBODY>

<P><CODE>.hosts.erlang</CODE> is used to pick hosts where nodes can
be started. See
<A HREF="javascript:erlhref('../../../../', 'kernel', 'net_adm.html#host_file/0');">net_adm(3)</A>
for information about format and location of this file.
<P><CODE>$HOME/.erlang.slave.out.HOST</CODE> is used for all additional IO
that may come from the slave nodes on standard IO. If the start-up
procedure does not work, this file may indicate the reason.
</DIV>

<H3>AUTHORS</H3>
<DIV CLASS=REFBODY>
Claes Wikstrom - support@erlang.ericsson.se<BR>

</DIV>
<CENTER>
<HR>
<SMALL>stdlib 1.14.2<BR>
Copyright &copy; 1991-2006
<A HREF="http://www.erlang.se">Ericsson AB</A><BR>
</SMALL>
</CENTER>
</BODY>
</HTML>