<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Configuration</title><link>https://sourceforge.net/p/kai/wiki/Configuration/</link><description>Recent changes to Configuration</description><atom:link href="https://sourceforge.net/p/kai/wiki/Configuration/feed" rel="self"/><language>en</language><lastBuildDate>Wed, 11 Jun 2014 15:19:33 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/kai/wiki/Configuration/feed" rel="self" type="application/rss+xml"/><item><title>Configuration modified by Takeru INOUE</title><link>https://sourceforge.net/p/kai/wiki/Configuration/</link><description>&lt;div class="markdown_content"&gt;&lt;div class="toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#specifying-configuration-file"&gt;Specifying Configuration File&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#parameters"&gt;Parameters&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#basic-parameters-logfile-hostname-rpc_port-memcache_port"&gt;Basic Parameters: logfile, hostname, rpc_port, memcache_port&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#quorum-protocol-for-availability-and-performance-n-r-w"&gt;Quorum Protocol for Availability and Performance: n, r, w&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#using-disk-storage-for-large-amount-of-data-store-dets_dir-number_of_tables"&gt;Using Disk Storage for Large Amount of Data: store, dets_dir, number_of_tables&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#load-balancing-by-using-virtual-nodes-number_of_virtual_nodes-number_of_buckets"&gt;Load Balancing by Using Virtual Nodes: number_of_virtual_nodes, number_of_buckets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#the-number-of-processes-and-sockets-memcache_max_processes-rpc_max_processes-max_connections"&gt;The Number of Processes and Sockets: memcache_max_processes, rpc_max_processes, max_connections&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;p&gt;&lt;em&gt;This article is described based on Kai version 0.4 and Erlang R13B.&lt;/em&gt;&lt;/p&gt;
&lt;h1 id="specifying-configuration-file"&gt;Specifying Configuration File&lt;/h1&gt;
&lt;p&gt;This page describes the configuration parameters for a Kai node.  The parameters are set in the configuration file "kai.config" by default.  This filename can be specified when starting a Kai node.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="c"&gt;% erl -pa ebin -config &amp;lt;filename&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The configuration values cannot be changed without rebooting the Kai node.&lt;/p&gt;
&lt;h1 id="parameters"&gt;Parameters&lt;/h1&gt;
&lt;h2 id="basic-parameters-logfile-hostname-rpc_port-memcache_port"&gt;Basic Parameters: logfile, hostname, rpc_port, memcache_port&lt;/h2&gt;
&lt;p&gt;Descriptions for the parameters "logfile", "hostname", "rpc_port", and "memcache_port".&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Default value&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;logfile&lt;/td&gt;
&lt;td&gt;string&lt;/td&gt;
&lt;td&gt;&lt;em&gt;not specified&lt;/em&gt;&lt;/td&gt;
&lt;td&gt;"/path/to/logfile"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;hostname&lt;/td&gt;
&lt;td&gt;string or tuple&lt;/td&gt;
&lt;td&gt;&lt;em&gt;not specified&lt;/em&gt;&lt;/td&gt;
&lt;td&gt;"kai1.example.com" or {192,168,1,1}&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;rpc_port&lt;/td&gt;
&lt;td&gt;integer&lt;/td&gt;
&lt;td&gt;11011&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;memcache_port&lt;/td&gt;
&lt;td&gt;integer&lt;/td&gt;
&lt;td&gt;11211&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;First, we show some basic parameters.&lt;/p&gt;
&lt;p&gt;The parameter "logfile" is the path to a log file.  If not specified, log messages are output on the console.&lt;/p&gt;
&lt;p&gt;The parameter "hostname" is either hostname or IP address, to which other nodes connect.  If hostname, it should look like "kai1.example.com".  Otherwise, it must be an IP address delimitered by commas, like {192,168,1,1}.  If not specified, the "hostname" command is used.&lt;/p&gt;
&lt;p&gt;The parameter "rpc_port" is a number of TCP port for internal RPCs.  Default is 11011.&lt;/p&gt;
&lt;p&gt;The parameter "memcache_port" is a number of TCP port for external memcache APIs.  Default is 11211 (same as memcached).&lt;/p&gt;
&lt;h2 id="quorum-protocol-for-availability-and-performance-n-r-w"&gt;Quorum Protocol for Availability and Performance: n, r, w&lt;/h2&gt;
&lt;p&gt;Descriptions for the parameters "n", "r", and "w".&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Default value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;n&lt;/td&gt;
&lt;td&gt;integer&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;r&lt;/td&gt;
&lt;td&gt;integer&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;w&lt;/td&gt;
&lt;td&gt;integer&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The quorum protocol adjusts availability and performance.  Large N gives high reliability and availability for the sake of low efficiency.  Small R is preferable for read intensive services.  By default N:R:W = 3:2:2, which provides good reliability for most services.  The values of R and W are subject to the following two constraints,&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;R&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;W&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;N&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="n"&gt;W&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;N&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mf"&gt;2.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The Kai cluster tries to replicate a given value (data) to N nodes.  The value is successfully replicated to W nodes in the cluster at least.  For retrieving the value, R of N replicas are read.  See &lt;a class="alink" href="/p/kai/wiki/Introduction/"&gt;[Introduction]&lt;/a&gt;, for the quorum protocol in detail.&lt;/p&gt;
&lt;h2 id="using-disk-storage-for-large-amount-of-data-store-dets_dir-number_of_tables"&gt;Using Disk Storage for Large Amount of Data: store, dets_dir, number_of_tables&lt;/h2&gt;
&lt;p&gt;Descriptions for the parameters "store", "dets_dir", and "number_of_tables".&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Default value&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;store&lt;/td&gt;
&lt;td&gt;atom&lt;/td&gt;
&lt;td&gt;ets&lt;/td&gt;
&lt;td&gt;ets or dets&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;dets_dir&lt;/td&gt;
&lt;td&gt;string&lt;/td&gt;
&lt;td&gt;&lt;em&gt;not specified&lt;/em&gt;&lt;/td&gt;
&lt;td&gt;"/path/to/kai/data"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;number_of_tables&lt;/td&gt;
&lt;td&gt;integer&lt;/td&gt;
&lt;td&gt;128&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;While data is stored on memory by default, Kai supports disk storage for large amount of data.  Moreover, disk storage enables to reboot a whole cluster without data loss.&lt;/p&gt;
&lt;p&gt;The paramter "store" indicates a storage type used by the node; ets means a memory storage and dets means a disk storage (they are embedded storage systems in Erlang).  The capacity of ets is limited to 3 GB for a 32bit machine.&lt;/p&gt;
&lt;p&gt;The parameter "dets_dir" is used only for dets.  It specifies a directory that contains storage files (don't forget making the directory before running Kai).&lt;/p&gt;
&lt;p&gt;The parameter "number_of_tables" is also used only for dets.  It specifies the number of storage files, each of which contains 2 GB at maximum; (2 * number_of_tables) GB is the maximum capacity of a single Kai node.&lt;/p&gt;
&lt;h2 id="load-balancing-by-using-virtual-nodes-number_of_virtual_nodes-number_of_buckets"&gt;Load Balancing by Using Virtual Nodes: number_of_virtual_nodes, number_of_buckets&lt;/h2&gt;
&lt;p&gt;Descriptions for the parameters "number_of_virtual_nodes" and "number_of_buckets".&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Default value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;number_of_virtual_nodes&lt;/td&gt;
&lt;td&gt;integer&lt;/td&gt;
&lt;td&gt;128&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;number_of_buckets&lt;/td&gt;
&lt;td&gt;integer&lt;/td&gt;
&lt;td&gt;1024&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The Kai cluster provides fine-grain load balancing for accommodating broad range of machines.&lt;/p&gt;
&lt;p&gt;The parameter "number_of_virtual_nodes" specifies the degree of load distribution.  More virtual nodes a Kai node has, more loads are assigned to the node, because the Kai cluster equally distributes the loads for each virtual node.  This parameter must be more than one hundred for statistical equality.  By default, 128.&lt;/p&gt;
&lt;p&gt;The parameter "number_of_buckets" determines the unit of load distribution.  Large number of buckets provides finer grain distribution for the sake of computation cost.  This parameter should be roughly greater than hundred times the cluster size.  By default, 1024.  This parameter must be shared in the Kai cluster.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;number_of_buckets&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;cluster&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="the-number-of-processes-and-sockets-memcache_max_processes-rpc_max_processes-max_connections"&gt;The Number of Processes and Sockets: memcache_max_processes, rpc_max_processes, max_connections&lt;/h2&gt;
&lt;p&gt;Descriptions for the parameters "rpc_max_processes", "memcache_max_processes", and "max_connections".&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Default value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;memcache_max_processes&lt;/td&gt;
&lt;td&gt;integer&lt;/td&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;rpc_max_processes&lt;/td&gt;
&lt;td&gt;integer&lt;/td&gt;
&lt;td&gt;60&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;max_connections&lt;/td&gt;
&lt;td&gt;integer&lt;/td&gt;
&lt;td&gt;64&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The number of processes and sockets determines the degree of parallelism.&lt;/p&gt;
&lt;p&gt;The parameter "memcache_max_processes" is the maximum number of processes for external memcache APIs.  The value should not be less than the expected number of concurrent connections per a node from memcache clients.&lt;/p&gt;
&lt;p&gt;The parameter "rpc_max_processes" is the maximum number of processes for internal RPCs.  The value should be N times the maximum number of memcache processes.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;rpc_max_processes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;memcache_max_processes&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;N&lt;/span&gt; &lt;span class="n"&gt;of&lt;/span&gt; &lt;span class="n"&gt;quorum&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The parameter "max_connections" determines the maximum number of sockets connected for other nodes.  Actually, sockets more than the maximum number can be opened temporarily to avoid dead lock.  The value is roughly equal to the maximum number of processes for internal RPCs.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;max_connections&lt;/span&gt; &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="n"&gt;rpc_max_processes&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;em&gt;This article was originally published in Japanese at &lt;a class="" href="http://gihyo.jp/dev/feature/01/kai" rel="nofollow"&gt;gihyo.jp&lt;/a&gt; June 2009.&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Takeru INOUE</dc:creator><pubDate>Wed, 11 Jun 2014 15:19:33 -0000</pubDate><guid>https://sourceforge.net266cf72205957ba6960184b7841e6c78fc8514e7</guid></item></channel></rss>