File: pool.html

package info (click to toggle)
erlang-doc-html 1%3A8.0-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 18,028 kB
  • ctags: 7,419
  • sloc: perl: 1,841; ansic: 323; erlang: 155
file content (111 lines) | stat: -rw-r--r-- 4,454 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
<HTML>
<HEAD>
<!-- refpage -->
<TITLE>pool</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<CENTER>


<A HREF="http://www.erlang.se"><IMG BORDER=0 ALT="[Erlang Systems]" SRC="min_head.gif"></A>
<H1>pool</H1>
</CENTER>
<H3>MODULE</H3>
<UL>
pool</UL>
<H3>MODULE SUMMARY</H3>
<UL>
Load Distribution Facility
</UL>
<H3>DESCRIPTION</H3>
<UL>
<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><BR>
<LI>Queries can be sent to the master to determine which node will have the least load.</LI><BR>
</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.

</UL>
<H3>EXPORTS</H3>
<P><A NAME="start%1"><STRONG><CODE>start(Name)
</CODE></STRONG></A><BR>
<UL>
<P>Starts a new pool. The file <CODE>.hosts.erlang</CODE> is read to find host names where the pool nodes can be started. The current working directory is searched first, then the home 
directory, and finally the root directory of the Erlang runtime system. The start-up procedure fails if the file is not found. <P><CODE>Name</CODE> is sent to all pool nodes. This is used as the first part of the node name in the 
<CODE>alive/3</CODE> statements for the nodes.<P>The function <CODE>net_adm:host_file()</CODE> reads the file <CODE>.hosts.erlang</CODE> for host names. The slave nodes are started with <CODE>slave:start</CODE>. See slave(3).<P><CODE>start/1</CODE> is synchronous and all the nodes, as well as all the system servers, are running when it returns a value. Access rights must also be set so that all nodes in the pool have the authority to access each other.</UL>
<P><A NAME="start%2"><STRONG><CODE>start(Name, Args)
</CODE></STRONG></A><BR>
<UL>
<P>This function is the same as <CODE>start/1</CODE>, except that the 
         environment <CODE>Args</CODE> is passed to the pool nodes. 
         See slave(3).
        <P> </UL>
<P><A NAME="attach%1"><STRONG><CODE>attach(Node)
</CODE></STRONG></A><BR>
<UL>
<P>This function ensures that a pool master is running and includes <CODE>Node</CODE> 
         in the pool master's pool of nodes.
        <P> </UL>
<P><A NAME="stop%0"><STRONG><CODE>stop()
</CODE></STRONG></A><BR>
<UL>
<P>Stops the pool and kills all the slave nodes.
</UL>
<P><A NAME="get_nodes%0"><STRONG><CODE>get_nodes()
</CODE></STRONG></A><BR>
<UL>
<P>Returns a list of the current member nodes of the pool.
</UL>
<P><A NAME="pspawn%3"><STRONG><CODE>pspawn(Mod, Fun, Args)
</CODE></STRONG></A><BR>
<UL>
<P>Spawns a process on the pool node which is 
         expected to have the lowest future load.
        <P> </UL>
<P><A NAME="pspawn_link%3"><STRONG><CODE>pspawn_link(Mod, Fun, Args)
</CODE></STRONG></A><BR>
<UL>
<P>Spawn links a process on the pool node which is 
         expected to have the lowest future load.
        <P> </UL>
<P><A NAME="get_node%0"><STRONG><CODE>get_node()
</CODE></STRONG></A><BR>
<UL>
<P>Returns the node ID of the node with the expected lowest future 
         load.
</UL>
<P><A NAME="new_node%2"><STRONG><CODE>new_node(Host, Name)
</CODE></STRONG></A><BR>
<UL>
<P>Starts a new node and attaches it to an already existing pool
         If there is no existing pool, it starts a pool with two nodes,
         the current node and <CODE>Node</CODE>. This function can also be used as
         a convenient way of starting new nodes, even if the load 
         distribution facilities of <CODE>pool</CODE> are of no interest.
        <P> </UL>
<H3>Files</H3>
<UL>
<P>$HOME/.hosts.erlang is used to pick hosts where nodes can 
be started.
<P>$HOME/.erlang.slave.out.HOST 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.
</UL>
<H3>AUTHORS</H3>
<UL>
 Claes Wikstrom - support@erlang.ericsson.se<BR>
</UL>
<CENTER>
<HR>
<FONT SIZE=-1>stdlib 1.10<BR>
Copyright &copy; 1991-2001
<A HREF="http://www.erlang.se">Ericsson Utvecklings AB</A><BR>
<!--#include virtual="/ssi/otp_footer.html"-->
</FONT>
</CENTER>
</BODY>
</HTML>