<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Helion-Prime Solutions blog &#187; RoR</title>
	<atom:link href="http://blogs.helion-prime.com/tag/ror/feed" rel="self" type="application/rss+xml" />
	<link>http://blogs.helion-prime.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 10 May 2010 17:51:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Deployment of Ruby on Rails applications on OpenBSD</title>
		<link>http://blogs.helion-prime.com/2010/04/05/deployment-of-ruby-on-rails-applications-on-openbsd.html</link>
		<comments>http://blogs.helion-prime.com/2010/04/05/deployment-of-ruby-on-rails-applications-on-openbsd.html#comments</comments>
		<pubDate>Mon, 05 Apr 2010 12:35:56 +0000</pubDate>
		<dc:creator>alex.shapovalov</dc:creator>
				<category><![CDATA[openBSD]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[RoR]]></category>

		<guid isPermaLink="false">http://blogs.helion-prime.com/?p=768</guid>
		<description><![CDATA[Preamble
In this post I will define typical production environment on OpenBSD OS for deployment of Ruby on Rails applications.
There are few common things:
1. The Ruby on Rails framework doesn&#8217;t  support concurrent running in multiple threads within the same process, and so to scale it and fully utilize available hardware we need to execute application [...]]]></description>
			<content:encoded><![CDATA[<h2>Preamble</h2>
<p>In this post I will define typical production environment on OpenBSD OS for deployment of Ruby on Rails applications.</p>
<p>There are few common things:<br />
1. The Ruby on Rails framework doesn&#8217;t  support concurrent running in multiple threads within the same process, and so to scale it and fully utilize available hardware we need to execute application in several processes.<br />
2. We need load-balancer to spread incoming requests between application instances.<br />
3. We need separate web-server to serve static content.</p>
<h2>Overall configuration</h2>
<p>At first all incoming HTTP requests from a clients come to httpd web-server, it servers all static content, and send other requests to HAProxy.<br />
HAProxy receives requests and selects free Thin instance, forwards the request to it, receives a response and passes it back to httpd.</p>
<p>Following diagram should give you basic understanding about common work of components :<br />
<img class="alignnone size-full wp-image-779" title="deployment diagram" src="http://blogs.helion-prime.com/wp-content/uploads/2010/03/deployment_diagram.png" alt="deployment diagram" width="465" height="502" /></p>
<h2>OpenBSD Httpd – standard OpenBSD web-server</h2>
<p>I suggest OpenBSD standard web-server as you can find it as part of OpenBSD base installation, it checked for security issues and being updated as part of OpenBSD. We will use it to serve static content and don&#8217;t bother our Thin servers.</p>
<p>file: httpd.conf</p>
<div class="codecolorer-container apache mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br /></div></td><td><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #00007f;">BindAddress</span> SERVER_IP_ADDRESS<br />
<br />
<span style="color: #adadad; font-style: italic;"># Dynamic Shared Object (DSO) Support</span><br />
<span style="color: #adadad; font-style: italic;"># caching proxy</span><br />
<span style="color: #00007f;">LoadModule</span> proxy_module /usr/lib/apache/modules/libproxy.so<br />
<br />
<span style="color: #adadad; font-style: italic;"># allow Symbolic Links for root of our static content and all sub-directories</span><br />
<br />
<span style="color: #00007f;">Options</span> +<span style="color: #0000ff;">FollowSymLinks</span><br />
<span style="color: #00007f;">ServerAdmin</span> ADMIN_EMAIL<br />
<br />
<span style="color: #adadad; font-style: italic;"># path to root of our static content</span><br />
<span style="color: #00007f;">DocumentRoot</span> /var/www/railsdocs/RAILS_PROJECT/public<br />
<span style="color: #00007f;">ServerName</span> SERVER_NAME<br />
<span style="color: #00007f;">ServerAlias</span> www.SERVER_NAME<br />
<br />
<span style="color: #adadad; font-style: italic;"># directories that contain static content (they excluded from dispatching to HAProxy)</span><br />
<span style="color: #00007f;">ProxyPass</span> /images !<br />
<span style="color: #00007f;">ProxyPass</span> /stylesheets !<br />
<span style="color: #00007f;">ProxyPass</span> /javascripts !<br />
<span style="color: #00007f;">ProxyPass</span> /<span style="color: #ff0000;">500</span>.html !<br />
<span style="color: #00007f;">ProxyPass</span> /<span style="color: #ff0000;">503</span>.html !<br />
<br />
<span style="color: #adadad; font-style: italic;"># address where to send and from receive requests (HAProxy listens that address)</span><br />
<span style="color: #00007f;">ProxyPass</span> / http://127.0.0.1:<span style="color: #ff0000;">4000</span>/<br />
<span style="color: #00007f;">ProxyPassReverse</span> / http://127.0.0.1:<span style="color: #ff0000;">4000</span>/<br />
<br />
<span style="color: #adadad; font-style: italic;"># Disallows remote servers to be mapped into the space of the local server.</span><br />
<span style="color: #00007f;">ProxyRequests</span> <span style="color: #0000ff;">Off</span><br />
<br />
<span style="color: #adadad; font-style: italic;"># Don't use incoming Host HTTP request header for proxy request.</span><br />
<span style="color: #00007f;">ProxyPreserveHost</span> <span style="color: #0000ff;">Off</span><br />
<br />
<span style="color: #00007f;">ErrorLog</span> logs/SERVER_NAME-error_log<br />
<span style="color: #00007f;">CustomLog</span> logs/SERVER_NAME-access_log common</div></td></tr></tbody></table></div>
<p>see for configuration details: man httpd</p>
<p><strong>For OpenBSD 4.6/4.6 -Stable</strong><br />
It&#8217;s the hard part, OpenBSD4.6 has a bug in mod_proxy module so &#8216;!&#8217; directive doesn&#8217;t work.<br />
You have to edit following file:  /usr/src/usr.sbin/httpd/src/modules/proxy/mod_proxy.c</p>
<p>Find method: static int proxy_trans(request_rec *r)<br />
in that method after condition: if (len &gt; 0) {<br />
add 2 string:</p>
<div class="codecolorer-container c mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>ent<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #202020;">real</span><span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #ff0000;">'!'</span> <span style="color: #339933;">&amp;&amp;</span> ent<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #202020;">real</span><span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #ff0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #b1b100;">return</span> DECLINED<span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>so final part of code:<br />
&#8230;</p>
<div class="codecolorer-container c mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>len <span style="color: #339933;">&gt;</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>ent<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #202020;">real</span><span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #ff0000;">'!'</span> <span style="color: #339933;">&amp;&amp;</span> ent<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #202020;">real</span><span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #ff0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #b1b100;">return</span> DECLINED<span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>&#8230;</p>
<p>Then recompile your system, it&#8217;s common procedure for following -stable so you should already know it otherwise see for details for building instructions: <a href="http://www.openbsd.org/faq/faq5.html">http://www.openbsd.org/faq/faq5.html</a></p>
<h2>Thin – high performance ruby web server</h2>
<p>We need some Ruby web-server, and it seems that at this time Thin provides best performance.<br />
At least we see such results on Thin homepage: <a href="http://code.macournoyer.com/thin/">http://code.macournoyer.com/thin/</a></p>
<p>file: start.sh</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># start work instances</span><br />
thin start <span style="color: #660033;">-C</span> thin-production.yml</div></td></tr></tbody></table></div>
<p>file: thin-production.yml</p>
<div class="codecolorer-container yaml mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br /></div></td><td><div class="yaml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">---<br />
<span style="">environment</span>: production<br />
<br />
<span style="">port</span>: <span style="">4001</span><br />
<span style="">address</span>: 127.0.0.1<br />
<span style="">daemonize</span>: true<br />
<span style="">servers</span>: <span style="">4</span><br />
<br />
<span style="">chdir</span>: /var/www/railsdocs/RAILS_PROJECT<br />
<span style="">pid</span>: tmp/pids/thin.pid<br />
<span style="">log</span>: log/thin.log<br />
<br />
<span style="">user</span>: myuser<br />
<span style="">group</span>: mygroup<br />
<br />
<span style="">require</span>: <span class="br0">&#91;</span><span class="br0">&#93;</span></div></td></tr></tbody></table></div>
<p>see for configuration details: <a href="http://code.macournoyer.com/thin/usage/">http://code.macournoyer.com/thin/usage/</a></p>
<h2>HAproxy &#8211; TCP/ HTTP load balancer</h2>
<p>As Rails doesn&#8217;t  support concurrent running each incoming request should be assigned to a separate process. HAProxy can be configured to send only one request at a time to every Thin server, it will always pick instance that is not busy with something.</p>
<p>It provides bunch of other useful things like:<br />
– route HTTP requests depending on statically assigned cookies ;<br />
– switch to backup servers in the event a main one fails ;<br />
– accept connections to special ports dedicated to service monitoring ;<br />
– add/modify/delete HTTP headers both ways ;<br />
– block requests matching a particular pattern ;<br />
for full documentation see: <a href="http://haproxy.1wt.eu/#docs">http://haproxy.1wt.eu/#docs</a></p>
<p>note:<br />
If someone thinks that we could use nginx for that purpose check following performance comparison of HAProxy and Nginx:<br />
<a href="http://affectioncode.wordpress.com/2008/06/28/another-comparison-of-haproxy-and-nginx/">http://affectioncode.wordpress.com/2008/06/28/another-comparison-of-haproxy-and-nginx/</a></p>
<p>file: haproxy.cfg</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">defaults<br />
log &nbsp; &nbsp; global<br />
mode &nbsp; &nbsp;http<br />
<br />
<span style="color: #666666; font-style: italic;"># provides more detailed information about HTTP contents, such as the request and some cookies</span><br />
option &nbsp;httplog<br />
<span style="color: #666666; font-style: italic;"># do not to log any session which didn't transfer any data</span><br />
option &nbsp;dontlognull<br />
<span style="color: #666666; font-style: italic;"># allow the proxy to break their persistence and redistribute connections in case of failure</span><br />
option &nbsp;redispatch<br />
<br />
<span style="color: #666666; font-style: italic;"># the number of attempts to reconnect after a connection failure to a server</span><br />
retries <span style="color: #000000;">3</span><br />
<br />
<span style="color: #666666; font-style: italic;"># the time we accept to wait for a connection to establish on a server</span><br />
contimeout &nbsp; &nbsp; &nbsp;<span style="color: #000000;">100000</span><br />
<span style="color: #666666; font-style: italic;"># the time we accept to wait for data from the client, or for the client to accept data</span><br />
clitimeout &nbsp; &nbsp; &nbsp;<span style="color: #000000;">100000</span><br />
<span style="color: #666666; font-style: italic;"># the time we accept to wait for data from the server, or for the server to accept data</span><br />
srvtimeout &nbsp; &nbsp; &nbsp;<span style="color: #000000;">100000</span><br />
<br />
listen project_proxy 127.0.0.1:<span style="color: #000000;">4000</span><br />
balance roundrobin<br />
<br />
<span style="color: #666666; font-style: italic;"># creates an HTTP 'X-Forwarded-For' header which contains the client's IP address.</span><br />
<span style="color: #666666; font-style: italic;"># This is useful to let the final web server know what the client address was</span><br />
option forwardfor<br />
<br />
<span style="color: #666666; font-style: italic;"># using “maxconn 1″ improves performance with Rails.</span><br />
<span style="color: #666666; font-style: italic;"># As Rails instance can process only 1 request “maxconn 1″ force HAProxy to select next free instance</span><br />
<br />
server &nbsp;app1_1 127.0.0.1:<span style="color: #000000;">4001</span> check inter <span style="color: #000000;">60000</span> rise <span style="color: #000000;">2</span> fall <span style="color: #000000;">5</span> maxconn <span style="color: #000000;">1</span><br />
server &nbsp;app1_2 127.0.0.1:<span style="color: #000000;">4002</span> check inter <span style="color: #000000;">60000</span> rise <span style="color: #000000;">2</span> fall <span style="color: #000000;">5</span> maxconn <span style="color: #000000;">1</span><br />
server &nbsp;app1_3 127.0.0.1:<span style="color: #000000;">4003</span> check inter <span style="color: #000000;">60000</span> rise <span style="color: #000000;">2</span> fall <span style="color: #000000;">5</span> maxconn <span style="color: #000000;">1</span><br />
server &nbsp;app1_4 127.0.0.1:<span style="color: #000000;">4004</span> check inter <span style="color: #000000;">60000</span> rise <span style="color: #000000;">2</span> fall <span style="color: #000000;">5</span> maxconn <span style="color: #000000;">1</span><br />
<br />
<span style="color: #666666; font-style: italic;"># httpd web-server will handle it in case of 503, 504 errors due to it's static content</span><br />
errorloc &nbsp; &nbsp;<span style="color: #000000;">503</span> &nbsp;http:<span style="color: #000000; font-weight: bold;">//</span>DOMAIN_NAME<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">503</span>.html<br />
errorloc &nbsp; &nbsp;<span style="color: #000000;">504</span> &nbsp;http:<span style="color: #000000; font-weight: bold;">//</span>DOMAIN_NAME<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">504</span>.html<br />
<br />
<span style="color: #666666; font-style: italic;"># statistics page thru http://127.0.0.1:8080</span><br />
listen stats 127.0.0.1:<span style="color: #000000;">8080</span><br />
balance roundrobin<br />
mode http<br />
stats uri &nbsp; <span style="color: #000000; font-weight: bold;">/</span></div></td></tr></tbody></table></div>
<p>see for configuration details: <a href="http://haproxy.1wt.eu/#docs">http://haproxy.1wt.eu/#docs</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.helion-prime.com/2010/04/05/deployment-of-ruby-on-rails-applications-on-openbsd.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Tuning of Postgresql under OpenBSD</title>
		<link>http://blogs.helion-prime.com/2010/02/25/tuning-of-postgresql-under-openbsd.html</link>
		<comments>http://blogs.helion-prime.com/2010/02/25/tuning-of-postgresql-under-openbsd.html#comments</comments>
		<pubDate>Thu, 25 Feb 2010 15:04:00 +0000</pubDate>
		<dc:creator>alex.shapovalov</dc:creator>
				<category><![CDATA[openBSD]]></category>
		<category><![CDATA[rdbms]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[RoR]]></category>

		<guid isPermaLink="false">http://blogs.helion-prime.com/?p=664</guid>
		<description><![CDATA[Preamble
I assume that you already made your best with help of your favorite programming language
and recommended postgresql performance tips: http://www.postgresql.org/docs/8.4/static/performance-tips.html
Postgresql resources
No doubt that standard postgresql configuration is far from modern production environments.
Therefore you need to spend enough time with following sources.
1. resource consumption documentation:
http://www.postgresql.org/docs/8.4/static/runtime-config-resource.html
The most important parameters are:
work_mem (integer)
shared_buffers (integer)
2. Query Planning documentation:
http://www.postgresql.org/docs/current/static/runtime-config-query.html
The most important [...]]]></description>
			<content:encoded><![CDATA[<h2>Preamble</h2>
<p>I assume that you already made your best with help of your favorite programming language<br />
and recommended postgresql performance tips: <a href="http://www.postgresql.org/docs/8.4/static/performance-tips.html">http://www.postgresql.org/docs/8.4/static/performance-tips.html</a></p>
<h2>Postgresql resources</h2>
<p>No doubt that standard postgresql configuration is far from modern production environments.<br />
Therefore you need to spend enough time with following sources.</p>
<p><strong>1. resource consumption documentation:</strong><br />
<a href="http://www.postgresql.org/docs/8.4/static/runtime-config-resource.html">http://www.postgresql.org/docs/8.4/static/runtime-config-resource.html</a></p>
<p>The most important parameters are:<br />
work_mem (integer)<br />
shared_buffers (integer)</p>
<p><strong>2. Query Planning documentation:</strong><br />
<a href="http://www.postgresql.org/docs/current/static/runtime-config-query.html">http://www.postgresql.org/docs/current/static/runtime-config-query.html</a></p>
<p>The most important parameters are:<br />
effective_cache_size (integer)<br />
random_page_cost (floating point)</p>
<h2>OpenBSD resources</h2>
<p>The default sizes in the GENERIC kernel are insignificant also and waiting for your tuning as well.<br />
Posgtresql doesn&#8217;t start without enough memory size so always know when you need to increase kern.shminfo.shmmax.</p>
<p><strong>Setting that we can change in /etc/sysctl.conf</strong><br />
the maximum number of System V IPC system-wide semaphore sets (and identifiers) which can exist at any given time:<br />
kern.seminfo.semmni</p>
<p>the maximum total individual System V IPC semaphores which can be assigned by applications:<br />
kern.seminfo.semmns</p>
<p>the amount of shared memory available in the system (bytes):<br />
kern.shminfo.shmmax</p>
<p>the maximum number of shared memory segments:<br />
sysctl kern.shminfo.shmseg</p>
<p>Full list of setting you can see with:<br />
# man sysctl</p>
<p><strong>OpenBSD kernel parameters</strong><br />
So, there are set of parameters that can be tuned only with kernel rebuild. </p>
<p>You should tune them only if system works unstable with default values and you have:<br />
kernel warnings: “uvm_mapent_alloc: out of static map entries”<br />
or panics like:  “panic: malloc: out of space in kmem_map”</p>
<p>NKMEMPAGES<br />
This option defines number of pages in kernel kmem_map structure.</p>
<p>MAX_KMAPENT<br />
It defines number of static entries in kernel kmem_map (kernel virtual memory).</p>
<p>They can be changed in:<br />
/usr/src/sys/arch/conf/GENERIC</p>
<p>As start you need to recheck  &#8216;Building the System from Source&#8217; part of OpenBSD documentation:<br />
<a href="http://openbsd.org/faq/faq5.htm">http://openbsd.org/faq/faq5.htm</a></p>
<p>Usually administrators select these parameters using set of tests on dedicated testing box where<br />
 they emulate load of  production servers.</p>
<h2>Example</h2>
<p>our test server: 1x Intel Quad core CPU, 2GB RAM<br />
software: Ruby on Rails application, postgresql DB, memcached.<br />
load: about 15.000 users/day, peak load: 10 users/sec.</p>
<p>postgresql_dir/data/postgresql.conf</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># RESOURCE USAGE</span><br />
shared_buffers = 738MB<br />
max_prepared_transactions = <span style="color: #000000;">30</span><br />
work_mem = 16MB<br />
max_fsm_pages = <span style="color: #000000;">2000000</span><br />
<br />
<span style="color: #666666; font-style: italic;"># QUERY TUNING</span><br />
effective_cache_size = 512MB<br />
random_page_cost = <span style="color: #000000;">1.7</span></div></td></tr></tbody></table></div>
<p>/etc/sysctl.conf</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">kern.seminfo.semmni = <span style="color: #000000;">256</span><br />
kern.seminfo.semmns = <span style="color: #000000;">2048</span><br />
kern.shminfo.shmmax = <span style="color: #000000;">805306368</span> &nbsp; &nbsp;<span style="color: #666666; font-style: italic;"># Shared memory segment size is 768M</span></div></td></tr></tbody></table></div>
<p>/usr/src/sys/arch/conf/GENERIC</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">## custom settings</span><br />
option MAX_KMAPENT = <span style="color: #000000;">3072</span><br />
option NKMEMPAGES = <span style="color: #000000;">32768</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://blogs.helion-prime.com/2010/02/25/tuning-of-postgresql-under-openbsd.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Log rotation in Ruby on Rails applications</title>
		<link>http://blogs.helion-prime.com/2009/11/19/log-rotation-in-ruby-on-rails-applications.html</link>
		<comments>http://blogs.helion-prime.com/2009/11/19/log-rotation-in-ruby-on-rails-applications.html#comments</comments>
		<pubDate>Thu, 19 Nov 2009 12:30:04 +0000</pubDate>
		<dc:creator>alex.shapovalov</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[web-development]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[RoR]]></category>

		<guid isPermaLink="false">http://blogs.helion-prime.com/?p=623</guid>
		<description><![CDATA[preamble
Even on mid-size applications logs grow enormously fast, it&#8217;s a pity Rails doesn&#8217;t provide built-in functionality for that like Apache web-server does. Fortunately there is an easy and fast solution for that issue.
1. Install cronolog
“cronolog [http://cronolog.org/] is a simple filter program that reads log file entries from standard input and writes each entry to the [...]]]></description>
			<content:encoded><![CDATA[<h2>preamble</h2>
<p>Even on mid-size applications logs grow enormously fast, it&#8217;s a pity Rails doesn&#8217;t provide built-in functionality for that like Apache web-server does. Fortunately there is an easy and fast solution for that issue.</p>
<h2>1. Install cronolog</h2>
<p>“cronolog [<a href="http://cronolog.org/">http://cronolog.org/</a>] is a simple filter program that reads log file entries from standard input and writes each entry to the output file specified by a filename template and the current date and time.”</p>
<p>For details, and list of parameters see: [<a href="http://cronolog.org/usage.html">http://cronolog.org/usage.html</a>]</p>
<p>On GNU/Linux Debian:</p>
<pre># apt-get install cronolog</pre>
<h2>2. Setup your Rails application</h2>
<p>Edit necessary environment file: like &#8216;config/environments/production.rb&#8217; file</p>
<div class="codecolorer-container ruby mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#008000; font-style:italic;"># system logger configuration</span><br />
<span style="color:#008000; font-style:italic;"># config.logger = SyslogLogger.new</span><br />
<br />
config.<span style="color:#9900CC;">logger</span> = <span style="color:#CC00FF; font-weight:bold;">Logger</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">IO</span>.<span style="color:#9900CC;">popen</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;FULL_PATH_TO_CRONOLOG log/production.log.%Y%m%d&quot;</span>, <span style="color:#996600;">&quot;w&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
config.<span style="color:#9900CC;">logger</span>.<span style="color:#9900CC;">level</span> = <span style="color:#CC00FF; font-weight:bold;">Logger</span>::INFO</div></td></tr></tbody></table></div>
<p>That&#8217;s all, fast and easy .. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.helion-prime.com/2009/11/19/log-rotation-in-ruby-on-rails-applications.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RubyConf2008 conference</title>
		<link>http://blogs.helion-prime.com/2009/01/06/rubyconf2008-conference.html</link>
		<comments>http://blogs.helion-prime.com/2009/01/06/rubyconf2008-conference.html#comments</comments>
		<pubDate>Tue, 06 Jan 2009 16:37:50 +0000</pubDate>
		<dc:creator>alex.shapovalov</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[web-development]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[RoR]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://blogs.helion-prime.com/?p=228</guid>
		<description><![CDATA[If you are real Ruby follower you surely know about RubyConf2008 conference that was held in November 2008, or perhaps you even participated. If you still miss all the fun you can go thru whole list of videos from that conference on [http://rubyconf2008.confreaks.com/].
Or at least you can watch videos I&#8217;ve selected for busiest men:

name: Reasons [...]]]></description>
			<content:encoded><![CDATA[<p>If you are real Ruby follower you surely know about RubyConf2008 conference that was held in November 2008, or perhaps you even participated. If you still miss all the fun you can go thru whole list of videos from that conference on [<a href="http://rubyconf2008.confreaks.com/">http://rubyconf2008.confreaks.com/</a>].</p>
<p>Or at least you can watch videos I&#8217;ve selected for busiest men:<br />
<br/><br />
<b>name:</b> Reasons behind Ruby<br />
<b>duration:</b> 31 minutes<br />
<b>description:</b> introductory speech from Yukihiro Matsumoto, father of Ruby where he speaks about Ruby, its future, and community in general without any technical stuff.<br />
URL: [<a href="http://rubyconf2008.confreaks.com/matzs-keynote.html">http://rubyconf2008.confreaks.com/matzs-keynote.html</a>]<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="640" height="260" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="flashvars" value="file=http%3A%2F%2Frubyconf2008.confreaks.com%2Fvideos%2Fmatzs-keynote-small.mp4&amp;image=images%2Fmatzs-keynote-preview.jpg&amp;plugins=viral-1" /><param name="src" value="http://rubyconf2008.confreaks.com/player.swf" /><embed type="application/x-shockwave-flash" width="640" height="260" src="http://rubyconf2008.confreaks.com/player.swf" flashvars="file=http%3A%2F%2Frubyconf2008.confreaks.com%2Fvideos%2Fmatzs-keynote-small.mp4&amp;image=http://rubyconf2008.confreaks.com%2Fimages%2Fmatzs-keynote-preview.jpg&amp;plugins=viral-1" allowfullscreen="true" quality="high"></embed></object><br />
<br/></p>
<p><b>name:</b> Fork Ruby<br />
<b>duration:</b> 48 minutes<br />
<b>description:</b> speech from Dave Thomas that helped write Agile Manifesto, and Programming Ruby: A Pragmatic Programmer&#8217;s Guide. He share thoughts about possible ideas for Ruby language and its development.<br />
URL: [<a href="http://rubyconf2008.confreaks.com/keynote.html">http://rubyconf2008.confreaks.com/keynote.html</a>]<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="640" height="260" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="flashvars" value="file=http%3A%2F%2Frubyconf2008.confreaks.com%2Fvideos%2Fkeynote-small.mp4&amp;image=images%2Fkeynote-preview.jpg&amp;plugins=viral-1" /><param name="src" value="http://rubyconf2008.confreaks.com/player.swf" /><embed type="application/x-shockwave-flash" width="640" height="260" src="http://rubyconf2008.confreaks.com/player.swf" flashvars="file=http%3A%2F%2Frubyconf2008.confreaks.com%2Fvideos%2Fkeynote-small.mp4&amp;image=http://rubyconf2008.confreaks.com%2Fimages%2Fkeynote-preview.jpg&amp;plugins=viral-1" allowfullscreen="true" quality="high"></embed></object><br />
<br/></p>
<p><b>name:</b> Ruby 1.9: What to Expect<br />
<b>duration:</b> 50 minutes<br />
<b>description:</b> Dave Thomas and David Black author of popular book Ruby for Rails, Ruby core contributor and the creator and maintainer of RCRchive show to us differences between Rubys with 2 irb windows step by step.<br />
URL: [<a href="http://rubyconf2008.confreaks.com/ruby-19-what-to-expect.html">http://rubyconf2008.confreaks.com/ruby-19-what-to-expect.html</a>]<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="640" height="260" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="flashvars" value="file=http%3A%2F%2Frubyconf2008.confreaks.com%2Fvideos%2Fruby-19-what-to-expect-small.mp4&amp;image=images%2Fruby-19-what-to-expect-preview.jpg&amp;plugins=viral-1" /><param name="src" value="http://rubyconf2008.confreaks.com/player.swf" /><embed type="application/x-shockwave-flash" width="640" height="260" src="http://rubyconf2008.confreaks.com/player.swf" flashvars="file=http%3A%2F%2Frubyconf2008.confreaks.com%2Fvideos%2Fruby-19-what-to-expect-small.mp4&amp;image=http://rubyconf2008.confreaks.com%2Fimages%2Fruby-19-what-to-expect-preview.jpg&amp;plugins=viral-1" allowfullscreen="true" quality="high"></embed></object><br />
<br/></p>
<p><b>name:</b> Recovering from Enterprise<br />
<b>duration:</b> 45 minutes<br />
<b>description:</b> Comparison between Ruby and Java worlds from Ruby, and Ruby on Rails contributer Jamis Buck. He describe fundamental differences between Java and Ruby and his mistakes, and ways to avoid them. Also provide ideas how to write in real Ruby and not in Java with Ruby syntax.<br />
URL: [<a href="http://rubyconf2008.confreaks.com/recovering-from-enterprise.html">http://rubyconf2008.confreaks.com/recovering-from-enterprise.html</a>]<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="640" height="260" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="flashvars" value="file=http%3A%2F%2Frubyconf2008.confreaks.com%2Fvideos%2Frecovering-from-enterprise-small.mp4&amp;image=images%2Frecovering-from-enterprise-preview.jpg&amp;plugins=viral-1" /><param name="src" value="http://rubyconf2008.confreaks.com/player.swf" /><embed type="application/x-shockwave-flash" width="640" height="260" src="http://rubyconf2008.confreaks.com/player.swf" flashvars="file=http%3A%2F%2Frubyconf2008.confreaks.com%2Fvideos%2Frecovering-from-enterprise-small.mp4&amp;image=http://rubyconf2008.confreaks.com%2Fimages%2Frecovering-from-enterprise-preview.jpg&amp;plugins=viral-1" allowfullscreen="true" quality="high"></embed></object><br />
<br/><br/><br/><br />
Next conference will be held on 13-14 March of 2009 in Salt Lake City.<br />
See details on official site: [<a href="http://mtnwestrubyconf.org/">http://mtnwestrubyconf.org/</a>]<br />
<br/><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.helion-prime.com/2009/01/06/rubyconf2008-conference.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
