<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Rants on sysarcher/@ich_code</title><link>https://sysarcher.github.io/categories/rants/</link><description>Recent content in Rants on sysarcher/@ich_code</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 13 Dec 2023 20:05:37 +0200</lastBuildDate><atom:link href="https://sysarcher.github.io/categories/rants/index.xml" rel="self" type="application/rss+xml"/><item><title>Applying to YC!</title><link>https://sysarcher.github.io/posts/yc/</link><pubDate>Wed, 13 Dec 2023 20:05:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/yc/</guid><description>&lt;p&gt;So I&amp;rsquo;m applying for a startup funding to YC. And I wanted to share this pic with them. Will update stuff here later.&lt;/p&gt;
&lt;p&gt;&lt;img loading="lazy" src="https://sysarcher.github.io/posts/yc/img/image.png"&gt;&lt;/p&gt;</description><content:encoded><![CDATA[<p>So I&rsquo;m applying for a startup funding to YC. And I wanted to share this pic with them. Will update stuff here later.</p>
<p><img loading="lazy" src="/posts/yc/img/image.png"></p>
]]></content:encoded></item><item><title>Metrics Server headache</title><link>https://sysarcher.github.io/posts/k8s-metrics-server-headaches/</link><pubDate>Wed, 13 Dec 2023 20:05:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/k8s-metrics-server-headaches/</guid><description>&lt;p&gt;One of the pains of playing around with Metrics server is that it sometimes doesn&amp;rsquo;t connect to the node. In my case it was unhealthy and complaining about &lt;code&gt;x509&lt;/code&gt; certs.&lt;/p&gt;
&lt;p&gt;Not for prod but here&amp;rsquo;s a resolution:&lt;/p&gt;
&lt;h3 id="install-metrics-server"&gt;Install Metrics Server&lt;/h3&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.6.4/components.yaml
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Apply the patch:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;kubectl -n kube-system patch deployment metrics-server --type=json \
-p=&amp;#39;[{&amp;#34;op&amp;#34;: &amp;#34;add&amp;#34;, &amp;#34;path&amp;#34;: &amp;#34;/spec/template/spec/containers/0/args/-&amp;#34;, &amp;#34;value&amp;#34;: &amp;#34;--kubelet-insecure-tls&amp;#34;}]]&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;a href="https://github.com/kubernetes-sigs/metrics-server/issues/196#issuecomment-1311356441"&gt;thanks to @awalker125&lt;/a&gt;&lt;/p&gt;</description><content:encoded><![CDATA[<p>One of the pains of playing around with Metrics server is that it sometimes doesn&rsquo;t connect to the node. In my case it was unhealthy and complaining about <code>x509</code> certs.</p>
<p>Not for prod but here&rsquo;s a resolution:</p>
<h3 id="install-metrics-server">Install Metrics Server</h3>
<pre tabindex="0"><code>kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.6.4/components.yaml
</code></pre><p>Apply the patch:</p>
<pre tabindex="0"><code>kubectl -n kube-system patch deployment metrics-server --type=json \
-p=&#39;[{&#34;op&#34;: &#34;add&#34;, &#34;path&#34;: &#34;/spec/template/spec/containers/0/args/-&#34;, &#34;value&#34;: &#34;--kubelet-insecure-tls&#34;}]]&#39;
</code></pre><p><a href="https://github.com/kubernetes-sigs/metrics-server/issues/196#issuecomment-1311356441">thanks to @awalker125</a></p>
]]></content:encoded></item><item><title>Core Isolation Feature in STX4.0</title><link>https://sysarcher.github.io/posts/stx-for-rt/</link><pubDate>Mon, 09 Nov 2020 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/stx-for-rt/</guid><description>&lt;p&gt;&lt;em&gt;StarlingX is continuing to evolve and update it&amp;rsquo;s Real-time capabilities but documentation can be a bit sparse. This page is hopefully a placeholder for until we have a great documentation around the capabilities.&lt;/em&gt;&lt;/p&gt;
&lt;h3 id="isolating-cpu-cores"&gt;Isolating CPU Cores&lt;/h3&gt;
&lt;p&gt;In a StarlingX cluster CPU isolation and Kernel commandline parameters are (generally) managed from the active controller through &lt;code&gt;system host-cpu-XXX&lt;/code&gt; commands.&lt;/p&gt;
&lt;p&gt;For isolation, we have the &lt;code&gt;Application-isolated&lt;/code&gt; assigned_function.&lt;/p&gt;
&lt;p&gt;Get current functions:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-console" data-lang="console"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ system host-cpu-list controller-0
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;+--------------------------------------+----------+-----------+----------+--------+-----------------------------------------+-------------------+
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;| uuid | log_core | processor | phy_core | thread | processor_model | assigned_function |
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;+--------------------------------------+----------+-----------+----------+--------+-----------------------------------------+-------------------+
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;| 65b8337e-08bf-4e32-b7e6-17505eaf0806 | 0 | 0 | 0 | 0 | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Platform |
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;| b7578ba2-cba0-46cd-b860-3ba5c03ba91d | 1 | 0 | 1 | 0 | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Platform |
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;| ff7447a2-00df-43db-8716-d1416faf89bc | 2 | 0 | 2 | 0 | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application |
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;| 142796e5-b17d-48e9-b18a-b84c1ea5ae37 | 3 | 0 | 3 | 0 | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application |
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;| c68a8dc7-367f-4512-84ca-ec559fbb63f4 | 4 | 0 | 4 | 0 | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application |
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;| 15f360e2-d27c-4d9a-b0ff-0b78387eeb8c | 5 | 0 | 5 | 0 | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application |
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;| 89274cb5-4fb5-4f5b-a8c5-ec36394b5ce5 | 6 | 0 | 6 | 0 | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application |
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;| 33fb1e8e-77cd-4334-b061-dd40e6b7f7ba | 7 | 0 | 7 | 0 | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application |
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;| 8c804a31-c61e-408c-83c4-3c7192a861d8 | 8 | 0 | 0 | 1 | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Platform |
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;| 560ad09d-48df-42ec-8588-7e739030d7e3 | 9 | 0 | 1 | 1 | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Platform |
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;| cbd83713-0118-4995-9810-486cfdbb912e | 10 | 0 | 2 | 1 | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application |
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;| cb45713a-fa51-4628-b536-e3d5d57c891e | 11 | 0 | 3 | 1 | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application |
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;| 28dff3de-9913-4055-89d5-09dfc084c3c1 | 12 | 0 | 4 | 1 | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application |
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;| 98cf6c9e-2717-4f88-b487-487dbdadd18e | 13 | 0 | 5 | 1 | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application |
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;| 73dcec10-7a62-4d07-ba23-3482d0e0f2af | 14 | 0 | 6 | 1 | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application |
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;| 4a5a4477-f0db-4d77-9a6a-c77e5ca292e4 | 15 | 0 | 7 | 1 | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application |
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;+--------------------------------------+----------+-----------+----------+--------+-----------------------------------------+-------------------+
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;system host-cpu-modify&lt;/code&gt; command is used to modify the assigned function.&lt;/p&gt;</description><content:encoded><![CDATA[<p><em>StarlingX is continuing to evolve and update it&rsquo;s Real-time capabilities but documentation can be a bit sparse. This page is hopefully a placeholder for until we have a great documentation around the capabilities.</em></p>
<h3 id="isolating-cpu-cores">Isolating CPU Cores</h3>
<p>In a StarlingX cluster CPU isolation and Kernel commandline parameters are (generally) managed from the active controller through <code>system host-cpu-XXX</code> commands.</p>
<p>For isolation, we have the <code>Application-isolated</code> assigned_function.</p>
<p>Get current functions:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>$ system host-cpu-list controller-0
</span></span><span style="display:flex;"><span>+--------------------------------------+----------+-----------+----------+--------+-----------------------------------------+-------------------+
</span></span><span style="display:flex;"><span>| uuid                                 | log_core | processor | phy_core | thread | processor_model                         | assigned_function |
</span></span><span style="display:flex;"><span>+--------------------------------------+----------+-----------+----------+--------+-----------------------------------------+-------------------+
</span></span><span style="display:flex;"><span>| 65b8337e-08bf-4e32-b7e6-17505eaf0806 | 0        | 0         | 0        | 0      | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Platform          |
</span></span><span style="display:flex;"><span>| b7578ba2-cba0-46cd-b860-3ba5c03ba91d | 1        | 0         | 1        | 0      | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Platform          |
</span></span><span style="display:flex;"><span>| ff7447a2-00df-43db-8716-d1416faf89bc | 2        | 0         | 2        | 0      | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application       |
</span></span><span style="display:flex;"><span>| 142796e5-b17d-48e9-b18a-b84c1ea5ae37 | 3        | 0         | 3        | 0      | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application       |
</span></span><span style="display:flex;"><span>| c68a8dc7-367f-4512-84ca-ec559fbb63f4 | 4        | 0         | 4        | 0      | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application       |
</span></span><span style="display:flex;"><span>| 15f360e2-d27c-4d9a-b0ff-0b78387eeb8c | 5        | 0         | 5        | 0      | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application       |
</span></span><span style="display:flex;"><span>| 89274cb5-4fb5-4f5b-a8c5-ec36394b5ce5 | 6        | 0         | 6        | 0      | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application       |
</span></span><span style="display:flex;"><span>| 33fb1e8e-77cd-4334-b061-dd40e6b7f7ba | 7        | 0         | 7        | 0      | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application       |
</span></span><span style="display:flex;"><span>| 8c804a31-c61e-408c-83c4-3c7192a861d8 | 8        | 0         | 0        | 1      | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Platform          |
</span></span><span style="display:flex;"><span>| 560ad09d-48df-42ec-8588-7e739030d7e3 | 9        | 0         | 1        | 1      | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Platform          |
</span></span><span style="display:flex;"><span>| cbd83713-0118-4995-9810-486cfdbb912e | 10       | 0         | 2        | 1      | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application       |
</span></span><span style="display:flex;"><span>| cb45713a-fa51-4628-b536-e3d5d57c891e | 11       | 0         | 3        | 1      | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application       |
</span></span><span style="display:flex;"><span>| 28dff3de-9913-4055-89d5-09dfc084c3c1 | 12       | 0         | 4        | 1      | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application       |
</span></span><span style="display:flex;"><span>| 98cf6c9e-2717-4f88-b487-487dbdadd18e | 13       | 0         | 5        | 1      | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application       |
</span></span><span style="display:flex;"><span>| 73dcec10-7a62-4d07-ba23-3482d0e0f2af | 14       | 0         | 6        | 1      | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application       |
</span></span><span style="display:flex;"><span>| 4a5a4477-f0db-4d77-9a6a-c77e5ca292e4 | 15       | 0         | 7        | 1      | Intel(R) Xeon(R) D-2146NT CPU @ 2.30GHz | Application       |
</span></span><span style="display:flex;"><span>+--------------------------------------+----------+-----------+----------+--------+-----------------------------------------+-------------------+
</span></span></code></pre></div><p>The <code>system host-cpu-modify</code> command is used to modify the assigned function.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>$ system host-cpu-modify
</span></span><span style="display:flex;"><span>usage: system host-cpu-modify [--nowrap] -f &lt;function&gt;
</span></span><span style="display:flex;"><span>                              [-p0 &lt;num_cores_on_processor0&gt;]
</span></span><span style="display:flex;"><span>                              [-p1 &lt;num_cores_on_processor1&gt;]
</span></span><span style="display:flex;"><span>                              [-p2 &lt;num_cores_on_processor2&gt;]
</span></span><span style="display:flex;"><span>                              [-p3 &lt;num_cores_on_processor3&gt;]
</span></span><span style="display:flex;"><span>                              &lt;hostnameorid&gt;
</span></span></code></pre></div><p>For example, to set the 15th logical core to <code>Application-isolated</code>:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>$ system host-cpu-modify -f Application-isolated -p0 <span style="color:#ae81ff">15</span> controller-1
</span></span></code></pre></div><h3 id="stx-openstack"><code>stx-openstack</code></h3>
<p>One application that can make use of core isolation is <code>stx-openstack</code>. For example, if there are realtime VMs that require scheduling on isolated/dedicated cores, we need to set the <code>compute</code> key in the helm overrides (see OpenStack docs for: <a href="https://docs.openstack.org/nova/latest/configuration/config.html#compute.cpu_dedicated_set"><code>cpu_dedicated_set</code></a> and <a href="https://docs.openstack.org/nova/latest/configuration/config.html#compute.cpu_shared_set"><code>cpu_shared_set</code></a>).</p>
<p>Create a file for <code>nova</code> overrides that looks like this:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">conf</span>:
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">overrides</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">nova_compute</span>:
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">hosts</span>:
</span></span><span style="display:flex;"><span>      - <span style="color:#f92672">conf</span>:
</span></span><span style="display:flex;"><span>          <span style="color:#75715e"># DELETED FOR CONCISENESS</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">name</span>: <span style="color:#ae81ff">controller-0</span>
</span></span><span style="display:flex;"><span>      - <span style="color:#f92672">conf</span>:
</span></span><span style="display:flex;"><span>          <span style="color:#75715e"># DELETED FOR CONCISENESS</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">name</span>: <span style="color:#ae81ff">controller-1</span>
</span></span><span style="display:flex;"><span>      - <span style="color:#f92672">conf</span>:
</span></span><span style="display:flex;"><span>          <span style="color:#f92672">nova</span>:
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">DEFAULT</span>:
</span></span><span style="display:flex;"><span>              <span style="color:#75715e"># NO CHANGE</span>
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">compute</span>:
</span></span><span style="display:flex;"><span>              <span style="color:#f92672">cpu_dedicated_set</span>: <span style="color:#e6db74">&#39;&#34;1-2&#34;&#39;</span>
</span></span><span style="display:flex;"><span>              <span style="color:#f92672">cpu_shared_set</span>: <span style="color:#e6db74">&#39;&#34;3-5&#34;&#39;</span>
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">libvirt</span>:
</span></span><span style="display:flex;"><span>              <span style="color:#75715e"># NO CHANGE</span>
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">pci</span>:
</span></span><span style="display:flex;"><span>              <span style="color:#f92672">passthrough_whitelist</span>:
</span></span><span style="display:flex;"><span>                <span style="color:#75715e"># NO CHANGE</span>
</span></span><span style="display:flex;"><span>            <span style="color:#f92672">vnc</span>:
</span></span><span style="display:flex;"><span>              <span style="color:#75715e"># NO CHANGE</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">name</span>: <span style="color:#ae81ff">worker</span>
</span></span></code></pre></div><p>Then, run the following command to apply these overrides:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>$ <span style="color:#75715e"># Update Helm overrides</span>
</span></span><span style="display:flex;"><span>$ system helm-override-update --values &lt;yaml-file-with-overrides&gt;.yaml stx-openstack nova openstack
</span></span><span style="display:flex;"><span>$
</span></span><span style="display:flex;"><span>$ <span style="color:#75715e"># Apply application!!</span>
</span></span><span style="display:flex;"><span>$ system application-apply stx-openstack
</span></span></code></pre></div><p>Now, Openstack is able to schedule VMs on isolated CPU cores.</p>
<h3 id="openstack-flavor">OpenStack Flavor</h3>
<p>The following properties should be added to the RT VM (hugepages not yet included)</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>$ openstack flavor show rt.medium
</span></span><span style="display:flex;"><span>+----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
</span></span><span style="display:flex;"><span>| Field                      | Value                                                                                                                                                           |
</span></span><span style="display:flex;"><span>+----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
</span></span><span style="display:flex;"><span>| OS-FLV-DISABLED:disabled   | False                                                                                                                                                           |
</span></span><span style="display:flex;"><span>| OS-FLV-EXT-DATA:ephemeral  | 0                                                                                                                                                               |
</span></span><span style="display:flex;"><span>| access_project_ids         | None                                                                                                                                                            |
</span></span><span style="display:flex;"><span>| disk                       | 10                                                                                                                                                              |
</span></span><span style="display:flex;"><span>| id                         | xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx                                                                                                                            |
</span></span><span style="display:flex;"><span>| name                       | rt.medium                                                                                                                                                       |
</span></span><span style="display:flex;"><span>| os-flavor-access:is_public | True                                                                                                                                                            |
</span></span><span style="display:flex;"><span>| properties                 | hw:cpu_policy=&#39;dedicated&#39;, hw:cpu_realtime=&#39;yes&#39;, hw:cpu_realtime_mask=&#39;^0&#39;, hw:cpu_thread_policy=&#39;isolate&#39;, hw:emulator_threads_policy=&#39;share&#39;, hw:pmu=&#39;False&#39; |
</span></span><span style="display:flex;"><span>| ram                        | 2048                                                                                                                                                            |
</span></span><span style="display:flex;"><span>| rxtx_factor                | 1.0                                                                                                                                                             |
</span></span><span style="display:flex;"><span>| swap                       |                                                                                                                                                                 |
</span></span><span style="display:flex;"><span>| vcpus                      | 2                                                                                                                                                               |
</span></span><span style="display:flex;"><span>+----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
</span></span></code></pre></div><p>Note on 2 vcpus: one will be used by linux and the other will be utilized by the RT program (<code>cyclictest</code> for instance)&hellip; You may use any number of vcpus &hellip; just make sure that one vcpu is dedicated for linux.</p>
]]></content:encoded></item><item><title>Remapping Keys</title><link>https://sysarcher.github.io/posts/remap-your-keys/</link><pubDate>Wed, 15 Jul 2020 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/remap-your-keys/</guid><description>&lt;p&gt;I use Vim a lot. And if you&amp;rsquo;re a productive user of Vim, you will definitely appreciate the following remaps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;ESC: I have remapped the Escape key to CAPSLOCK. Who uses CapsLock? ESC on the other hand is a Vim user&amp;rsquo;s go-to reflex. So keep it close-by.&lt;/li&gt;
&lt;li&gt;ESC+HJKL: For navigation. Why would you use muscles to move over to the arrow keys when you have them under your fingers.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="how-to"&gt;How-to&lt;/h3&gt;
&lt;p&gt;&lt;a href="http://manpages.ubuntu.com/manpages/trusty/man1/xmodmap.1.html"&gt;&lt;code&gt;xmodmap&lt;/code&gt;&lt;/a&gt; can be used to modify these key settings. But I think it will only work for X-sessions.&lt;/p&gt;</description><content:encoded><![CDATA[<p>I use Vim a lot. And if you&rsquo;re a productive user of Vim, you will definitely appreciate the following remaps:</p>
<ul>
<li>ESC: I have remapped the Escape key to CAPSLOCK. Who uses CapsLock? ESC on the other hand is a Vim user&rsquo;s go-to reflex. So keep it close-by.</li>
<li>ESC+HJKL: For navigation. Why would you use muscles to move over to the arrow keys when you have them under your fingers.</li>
</ul>
<h3 id="how-to">How-to</h3>
<p><a href="http://manpages.ubuntu.com/manpages/trusty/man1/xmodmap.1.html"><code>xmodmap</code></a> can be used to modify these key settings. But I think it will only work for X-sessions.</p>
<p>I found <a href="https://wiki.gnome.org/Projects/dconf"><code>dconf/org/gnome/desktop/input-sources/xkb-options</code></a> to be a much more solid solution.</p>
<p>Under <code>xkb-options</code> you can put a &ldquo;Custom value&rdquo; like: <code>['caps:swapescape']</code> (note: syntax is important!!)</p>
<h4 id="windows-note">Windows Note</h4>
<p>By far the best and most reliable key remapper on Windows is <a href="https://github.com/randyrants/sharpkeys">sharpkeys (<code>randyrants/sharpkeys</code>)</a>.</p>
]]></content:encoded></item><item><title>On WebAssembly</title><link>https://sysarcher.github.io/posts/web-assembly/</link><pubDate>Tue, 17 Mar 2020 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/web-assembly/</guid><description>&lt;p&gt;This blog is not going to define what WebAssembly is, how it interacts with JS or other languages; there are too many blogs and posts available on the internet already.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re not familiar with WebAssembly, I would suggest you start here:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://hacks.mozilla.org/2017/02/a-cartoon-intro-to-webassembly/"&gt;A cartoon intro to WebAssembly&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/WebAssembly/Concepts"&gt;WebAssembly Concepts&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This blog post is about wondering what WebAssembly can look like for some usecases.&lt;/p&gt;
&lt;h2 id="run-everywhere"&gt;Run Everywhere&lt;/h2&gt;
&lt;p&gt;WebAssembly can run everywhere - atleast that&amp;rsquo;s the goal. It&amp;rsquo;s performant - as performant as C/C++ and it&amp;rsquo;s secure.&lt;/p&gt;</description><content:encoded><![CDATA[<p>This blog is not going to define what WebAssembly is, how it interacts with JS or other languages; there are too many blogs and posts available on the internet already.</p>
<p>If you&rsquo;re not familiar with WebAssembly, I would suggest you start here:</p>
<ul>
<li><a href="https://hacks.mozilla.org/2017/02/a-cartoon-intro-to-webassembly/">A cartoon intro to WebAssembly</a></li>
<li><a href="https://developer.mozilla.org/en-US/docs/WebAssembly/Concepts">WebAssembly Concepts</a></li>
</ul>
<p>This blog post is about wondering what WebAssembly can look like for some usecases.</p>
<h2 id="run-everywhere">Run Everywhere</h2>
<p>WebAssembly can run everywhere - atleast that&rsquo;s the goal. It&rsquo;s performant - as performant as C/C++ and it&rsquo;s secure.</p>
<blockquote>
<p>WebAssembly is a type of code that can be run in modern web browsers and provides new features and major gains in performance.</p>
</blockquote>
<p><em><a href="https://developer.mozilla.org/en-US/docs/WebAssembly/Concepts">https://developer.mozilla.org/en-US/docs/WebAssembly/Concepts</a></em></p>
<h3 id="open-questions">Open Questions</h3>
<p>Although designed for the web, WebAssembly is able to run portably across architectures. This can be a nice way to distribute applications. Some day perhaps WebAssembly runtimes will be a part of <em>all</em> OSes.</p>
<p>What needs to be determined IMO is:</p>
<ul>
<li>
<p>Realtime capabilities</p>
<p>Can WebAssembly modules written in C/C++ provide any RT capabilities? If so, then it&rsquo;ll be interesting to evaluate whether a WebAssembly runtime is all that a PLC should be. Apps running the PLC would be delivered like software. Less stickiness for everybody.</p>
</li>
<li>
<p>Recompile all the things</p>
<p>Can WebAssembly runtimes replace native programs? How about message queues, brokers implemented in WebAssembly? I know it&rsquo;s not possible to compile all complicated software to WebAssembly today - but is that the future too?</p>
</li>
<li>
<p>UI</p>
<p>Will Slack and it&rsquo;s likes re-implement significant portions of their code to WebAssembly? Should work, right?</p>
</li>
<li>
<p>Edge</p>
<p>Fastly has already done lots of work with their CDN running WebAssembly-isolated workloads. Can we bring this down to the Edge where we&rsquo;re running containers today?</p>
</li>
</ul>
<h2 id="conclusion">Conclusion</h2>
<p>There&rsquo;re so many things I&rsquo;m looking an answer for. This year is going to be awesome!</p>
]]></content:encoded></item><item><title>My Python Environment</title><link>https://sysarcher.github.io/posts/python-env/</link><pubDate>Wed, 12 Feb 2020 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/python-env/</guid><description>&lt;p&gt;The most common way people go about setting up a Python environment is to do something like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-console" data-lang="console"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ sudo apt install python3 python3-pip &lt;span style="color:#75715e"&gt;# installs pip3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ sudo pip3 install --upgrade pip &lt;span style="color:#75715e"&gt;# upgrade pip to latest version&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Congrats, now you&amp;rsquo;re stuck with whatever version ships with the distro. I think we can do better!&lt;/p&gt;
&lt;h1 id="pyenv"&gt;&lt;code&gt;pyenv&lt;/code&gt;&lt;/h1&gt;
&lt;p&gt;My recommendation now, is to use &lt;code&gt;pyenv&lt;/code&gt; with which you can manage multiple versions, virtualenvs through a nice CLI&lt;/p&gt;</description><content:encoded><![CDATA[<p>The most common way people go about setting up a Python environment is to do something like this:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>$ sudo apt install python3 python3-pip    <span style="color:#75715e"># installs pip3</span>
</span></span><span style="display:flex;"><span>$ sudo pip3 install --upgrade pip         <span style="color:#75715e"># upgrade pip to latest version</span>
</span></span></code></pre></div><p>Congrats, now you&rsquo;re stuck with whatever version ships with the distro. I think we can do better!</p>
<h1 id="pyenv"><code>pyenv</code></h1>
<p>My recommendation now, is to use <code>pyenv</code> with which you can manage multiple versions, virtualenvs through a nice CLI</p>
<h3 id="uninstall-pippip3">Uninstall <code>pip</code>/<code>pip3</code></h3>
<p>Before proceeding, I&rsquo;d suggest uninstalling <code>pip</code> using <code>pip uninstall pip</code> and <code>sudo apt remove python3-pip</code></p>
<h2 id="installation">Installation</h2>
<p><a href="https://github.com/pyenv/pyenv-installer">Using the <code>pyenv</code> installer project</a></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>$ sudo apt install libssl-dev <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span>                   libsqlite-dev \
</span></span><span style="display:flex;"><span>                   libreadline-dev \
</span></span><span style="display:flex;"><span>                   libbz2-dev  \
</span></span><span style="display:flex;"><span>                   libsqlite3-dev  # I&#39;ve observed failures without these libs
</span></span><span style="display:flex;"><span>$ curl https://pyenv.run | bash
</span></span><span style="display:flex;"><span>...
</span></span><span style="display:flex;"><span>WARNING: seems you still have not added &#39;pyenv&#39; to the load path.
</span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span># Load pyenv automatically by adding
</span></span><span style="display:flex;"><span># the following to ~/.bashrc:
</span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span>export PATH=&#34;/home/taimoor/.pyenv/bin:$PATH&#34;
</span></span><span style="display:flex;"><span>eval &#34;$(pyenv init -)&#34;
</span></span><span style="display:flex;"><span>eval &#34;$(pyenv virtualenv-init -)&#34;
</span></span></code></pre></div><p>This should set up <code>pyenv</code> for you. Read the instructions printed at the end and follow them! Add the three things to your <code>~/.bashrc</code> or <code>~/.zshrc</code> or whatever.</p>
<h2 id="usage-summarized">Usage (summarized)</h2>
<p>Example: Install Python 3.8.1:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>$ pyenv install 3.8.1
</span></span></code></pre></div><p>P.S: logout and log back in</p>
<p>P.S2: Tab completion works!</p>
<h3 id="virtualenv">Virtualenv</h3>
<p>Create a virtualenv</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>$ pyenv virtualenv 3.8.1 venv3.8    <span style="color:#75715e"># create a virtualenv called venv3.8 based on python 3.8.1</span>
</span></span><span style="display:flex;"><span>$ pyenv activate venv3.8    <span style="color:#75715e"># activate venv3.8</span>
</span></span><span style="display:flex;"><span>$ python --version
</span></span><span style="display:flex;"><span>Python 3.8.1
</span></span><span style="display:flex;"><span>$ which python
</span></span><span style="display:flex;"><span>/home/taimoor/.pyenv/shims/python
</span></span></code></pre></div><p>That&rsquo;s it! Now you can manage your anaconda and python environments, versions sooo much better.</p>
]]></content:encoded></item><item><title>New Year's Resolutions (2020 Edition)</title><link>https://sysarcher.github.io/posts/resolutions-2020/</link><pubDate>Tue, 07 Jan 2020 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/resolutions-2020/</guid><description>&lt;p&gt;Resolutions&amp;hellip; Goals&amp;hellip; things you write down to &lt;em&gt;not&lt;/em&gt; follow! But you write them down anyways..&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.urbandictionary.com/define.php?term=Hindsight%20is%2020%2F20"&gt;2020 used to be hindsight&lt;/a&gt; but not any more. It&amp;rsquo;s here. I&amp;rsquo;ll write down my own resolutions for this year here&amp;hellip;&lt;/p&gt;
&lt;h4 id="technology"&gt;Technology&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Continue with my FP journey (Clojure and F#)&lt;/li&gt;
&lt;li&gt;Keep on learning Rust and Golang&lt;/li&gt;
&lt;li&gt;(Maybe) look into Ziglang&lt;/li&gt;
&lt;li&gt;DDD and Software Architecture. I have been reading a lot about it recently and will continue to try to do so. Especially Wlachsinn&amp;rsquo;s book!&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="health"&gt;Health&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Start exercising regularly&lt;/li&gt;
&lt;li&gt;Eat healthy food normally (it&amp;rsquo;s fine to eat unhealthy &lt;em&gt;sometimes&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;Swim!&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="misc"&gt;Misc&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Start a side-project in Rust (embedded??)&lt;/li&gt;
&lt;li&gt;Start a web Frontend (Clojurescript??) project&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="conclusion"&gt;Conclusion&lt;/h4&gt;
&lt;p&gt;I&amp;rsquo;m sure I&amp;rsquo;ll miss out on some things and do some right&amp;hellip; Fingers crossed.&lt;/p&gt;</description><content:encoded><![CDATA[<p>Resolutions&hellip; Goals&hellip; things you write down to <em>not</em> follow! But you write them down anyways..</p>
<p><a href="https://www.urbandictionary.com/define.php?term=Hindsight%20is%2020%2F20">2020 used to be hindsight</a> but not any more. It&rsquo;s here. I&rsquo;ll write down my own resolutions for this year here&hellip;</p>
<h4 id="technology">Technology</h4>
<ul>
<li>Continue with my FP journey (Clojure and F#)</li>
<li>Keep on learning Rust and Golang</li>
<li>(Maybe) look into Ziglang</li>
<li>DDD and Software Architecture. I have been reading a lot about it recently and will continue to try to do so. Especially Wlachsinn&rsquo;s book!</li>
</ul>
<h4 id="health">Health</h4>
<ul>
<li>Start exercising regularly</li>
<li>Eat healthy food normally (it&rsquo;s fine to eat unhealthy <em>sometimes</em>)</li>
<li>Swim!</li>
</ul>
<h4 id="misc">Misc</h4>
<ul>
<li>Start a side-project in Rust (embedded??)</li>
<li>Start a web Frontend (Clojurescript??) project</li>
</ul>
<h4 id="conclusion">Conclusion</h4>
<p>I&rsquo;m sure I&rsquo;ll miss out on some things and do some right&hellip; Fingers crossed.</p>
]]></content:encoded></item><item><title>Answering Questions on SPS 2019 Demo</title><link>https://sysarcher.github.io/posts/sps-review/</link><pubDate>Sun, 01 Dec 2019 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/sps-review/</guid><description>&lt;p&gt;SPS Nuremberg is one of the largest gatherings of the Industry. This year was no different.&lt;/p&gt;
&lt;p&gt;I was part of a team that presented the concept of OT/IT consolidation. I got quite a few comments and questions about the &lt;a href="https://www.facebook.com/ziakhan/videos/10156612828352623/"&gt;demo video (in Urdu here)&lt;/a&gt;. So here&amp;rsquo;s a shot at answering some of the questions I got forwarded:&lt;/p&gt;
&lt;p&gt;The demo was (in oversimplified terms) showing PLC compute moved to software which can be orchestrated using Kubernetes.&lt;/p&gt;</description><content:encoded><![CDATA[<p>SPS Nuremberg is one of the largest gatherings of the Industry. This year was no different.</p>
<p>I was part of a team that presented the concept of OT/IT consolidation. I got quite a few comments and questions about the <a href="https://www.facebook.com/ziakhan/videos/10156612828352623/">demo video (in Urdu here)</a>. So here&rsquo;s a shot at answering some of the questions I got forwarded:</p>
<p>The demo was (in oversimplified terms) showing PLC compute moved to software which can be orchestrated using Kubernetes.</p>
<p><strong>Q/A</strong></p>
<ul>
<li><em>Nice move.  But how sensor data is being processed without PLC or a microcontroller?</em></li>
</ul>
<p>There are &ldquo;dumb&rdquo; IO devices connected over Profinet in this case (but it can really be any fieldbus e.g. Ethercat etc.)</p>
<p>Some people had a comment about ADCs being involved. YES, but we need to think at a higher level in this case. Analog and Digital IOs are obviously involved under-the-hood.</p>
<ul>
<li><em>So what is difference between an arduino microcontroller and program able logical controller</em></li>
</ul>
<p>This is a strange question. Arduino is not a microcontroller, it&rsquo;s a prototyping platform (and a company as well.) This prototyping platform <em>has</em> a microcontroller. A PLC is a digital computer made for the industry. Follows many industrial IEC standards. It is a part of many things. For our demo, we were using ADAM PLCs from Advantech.</p>
<p>Arduino can also be programmed to become a PLC (see the OpenPLC project: <a href="https://www.openplcproject.com/">https://www.openplcproject.com/</a>)</p>
<ul>
<li><em>Ok good step so what precautions u take if ur factory text file or source code get hack??</em></li>
</ul>
<p>If you get hacked, &ldquo;precautions&rdquo; are irrelevant. The word precaution means that it ought to prevent the hack. I&rsquo;m assuming this was the question as well. Although this was not a security demo, but k8s brings with it good security practices (certs, https etc.). &ldquo;Hack&rdquo; is too open-ended of a word.</p>
<p>Security practices are a whole different topic. Perhaps not relevant for the discussion here.</p>
<ul>
<li><em>So can we apply machine learning and Ai codes in PLC??</em></li>
</ul>
<p>I would read my answer above and conclude: NO. PLCs are meant for other things, Google is your friend!</p>
<ul>
<li><em>We get machine learning codes in Python mostly some standard c language so what u suggest??</em></li>
</ul>
<p>Great attempt at moving off-topic! (Always one person in the team!!)</p>
<ul>
<li><em>Using structure text and block diagrams and ladder diagrams??</em></li>
</ul>
<p>Yup</p>
<ul>
<li><em>One more thing can u tell me PLC have a capability of processing i mean controller and processor r 2 different things so can u guide me ?</em></li>
</ul>
<p>They are computers in the end! The scope of their work is a bit limited to their application. Check out the OpenPLC project I linked to above.</p>
<ul>
<li><em>No. That is why I am designing machines and control systems using hybrid model. Means using PLCs, Microcontrollers and Computers to accomplish all kind of customization which include AI and custom GUIs in python and VueJs</em></li>
</ul>
<p>Interesting&hellip; But we should not convolute so many things in one sentence. Everything you mentioned has its place. And they work together. We ought to avoid the use of the words &ldquo;Hybrid Model&rdquo; which sounds like formalism.</p>
<ul>
<li><em>Recently I have designed Pakistan&rsquo;s first industrial Artificially intelligent sorting robotic conveyor using this hybrid model.</em></li>
</ul>
<p>Tall claims!! I saw the video and one comment for now is that it might not meet some safety standards we have in the EU and US. Best of luck my friend!! Bring us laurels.</p>
<p>Also, I would tone down on Artificial intelligence and use specifics when talking to more technical folk (e.g. Computer Vision, OpenVINO, Inference, Learning etc.)</p>
<ul>
<li><em>So its coslty???</em></li>
</ul>
<p>Yes, it&rsquo;s supposed to run for many years so, there&rsquo;s a lot of hardening.</p>
<p><strong>Conclusion</strong></p>
<p>I&rsquo;m surprised by the interest people showed in the project. It&rsquo;s still a concept and we want to work with the Industry leaders to bring about more mature products.</p>
]]></content:encoded></item><item><title>Getting Started with Clojure[script] Behind Corporate Proxy</title><link>https://sysarcher.github.io/posts/java-proxies/</link><pubDate>Mon, 14 Oct 2019 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/java-proxies/</guid><description>&lt;p&gt;So on my Clojurescript journey, the first roadblock I hit was corporate proxy. I don&amp;rsquo;t know why Java, maven, clojure (everybody?) doesn&amp;rsquo;t respect the environment variables but this is a real pain.&lt;/p&gt;
&lt;h3 id="getting-started"&gt;Getting started&lt;/h3&gt;
&lt;p&gt;Clojurescript is written in Clojure which requires Java. So we need to get all three up and running.&lt;/p&gt;
&lt;h4 id="java"&gt;Java&lt;/h4&gt;
&lt;p&gt;To get Java JDK and JRE, run:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-console" data-lang="console"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ sudo apt install openjdk-11-jre
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ sudo apt install openjdk-11-jdk
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For proxy settings, edit &lt;code&gt;/etc/java-11-openjdk/net.properties&lt;/code&gt;.&lt;/p&gt;</description><content:encoded><![CDATA[<p>So on my Clojurescript journey, the first roadblock I hit was corporate proxy. I don&rsquo;t know why Java, maven, clojure (everybody?) doesn&rsquo;t respect the environment variables but this is a real pain.</p>
<h3 id="getting-started">Getting started</h3>
<p>Clojurescript is written in Clojure which requires Java. So we need to get all three up and running.</p>
<h4 id="java">Java</h4>
<p>To get Java JDK and JRE, run:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>$ sudo apt install openjdk-11-jre
</span></span><span style="display:flex;"><span>$ sudo apt install openjdk-11-jdk
</span></span></code></pre></div><p>For proxy settings, edit <code>/etc/java-11-openjdk/net.properties</code>.</p>
<p>Example for <code>http</code> proxy in the file:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-ini" data-lang="ini"><span style="display:flex;"><span><span style="color:#a6e22e">http.proxyHost</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;proxy-addr.company.com&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">http.proxyPort</span><span style="color:#f92672">=</span><span style="color:#e6db74">8080</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">http.nonProxyHosts</span><span style="color:#f92672">=</span><span style="color:#e6db74">localhost|127.*|[::1]</span>
</span></span></code></pre></div><h4 id="maven">Maven</h4>
<p>This was the hardest to figure out. And it&rsquo;s crazy (coming from a newbie perspective) that maven doesn&rsquo;t make it easy to just reuse Java or System proxies or respect the <code>http_proxy</code> variable. Madness. Moreover, you <em>need</em> to create the configuration file at <code>~/.m2/settings.xml</code> with the following contents:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-xml" data-lang="xml"><span style="display:flex;"><span><span style="color:#f92672">&lt;settings&gt;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">&lt;proxies&gt;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&lt;proxy&gt;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&lt;id&gt;</span>httpproxy<span style="color:#f92672">&lt;/id&gt;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&lt;active&gt;</span>true<span style="color:#f92672">&lt;/active&gt;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&lt;protocol&gt;</span>http<span style="color:#f92672">&lt;/protocol&gt;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&lt;host&gt;</span>proxy-addr.company.com<span style="color:#f92672">&lt;/host&gt;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&lt;port&gt;</span>8080<span style="color:#f92672">&lt;/port&gt;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&lt;nonProxyHosts&gt;</span>local.net|some.host.com<span style="color:#f92672">&lt;/nonProxyHosts&gt;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&lt;/proxy&gt;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&lt;proxy&gt;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&lt;id&gt;</span>httpsproxy<span style="color:#f92672">&lt;/id&gt;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&lt;active&gt;</span>true<span style="color:#f92672">&lt;/active&gt;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&lt;protocol&gt;</span>https<span style="color:#f92672">&lt;/protocol&gt;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&lt;host&gt;</span>proxy-addr.company.com<span style="color:#f92672">&lt;/host&gt;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&lt;port&gt;</span>8080<span style="color:#f92672">&lt;/port&gt;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&lt;nonProxyHosts&gt;</span>local.net|some.host.com<span style="color:#f92672">&lt;/nonProxyHosts&gt;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&lt;/proxy&gt;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">&lt;/proxies&gt;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">&lt;/settings&gt;</span>
</span></span></code></pre></div><h4 id="clojure">Clojure</h4>
<p><em>make sure <code>rlwrap</code> is installed (<code>sudo apt install rlwrap</code>)</em></p>
<p>Download and install clojure using the following commands:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>$ curl -O https://download.clojure.org/install/linux-install-1.10.1.469.sh  <span style="color:#75715e"># This is the current version as of writing</span>
</span></span><span style="display:flex;"><span>$ chmod +x linux-install-1.10.1.469.sh
</span></span><span style="display:flex;"><span>$ sudo ./linux-install-1.10.1.469.sh
</span></span></code></pre></div><p>Using the command <code>clj</code> launches the repl. Thankfully!</p>
<h4 id="leiningen">Leiningen</h4>
<p>Follow the steps on <a href="https://leiningen.org/">https://leiningen.org/</a></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>curl -O &#34;https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein&#34;
</span></span><span style="display:flex;"><span>chmod a+x lein
</span></span><span style="display:flex;"><span>mv lein ~/bin/
</span></span></code></pre></div><h3 id="create-a-test-project">Create a Test Project</h3>
<p>To test <code>lein</code> and <code>figwheel</code>+<code>reagent</code>:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>$ lein new figwheel some-name -- --reagent
</span></span></code></pre></div>]]></content:encoded></item><item><title>Evolutionary Architecture</title><link>https://sysarcher.github.io/posts/evolutionary-architecture/</link><pubDate>Sun, 22 Sep 2019 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/evolutionary-architecture/</guid><description>&lt;p&gt;Evolvability of Architectural Styles&amp;hellip;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Big ball of mud&lt;/li&gt;
&lt;li&gt;Monoliths&lt;/li&gt;
&lt;li&gt;Event-driven architectures&lt;/li&gt;
&lt;li&gt;Service-oriented architectures (SOA)&lt;/li&gt;
&lt;li&gt;Serverless&lt;/li&gt;
&lt;/ul&gt;</description><content:encoded><![CDATA[<p>Evolvability of Architectural Styles&hellip;</p>
<ul>
<li>Big ball of mud</li>
<li>Monoliths</li>
<li>Event-driven architectures</li>
<li>Service-oriented architectures (SOA)</li>
<li>Serverless</li>
</ul>
]]></content:encoded></item><item><title>Benchmarking DPDK</title><link>https://sysarcher.github.io/posts/dpdk-benchmarking/</link><pubDate>Mon, 08 Jul 2019 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/dpdk-benchmarking/</guid><description>&lt;p&gt;&lt;em&gt;My reference: &lt;a href="https://software.intel.com/en-us/articles/set-up-open-vswitch-with-dpdk-on-ubuntu-server"&gt;https://software.intel.com/en-us/articles/set-up-open-vswitch-with-dpdk-on-ubuntu-server&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;So I got to play with the Data Plane Development Kit (DPDK) from Intel recently. I planned on replicating the PVP benchmark for my use-case. I set up the following environment:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Ubuntu 18.04 (bionic) host with:
&lt;ul&gt;
&lt;li&gt;KVM&lt;/li&gt;
&lt;li&gt;QEMU&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Debian 10 guest images downloaded from: &lt;a href="https://cdimage.debian.org/cdimage/openstack/current/"&gt;https://cdimage.debian.org/cdimage/openstack/current/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A useful tool is &lt;code&gt;numactl&lt;/code&gt; (use &lt;code&gt;apt&lt;/code&gt; to install it). On my non-server system, I don&amp;rsquo;t have multiple socks and multiple cores per sock etc.&lt;/p&gt;</description><content:encoded><![CDATA[<p><em>My reference: <a href="https://software.intel.com/en-us/articles/set-up-open-vswitch-with-dpdk-on-ubuntu-server">https://software.intel.com/en-us/articles/set-up-open-vswitch-with-dpdk-on-ubuntu-server</a></em></p>
<p>So I got to play with the Data Plane Development Kit (DPDK) from Intel recently. I planned on replicating the PVP benchmark for my use-case. I set up the following environment:</p>
<ul>
<li>Ubuntu 18.04 (bionic) host with:
<ul>
<li>KVM</li>
<li>QEMU</li>
</ul>
</li>
<li>Debian 10 guest images downloaded from: <a href="https://cdimage.debian.org/cdimage/openstack/current/">https://cdimage.debian.org/cdimage/openstack/current/</a></li>
</ul>
<p>A useful tool is <code>numactl</code> (use <code>apt</code> to install it). On my non-server system, I don&rsquo;t have multiple socks and multiple cores per sock etc.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>root@machine:~# numactl  -s
</span></span><span style="display:flex;"><span>policy: default
</span></span><span style="display:flex;"><span>preferred node: current
</span></span><span style="display:flex;"><span>physcpubind: 2 3 4 5 6 7 
</span></span><span style="display:flex;"><span>cpubind: 0 
</span></span><span style="display:flex;"><span>nodebind: 0 
</span></span><span style="display:flex;"><span>membind: 0 
</span></span></code></pre></div><h2 id="setting-up-ovsdpdk">Setting up (OVS+DPDK)</h2>
<p>First of all set install OVS-dpdk using <code>apt</code></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sudo apt-get install openvswitch-switch-dpdk 
</span></span><span style="display:flex;"><span>sudo update-alternatives --set ovs-vswitchd /usr/lib/openvswitch-switch-dpdk/ovs-vswitchd-dpdk
</span></span></code></pre></div><p>Restart the systemd service: <code>sudo systemctl restart openvswitch-switch.service</code></p>
<p>Hugepages will need to be set up. But we need to tell DPDK about that.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>root@machine:~# cat /etc/dpdk/dpdk.conf
</span></span><span style="display:flex;"><span>   ...
</span></span><span style="display:flex;"><span>NR_1G_PAGES=4
</span></span><span style="display:flex;"><span>   ...
</span></span></code></pre></div><h3 id="isolate-some-cpus">Isolate some CPUs</h3>
<p>Edit the value of <code>GRUB_CMDLINE_LINUX_DEFAULT</code> to:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-ini" data-lang="ini"><span style="display:flex;"><span><span style="color:#a6e22e">GRUB_CMDLINE_LINUX_DEFAULT</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;default_hugepagesz=1G hugepagesz=1G hugepages=4 hugepagesz=2M hugepages=2048 iommu=pt intel_iommu=on isolcpus=0,1&#34;</span>
</span></span></code></pre></div><p>And run <code>sudo update-grub</code>.</p>
<p><em>this setting will not need to change afterwards. A reboot of the machine is required. See if the parameters got passed correctly by doing <code>cat /proc/cmdline</code></em></p>
<h3 id="set-up-hugepages">Set up Hugepages</h3>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sudo mkdir -p /mnt/huge
</span></span><span style="display:flex;"><span>sudo mkdir -p /mnt/huge_2mb
</span></span><span style="display:flex;"><span>sudo mount -t hugetlbfs none /mnt/huge
</span></span><span style="display:flex;"><span>sudo mount -t hugetlbfs none /mnt/huge_2mb -o pagesize<span style="color:#f92672">=</span>2MB
</span></span><span style="display:flex;"><span>sudo mount -t hugetlbfs none /dev/hugepages
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>root@machine:~# grep HugePages_ /proc/meminfo 
</span></span><span style="display:flex;"><span>HugePages_Total:       4
</span></span><span style="display:flex;"><span>HugePages_Free:        1
</span></span><span style="display:flex;"><span>HugePages_Rsvd:        0
</span></span><span style="display:flex;"><span>HugePages_Surp:        0
</span></span></code></pre></div><h2 id="configure-ovs-dpdk">Configure OVS-DPDK</h2>
<p>The database needs to be set up only once (<code>sudo ovs-vsctl --no-wait init</code>)</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sudo ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-lcore-mask<span style="color:#f92672">=</span>0x03  <span style="color:#75715e"># hopefully: cores, 0,1 </span>
</span></span><span style="display:flex;"><span>sudo ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-socket-mem<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;1024&#34;</span>
</span></span><span style="display:flex;"><span>sudo ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask<span style="color:#f92672">=</span>0x0C <span style="color:#75715e"># we have just one NUMA node</span>
</span></span></code></pre></div><h3 id="create-ovs-dpdk-bridge-and-ports">Create OVS-DPDK Bridge and Ports</h3>
<p><code>dpdkvhostuser</code> is a predefined type. <code>vhost-user</code> is understood by Qemu 2.2 and above.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sudo ovs-vsctl add-br br0 -- set bridge br0 datapath_type<span style="color:#f92672">=</span>netdev
</span></span><span style="display:flex;"><span>sudo ovs-vsctl add-port br0 vhost-user1 -- set Interface vhost-user1 type<span style="color:#f92672">=</span>dpdkvhostuser
</span></span><span style="display:flex;"><span>sudo ovs-vsctl add-port br0 vhost-user2 -- set Interface vhost-user2 type<span style="color:#f92672">=</span>dpdkvhostuser
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>root@machine:~# ovs-vsctl show
</span></span><span style="display:flex;"><span>c3459670-39b8-43f7-bc57-569672ed79c6
</span></span><span style="display:flex;"><span>    Bridge &#34;br0&#34;
</span></span><span style="display:flex;"><span>        Port &#34;br0&#34;
</span></span><span style="display:flex;"><span>            Interface &#34;br0&#34;
</span></span><span style="display:flex;"><span>                type: internal
</span></span><span style="display:flex;"><span>        Port &#34;vhost-user2&#34;
</span></span><span style="display:flex;"><span>            Interface &#34;vhost-user2&#34;
</span></span><span style="display:flex;"><span>                type: dpdkvhostuser
</span></span><span style="display:flex;"><span>        Port &#34;vhost-user1&#34;
</span></span><span style="display:flex;"><span>            Interface &#34;vhost-user1&#34;
</span></span><span style="display:flex;"><span>                type: dpdkvhostuser
</span></span><span style="display:flex;"><span>    ovs_version: &#34;2.9.2&#34;
</span></span></code></pre></div><h3 id="binding-devices-to-dpdk">Binding Devices to DPDK</h3>
<p><em>We should check <a href="https://core.dpdk.org/supported/">whether the NIC is compatible</a> with DPDK first. The <a href="https://core.dpdk.org/supported/">list</a> on DPDK doesn&rsquo;t seem to have been updated e.g. the <a href="https://doc.dpdk.org/guides-18.11/nics/igb.html?highlight=i210#supported-chipsets-and-nics">documentation itself for newer versions</a> states that the I210 is supported.</em></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sudo modprobe vfio-pci
</span></span><span style="display:flex;"><span>sudo dpdk-devbind --bind<span style="color:#f92672">=</span>vfio-pci eno1 <span style="color:#75715e"># eno1 is the interface I want to bind to DPDK</span>
</span></span></code></pre></div><p><code>dpdk-devbind --status</code> can be used to check whether the NIC is now using the DPDK compatible driver.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>root@machine:~# dpdk-devbind --status
</span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span>Network devices using DPDK-compatible driver
</span></span><span style="display:flex;"><span>============================================
</span></span><span style="display:flex;"><span>0000:00:19.0 &#39;Ethernet Connection I217-V 153b&#39; drv=vfio-pci unused=e1000e
</span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span>Network devices using kernel driver
</span></span><span style="display:flex;"><span>===================================
</span></span><span style="display:flex;"><span>0000:02:00.0 &#39;Killer E220x Gigabit Ethernet Controller e091&#39; if=enp2s0 drv=alx unused=vfio-pci *Active*
</span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span>    ...
</span></span></code></pre></div><h2 id="vms-quick-start">VMs Quick Start</h2>
<p><a href="https://cdimage.debian.org/cdimage/openstack/current/debian-10.0.1-20190708-openstack-amd64.qcow2">Download Debian 10 (buster)</a> and change the password for <code>root</code> using <code>guestfish</code>. (Debian was an arbitrary choice here.)</p>
<p>Add anything to the images at this point. I downloaded <code>qperf</code> with all it&rsquo;s dependencies and added it:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>PACKAGES<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;qperf iperf&#34;</span>
</span></span><span style="display:flex;"><span>apt-get download <span style="color:#66d9ef">$(</span>apt-cache depends --recurse --no-recommends --no-suggests <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span>  --no-conflicts --no-breaks --no-replaces --no-enhances <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span>  --no-pre-depends <span style="color:#e6db74">${</span>PACKAGES<span style="color:#e6db74">}</span> | grep <span style="color:#e6db74">&#34;^\w&#34;</span><span style="color:#66d9ef">)</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>virt-copy-in -a ./debian-10.0.0-openstack-amd64-2.qcow2  *.deb  /home/
</span></span></code></pre></div><p><code>openssl passwd -1 &lt;password&gt;</code> can be used to generate a password entry, and this can be added to the guest image using:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>guestfish --rw --add ../debian-10.0.0-openstack-amd64.qcow2 --mount /dev/sda1:/ vi /etc/shadow
</span></span></code></pre></div><p>And make 2 copies of the <code>debian-10.0.1-20190708-openstack-amd64.qcow2</code> file. We&rsquo;ll use it as our hard drives for guests.</p>
<h4 id="some-resources-to-read">Some resources to read</h4>
<ul>
<li>File-sharing: <code>https://www.linux-kvm.org/page/9p_virtio</code></li>
<li>OVS+KVM: <code>https://docs.paloaltonetworks.com/vm-series/8-1/vm-series-deployment/set-up-the-vm-series-firewall-on-kvm/performance-tuning-of-the-vm-series-for-kvm/enable-open-vswitch-on-kvm.html#</code></li>
<li>Using <code>testpmd</code> to test DPDK Performance: <code>https://software.intel.com/en-us/articles/testing-dpdk-performance-and-features-with-testpmd</code></li>
<li>Vhost/Virtio in DPDK: <code>https://software.intel.com/en-us/articles/configuration-and-performance-of-vhost-virtio-in-data-plane-development-kit-dpdk</code></li>
</ul>
<h3 id="launching-the-guests">Launching the Guests</h3>
<p>I launched the guests in two separate terminal windows (i.e., copy-paste instead of executing).</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>root@machine:~# cat ./launch-os.sh 
</span></span><span style="display:flex;"><span># Launch OS1
</span></span><span style="display:flex;"><span>qemu-system-x86_64 -m 1024 -smp 4 -cpu host -hda ./debian-10.0.0-openstack-amd64.qcow2 -boot c -enable-kvm -no-reboot -net none -nographic -chardev socket,id=char1,path=/run/openvswitch/vhost-user1 -netdev type=vhost-user,id=mynet1,chardev=char1,vhostforce -device virtio-net-pci,mac=00:00:00:00:00:01,netdev=mynet1 -object memory-backend-file,id=mem,size=1G,mem-path=/dev/hugepages,share=on -numa node,memdev=mem -mem-prealloc
</span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span># Launch OS2
</span></span><span style="display:flex;"><span>qemu-system-x86_64 -m 1024 -smp 4 -cpu host -hda ./debian-10.0.0-openstack-amd64-2.qcow2 -boot c -enable-kvm -no-reboot -net none -nographic -chardev socket,id=char2,path=/run/openvswitch/vhost-user2 -netdev type=vhost-user,id=mynet2,chardev=char2,vhostforce -device virtio-net-pci,mac=00:00:00:00:00:02,netdev=mynet2 -object memory-backend-file,id=mem,size=1G,mem-path=/dev/hugepages,share=on -numa node,memdev=mem -mem-prealloc -fsdev local,security_model=passthrough,id=fsdev0,path=/tmp/share -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare
</span></span></code></pre></div><p>Godspeed!</p>
]]></content:encoded></item><item><title>Kata annotations</title><link>https://sysarcher.github.io/posts/kata-annotations/</link><pubDate>Tue, 11 Jun 2019 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/kata-annotations/</guid><description>&lt;p&gt;&lt;em&gt;Annotations are a great feature in Kubernetes and a means for communicating to kata some options. &lt;a href="https://github.com/kata-containers/documentation/issues/486"&gt;They are being documented as of the time of this writing&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Using annotations, you can:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Customize the Kernel that is used (see &lt;code&gt;KernelPath&lt;/code&gt; example below)&lt;/li&gt;
&lt;li&gt;Change the guest image (&lt;code&gt;ImagePath&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Hypervisor (&lt;code&gt;HypervisorPath&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Firmware (&lt;code&gt;FirmwarePath&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;etc. etc. (All of the annotations are listed in &lt;a href="https://github.com/kata-containers/runtime/blob/master/virtcontainers/pkg/annotations/annotations.go"&gt;&lt;code&gt;annotations.go&lt;/code&gt;&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="using-a-custom-kernel"&gt;Using a Custom Kernel&lt;/h3&gt;
&lt;p&gt;Here is the &lt;code&gt;yaml&lt;/code&gt; file I used to apply a custom kernel:&lt;/p&gt;</description><content:encoded><![CDATA[<p><em>Annotations are a great feature in Kubernetes and a means for communicating to kata some options. <a href="https://github.com/kata-containers/documentation/issues/486">They are being documented as of the time of this writing</a></em></p>
<p>Using annotations, you can:</p>
<ul>
<li>Customize the Kernel that is used (see <code>KernelPath</code> example below)</li>
<li>Change the guest image (<code>ImagePath</code>)</li>
<li>Hypervisor (<code>HypervisorPath</code>)</li>
<li>Firmware (<code>FirmwarePath</code>)</li>
<li>etc. etc. (All of the annotations are listed in <a href="https://github.com/kata-containers/runtime/blob/master/virtcontainers/pkg/annotations/annotations.go"><code>annotations.go</code></a>)</li>
</ul>
<h3 id="using-a-custom-kernel">Using a Custom Kernel</h3>
<p>Here is the <code>yaml</code> file I used to apply a custom kernel:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">apiVersion</span>: <span style="color:#ae81ff">v1</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">kind</span>: <span style="color:#ae81ff">Pod</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">metadata</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">annotations</span>:
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">com.github.containers.virtcontainers.KernelPath</span>: <span style="color:#e6db74">&#34;/usr/share/kata-containers/vmlinuz-4.19.31-40&#34;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">name</span>: <span style="color:#ae81ff">kata-example</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">spec</span>:
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">runtimeClassName</span>: <span style="color:#ae81ff">kata-qemu</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">containers</span>:
</span></span><span style="display:flex;"><span>  - <span style="color:#f92672">name</span>: <span style="color:#ae81ff">nginx-container</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">image</span>: <span style="color:#ae81ff">nginx</span>
</span></span></code></pre></div><p>The <code>metadata</code> key contains the <code>annotations</code> map. All of the annotations are listed in <a href="https://github.com/kata-containers/runtime/blob/master/virtcontainers/pkg/annotations/annotations.go"><code>annotations.go</code></a> on the main repo.</p>
]]></content:encoded></item><item><title>Kata and Kubernetes</title><link>https://sysarcher.github.io/posts/kata-k8s/</link><pubDate>Sun, 19 May 2019 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/kata-k8s/</guid><description>&lt;h3 id="setting-up-kata-using-docker"&gt;Setting up Kata using Docker&lt;/h3&gt;
&lt;p&gt;This is documented here: &lt;a href="https://github.com/kata-containers/packaging/blob/master/kata-deploy/README.md#docker-quick-start"&gt;https://github.com/kata-containers/packaging/blob/master/kata-deploy/README.md#docker-quick-start&lt;/a&gt;&lt;/p&gt;
&lt;h3 id="using-minikube-and-kata"&gt;Using Minikube and Kata&lt;/h3&gt;
&lt;p&gt;&lt;a href="https://github.com/kata-containers/documentation/pull/445#"&gt;This PR&lt;/a&gt; is adding the documentation to get started with &lt;code&gt;minikube&lt;/code&gt;: &lt;a href="https://github.com/kata-containers/documentation/pull/445#"&gt;https://github.com/kata-containers/documentation/pull/445#&lt;/a&gt;&lt;/p&gt;
&lt;h3 id="using-kubeadm"&gt;Using &lt;code&gt;kubeadm&lt;/code&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;First, set up a Kubernetes cluster using &lt;code&gt;kubeadm&lt;/code&gt;: &lt;a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/"&gt;https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;then, &lt;a href="https://github.com/kata-containers/packaging/blob/master/kata-deploy/README.md#kubernetes-quick-start"&gt;https://github.com/kata-containers/packaging/blob/master/kata-deploy/README.md#kubernetes-quick-start&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="conclusion"&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Using the new &lt;code&gt;kata-deploy&lt;/code&gt; method, it is very easy to set up a Kubernetes cluster that uses Kata Containers.&lt;/p&gt;</description><content:encoded><![CDATA[<h3 id="setting-up-kata-using-docker">Setting up Kata using Docker</h3>
<p>This is documented here: <a href="https://github.com/kata-containers/packaging/blob/master/kata-deploy/README.md#docker-quick-start">https://github.com/kata-containers/packaging/blob/master/kata-deploy/README.md#docker-quick-start</a></p>
<h3 id="using-minikube-and-kata">Using Minikube and Kata</h3>
<p><a href="https://github.com/kata-containers/documentation/pull/445#">This PR</a> is adding the documentation to get started with <code>minikube</code>: <a href="https://github.com/kata-containers/documentation/pull/445#">https://github.com/kata-containers/documentation/pull/445#</a></p>
<h3 id="using-kubeadm">Using <code>kubeadm</code></h3>
<ul>
<li>First, set up a Kubernetes cluster using <code>kubeadm</code>: <a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/">https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/</a></li>
<li>then, <a href="https://github.com/kata-containers/packaging/blob/master/kata-deploy/README.md#kubernetes-quick-start">https://github.com/kata-containers/packaging/blob/master/kata-deploy/README.md#kubernetes-quick-start</a></li>
</ul>
<h3 id="conclusion">Conclusion</h3>
<p>Using the new <code>kata-deploy</code> method, it is very easy to set up a Kubernetes cluster that uses Kata Containers.</p>
]]></content:encoded></item><item><title>Taking Kata Steps</title><link>https://sysarcher.github.io/posts/kata-steps/</link><pubDate>Sun, 28 Apr 2019 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/kata-steps/</guid><description>&lt;p&gt;So I thought that it might be a great idea to run an RT kernel inside Kata containers. This is a usecase because I soon hope to see Kata containers running on real-time capable hypervisors and also being used in scenarios where real-time is a thing. Soon!&lt;/p&gt;
&lt;p&gt;For now, let&amp;rsquo;s look at how I went about doing what I did..&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;You need to &lt;code&gt;go get github.com/kata-containers/packaging&lt;/code&gt; repository. (or, git clone if you so prefer.) Be sure to have your &lt;code&gt;$GOPATH&lt;/code&gt; properly set!!&lt;/li&gt;
&lt;li&gt;cd into &lt;code&gt;packaging/kernel&lt;/code&gt; directory.&lt;/li&gt;
&lt;li&gt;I chose the &lt;code&gt;4.19.31&lt;/code&gt; version of the kernel. Primarily because it was a newer kernel (not too different from the kernel version that comes with the current kata release.) and because it had the &lt;a href="https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.19/patch-4.19.31-rt18.patch.xz"&gt;RT patches available&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;I changed &lt;a href="https://github.com/kata-containers/packaging/blob/dce0558ec6d8329e81fa59c809351170f6741a7a/kernel/build-kernel.sh#L25"&gt;the &lt;code&gt;kernel_version=&amp;quot;&amp;quot;&lt;/code&gt; line&lt;/a&gt; to &lt;code&gt;kernel_version=&amp;quot;4.19.31&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;That&amp;rsquo;s it. We are ready to (1) apply the necessary patches from Kata maintainers to our Kernel of choosing and (2) apply the RT patches:&lt;/p&gt;</description><content:encoded><![CDATA[<p>So I thought that it might be a great idea to run an RT kernel inside Kata containers. This is a usecase because I soon hope to see Kata containers running on real-time capable hypervisors and also being used in scenarios where real-time is a thing. Soon!</p>
<p>For now, let&rsquo;s look at how I went about doing what I did..</p>
<ol>
<li>You need to <code>go get github.com/kata-containers/packaging</code> repository. (or, git clone if you so prefer.) Be sure to have your <code>$GOPATH</code> properly set!!</li>
<li>cd into <code>packaging/kernel</code> directory.</li>
<li>I chose the <code>4.19.31</code> version of the kernel. Primarily because it was a newer kernel (not too different from the kernel version that comes with the current kata release.) and because it had the <a href="https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.19/patch-4.19.31-rt18.patch.xz">RT patches available</a></li>
<li>I changed <a href="https://github.com/kata-containers/packaging/blob/dce0558ec6d8329e81fa59c809351170f6741a7a/kernel/build-kernel.sh#L25">the <code>kernel_version=&quot;&quot;</code> line</a> to <code>kernel_version=&quot;4.19.31&quot;</code></li>
</ol>
<p>That&rsquo;s it. We are ready to (1) apply the necessary patches from Kata maintainers to our Kernel of choosing and (2) apply the RT patches:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># download and apply the kata patches to the kernel</span>
</span></span><span style="display:flex;"><span>./build-kernel.sh setup
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>cd kata-linux-4.19.31-36
</span></span><span style="display:flex;"><span>patch -p1&lt;../path-to-extracted-patch/patch-4.19.31-rt18.patch
</span></span></code></pre></div><p>Wait&hellip; we need to first, <code>make menuconfig</code> and enable <code>RT</code> capabilities</p>
<pre tabindex="0"><code>General Setup 
  --&gt; Preemption Model
    --&gt; Fully Preemptible Kernel (RT)
</code></pre><p>Now, we&rsquo;re ready to build the Kernel and install it*:</p>
<pre tabindex="0"><code>./build-kernel.sh setup
sudo ./build-kernel.sh install
</code></pre><h3 id="drum-roll-please">Drum Roll please</h3>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>$ docker run -it --runtime kata-runtime ubuntu bash
</span></span><span style="display:flex;"><span>root@77cf04fd8290:/# uname -r
</span></span><span style="display:flex;"><span>4.19.31-rt18
</span></span><span style="display:flex;"><span>root@77cf04fd8290:/# uname -a
</span></span><span style="display:flex;"><span>Linux 77cf04fd8290 4.19.31-rt18 #2 SMP PREEMPT RT Mon Apr 29 09:06:08 CEST 2019 x86_64 x86_64 x86_64 GNU/Linux
</span></span><span style="display:flex;"><span>root@77cf04fd8290:/# 
</span></span></code></pre></div><p>So proud!!!</p>
<p>Happy Building!!</p>
<h3 id="note-on-kernel-files">Note on Kernel Files</h3>
<p><code>vmlinux</code>: uncompressed kernel. |
<code>vmlinuz</code>: compressed kernel. |
<code>bzImage</code>: located under <code>arch/x86_64/boot/bzImage</code>. Big Zimage. Compressed kernel image.</p>
<p>More info: <a href="https://stackoverflow.com/a/22338835/3760442">https://stackoverflow.com/a/22338835/3760442</a></p>
<h3 id="acknowledgements">Acknowledgements</h3>
<p>Special thanks to @egernst, @rico and the great team on Slack!! Though this was my first foray into Kata Containers, I must say the folks were very welcoming. Thank you all!!</p>
<p><em>* I built the kernel (as of the time of writing) using <code>make build -j4</code> instead of using the <code>build-kernel.sh</code> script but it shouldn&rsquo;t matter. Just FYI.</em></p>
]]></content:encoded></item><item><title>First Steps With OpenStack</title><link>https://sysarcher.github.io/posts/openstack-deployment/</link><pubDate>Fri, 26 Apr 2019 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/openstack-deployment/</guid><description>&lt;p&gt;I recently tried to set up OpenStack on a single-node development environment using devstack. This blog is &lt;em&gt;not&lt;/em&gt; meant as a tutorial or getting started guide. However, I hope that Google will send someone crying tears of sorrow this way so he can benefit from my experience.&lt;/p&gt;
&lt;h3 id="conclusion"&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;What I concluded from the documentations is that we don&amp;rsquo;t get something ready-to-go from the official docs. And you should consider yourself lucky if everything worked for you out-of-the-box.&lt;/p&gt;</description><content:encoded><![CDATA[<p>I recently tried to set up OpenStack on a single-node development environment using devstack. This blog is <em>not</em> meant as a tutorial or getting started guide. However, I hope that Google will send someone crying tears of sorrow this way so he can benefit from my experience.</p>
<h3 id="conclusion">Conclusion</h3>
<p>What I concluded from the documentations is that we don&rsquo;t get something ready-to-go from the official docs. And you should consider yourself lucky if everything worked for you out-of-the-box.</p>
<h2 id="setup-ideas">Setup Ideas</h2>
<ul>
<li>Start from a clean installation of Ubuntu 18.04.</li>
<li>The <code>local.conf</code> goes into the top-level directory of the <code>devstack</code> checkout.</li>
</ul>
<h3 id="setup">Setup</h3>
<p>My setup already provided the DNS and DHCP servers as illustrated below.</p>
<pre tabindex="0"><code>        (DNS Server)              (DHCP Server)
             |                          |
             |                          |
             +------------+-------------+
                          |
                          |
                        (OpenStack)
</code></pre><p>So, my <code>local.conf</code> looks like the following:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-ini" data-lang="ini"><span style="display:flex;"><span><span style="color:#66d9ef">[[local|localrc]]</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">ADMIN_PASSWORD</span><span style="color:#f92672">=</span><span style="color:#e6db74">safeandsecure</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">DATABASE_PASSWORD</span><span style="color:#f92672">=</span><span style="color:#e6db74">$ADMIN_PASSWORD</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">RABBIT_PASSWORD</span><span style="color:#f92672">=</span><span style="color:#e6db74">$ADMIN_PASSWORD</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">SERVICE_PASSWORD</span><span style="color:#f92672">=</span><span style="color:#e6db74">$ADMIN_PASSWORD</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">HOST_IP</span><span style="color:#f92672">=</span><span style="color:#e6db74">&lt;HOST_IP&gt;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">FLOATING_RANGE</span><span style="color:#f92672">=</span><span style="color:#e6db74">&lt;HOST_IP&gt;/24</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">Q_FLOATING_ALLOCATION_POOL</span><span style="color:#f92672">=</span><span style="color:#e6db74">start=&lt;HOST_IP&gt;.150,end=&lt;HOST_IP&gt;.200</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">FIXED_RANGE</span><span style="color:#f92672">=</span><span style="color:#e6db74">10.11.12.0/24</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">FIXED_NETWORK_SIZE</span><span style="color:#f92672">=</span><span style="color:#e6db74">256</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">PUBLIC_INTERFACE</span><span style="color:#f92672">=</span><span style="color:#e6db74">eno1</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">PUBLIC_NETWORK_GATEWAY</span><span style="color:#f92672">=</span><span style="color:#e6db74">&lt;HOST_IP&gt;.1</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">LOGFILE</span><span style="color:#f92672">=</span><span style="color:#e6db74">$DEST/logs/stack.sh.log</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">LOGDAYS</span><span style="color:#f92672">=</span><span style="color:#e6db74">2</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">SWIFT_HASH</span><span style="color:#f92672">=</span><span style="color:#e6db74">66a3d6b56c1f479c8b4e70ab5c2000f5</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">SWIFT_REPLICAS</span><span style="color:#f92672">=</span><span style="color:#e6db74">1</span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">SWIFT_DATA_DIR</span><span style="color:#f92672">=</span><span style="color:#e6db74">$DEST/data</span>
</span></span></code></pre></div><p>(The <code>&lt;HOST_IP&gt;.XXX</code> numbers are obviously replacing the last part of the IP address.)</p>
<p>What I&rsquo;m telling OpenStack is that I &hellip;</p>
<ul>
<li>already have a Gateway in the network, use it!</li>
<li>Already know what the IP allocation pool looks like</li>
</ul>
<h3 id="next">Next</h3>
<p>With that, hopefully you can go do OpenStack stuff and not have to worry about networking being the biggest issue in your life. Good luck!!!</p>
]]></content:encoded></item><item><title>Functional Programming</title><link>https://sysarcher.github.io/posts/functional-programming/</link><pubDate>Wed, 23 Jan 2019 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/functional-programming/</guid><description>&lt;p&gt;So I was just reading about Functinal programming and this is a summary of what I understand about it as of today.. (might change in the future; to err after all, is human.)&lt;/p&gt;
&lt;h2 id="benefits"&gt;Benefits&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The &amp;ldquo;environment&amp;rdquo; you&amp;rsquo;re programming against are the function arguments&lt;/li&gt;
&lt;li&gt;Reuse is imminent. Composition is what everyone calls it.&lt;/li&gt;
&lt;li&gt;Functions&amp;rsquo; results can be cached (memoization)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There must be many more benefits.. These three are the ones I can think of and the ones that get the most marks from my side.&lt;/p&gt;</description><content:encoded><![CDATA[<p>So I was just reading about Functinal programming and this is a summary of what I understand about it as of today.. (might change in the future; to err after all, is human.)</p>
<h2 id="benefits">Benefits</h2>
<ul>
<li>The &ldquo;environment&rdquo; you&rsquo;re programming against are the function arguments</li>
<li>Reuse is imminent. Composition is what everyone calls it.</li>
<li>Functions&rsquo; results can be cached (memoization)</li>
</ul>
<p>There must be many more benefits.. These three are the ones I can think of and the ones that get the most marks from my side.</p>
<h2 id="main-concepts">Main Concepts</h2>
<p>Functional programming is a technique that depends on the programmer adhering to some principles (it helps if the programming language forces him as well):</p>
<h3 id="purity">Purity</h3>
<p>A pure function has no side effects i.e. it depends only on its arguments.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-clj" data-lang="clj"><span style="display:flex;"><span>(<span style="color:#66d9ef">defn </span>pure-function [input]
</span></span><span style="display:flex;"><span>  (<span style="color:#66d9ef">if </span>input output-1 output-2))
</span></span></code></pre></div><p>In this example, if the <code>pure-function</code> is really pure, then depending on the input, the return value always remains the same. This <em>also</em> means that the <code>output-1</code> and <code>output-2</code> data are <em>immutable</em> i.e. they&rsquo;re unchangable!</p>
<h3 id="referential-transparency">Referential Transparency</h3>
<p>In the example above, we might just have replaced the output of <code>pure-funtion</code> with either <code>output-1</code> or <code>output-2</code> thus avoiding the call to a function. Many languages can optimize this behavior by caching the result. It&rsquo;s called <em>memoization.</em> This also means that you could parallelize stuff i.e. functions can be independently evaluated on different machines/cores/nodes whatevers.</p>
<h3 id="persistence">Persistence</h3>
<p>Immutability is key. You never mutate. An operation on data doesn&rsquo;t change the data, it just returns new data. This naive approach is memory hungry I suppose but platforms and languages find ways to optimize stuff.</p>
<h3 id="laziness">Laziness</h3>
<p>Since I&rsquo;m learning Clojure, there might be a bias because <code>seq</code> are everywhere and they&rsquo;re laaaaaaaaaaazy! That is, you only evaluate stuff when it&rsquo;s required and never before. This enables infinite length sequences. Also, we pay for operations only when required.</p>
<h2 id="conclusion">Conclusion</h2>
<p>I&rsquo;m still a Functional Programming newbie but Clojure is opening my eyes! I am intrigued.</p>
<p>Fin!</p>
]]></content:encoded></item><item><title>SWPC Trip Report</title><link>https://sysarcher.github.io/posts/swpc-trip-report/</link><pubDate>Fri, 30 Nov 2018 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/swpc-trip-report/</guid><description>&lt;p&gt;My company has frequent internal &amp;ldquo;Software Professionals Conferences (SWPC)&amp;rdquo;. I was honored to be a part of the conference yesterday in Munich where I presented a lightning talk and did a demo.&lt;/p&gt;
&lt;h3 id="lightning-talk"&gt;Lightning Talk&lt;/h3&gt;
&lt;p&gt;I did a lightning talk around Event Driven Microservices. Event driven architectures are becoming fairly common these days and IoT is a natural and easily understandable use-case. I presented the architecture we developed but without going into too much detail.&lt;/p&gt;</description><content:encoded><![CDATA[<p>My company has frequent internal &ldquo;Software Professionals Conferences (SWPC)&rdquo;. I was honored to be a part of the conference yesterday in Munich where I presented a lightning talk and did a demo.</p>
<h3 id="lightning-talk">Lightning Talk</h3>
<p>I did a lightning talk around Event Driven Microservices. Event driven architectures are becoming fairly common these days and IoT is a natural and easily understandable use-case. I presented the architecture we developed but without going into too much detail.</p>
<p>One question I had some trouble answering was around the &ldquo;infinite-length&rdquo; event streams. What if the queues get filled up.. How do we save state? The answers to these questions is it depends most of the time but usually you don&rsquo;t run out of space at all :). And I refer to Martin Fowler for these questions.</p>
<h3 id="demo">Demo</h3>
<p>I did an &ldquo;Fearless Systems Programming with Rust&rdquo; tutorial/demo as well. It was all going well&hellip; I presented a PowerPoint slide deck with some introductory stuff. And then &ldquo;let me switch to a REAL OPERATING SYSTEM&rdquo; said I. And I realized that I had a 13&quot; Dell XPS. D&rsquo;oh!! It only had a Thunderbolt connection and it wouldn&rsquo;t be able to connect to the projector.</p>
<p>Then, I braved up.. Went unprepared into my Lab machine somewhere else and starting setting up a new project that did my <code>container-demo</code> style version of containers in Rust. Basically, going through the basics of containers/docker and writing those in Rust. (Thanks again Liz!)</p>
<p>Because I was now doing live coding without a prepared machine over ssh across Germany (lag and all ..), the demo didn&rsquo;t go too smooth! But in the end I was proud that we did get the final product right and in the process we <em>did</em> (literally) demonstrate the power of the Rust compiler, and the Cargo toolchain.</p>
<h3 id="conclusions">Conclusions</h3>
<ul>
<li>Take all the adapters with you.</li>
<li>Lightning talks <em>must</em> be anecdotal.</li>
</ul>
<p>I would do this again if I could!!</p>
]]></content:encoded></item><item><title>Error Handling</title><link>https://sysarcher.github.io/posts/on-rust/</link><pubDate>Wed, 03 Oct 2018 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/on-rust/</guid><description>&lt;p&gt;I started learning Rust almost about two months ago. Even though initially, it&amp;rsquo;s really frustrating, getting code to compile usually means that you&amp;rsquo;ve agreed explicitly with the compiler on what errors would look like. This is actually awesome.&lt;/p&gt;
&lt;p&gt;My usual error checking function while writing Golang looks something like:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-golang" data-lang="golang"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;func&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;check&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;err&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;error&lt;/span&gt;) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;err&lt;/span&gt; &lt;span style="color:#f92672"&gt;!=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;nil&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; panic(&lt;span style="color:#a6e22e"&gt;err&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;(&lt;a href="https://bluxte.net/musings/2018/04/10/go-good-bad-ugly/#noisy-error-management"&gt;read this rant for an idea of Go&amp;rsquo;s error management&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;This is what I have cluttered around my code and until now, I have been a big fan of Golang&amp;rsquo;s error propagation. Rust just does it better with it&amp;rsquo;s &lt;code&gt;?&lt;/code&gt; propagation operator!&lt;/p&gt;</description><content:encoded><![CDATA[<p>I started learning Rust almost about two months ago. Even though initially, it&rsquo;s really frustrating, getting code to compile usually means that you&rsquo;ve agreed explicitly with the compiler on what errors would look like. This is actually awesome.</p>
<p>My usual error checking function while writing Golang looks something like:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-golang" data-lang="golang"><span style="display:flex;"><span><span style="color:#66d9ef">func</span> <span style="color:#a6e22e">check</span>(<span style="color:#a6e22e">err</span> <span style="color:#66d9ef">error</span>) {
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> <span style="color:#a6e22e">err</span> <span style="color:#f92672">!=</span> <span style="color:#66d9ef">nil</span> {
</span></span><span style="display:flex;"><span>        panic(<span style="color:#a6e22e">err</span>)
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p>(<a href="https://bluxte.net/musings/2018/04/10/go-good-bad-ugly/#noisy-error-management">read this rant for an idea of Go&rsquo;s error management</a>)</p>
<p>This is what I have cluttered around my code and until now, I have been a big fan of Golang&rsquo;s error propagation. Rust just does it better with it&rsquo;s <code>?</code> propagation operator!</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-rust" data-lang="rust"><span style="display:flex;"><span><span style="color:#66d9ef">let</span> file <span style="color:#f92672">=</span> File::open(filename)<span style="color:#f92672">?</span>;    <span style="color:#75715e">// propagate error to caller
</span></span></span></code></pre></div><p>Exceptions in C++ are just a mess. They&rsquo;re unreadable and really do not encourage fine-grained handling of errors. They&rsquo;re also very <code>goto</code>-ish. Combined with the <code>match</code> keyword, the propagation operator is a powerful tool. Code looks elegant and readable as well.</p>
<p>I only seriously started learning Rust recently. But the journey has been enjoyable. I expect more rants to come on Rust.</p>
]]></content:encoded></item><item><title>Build, Test and Deploy are Developer Concerns</title><link>https://sysarcher.github.io/posts/build-test-deploy/</link><pubDate>Mon, 01 Oct 2018 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/build-test-deploy/</guid><description>&lt;p&gt;All too often our repos here do not (actually, none) contain the definition of what code compilation and build look like. They exist in separate scripts hosted somewhere on the &amp;ldquo;Integration Team&amp;rdquo;&amp;rsquo;s servers and are very inflexible!&lt;/p&gt;
&lt;p&gt;Travis CI and services like it, have shown us that the steps to build/test/deploy code should also exist in the code repo. I&amp;rsquo;m gonna try to find some time to explore the possibility of having a Travis CI style service for in-house repositories. I want to mandate the existance of a &lt;code&gt;Dockerfile&lt;/code&gt; in every repository so we can at least tell Jenkins to go do a &lt;code&gt;docker build .&lt;/code&gt; in every repo in the list. But this is only temporary. The long-term goal is to definitely be able to hook into Jenkins CI from the Github web interface (like Travis CI in the open source world.)&lt;/p&gt;</description><content:encoded><![CDATA[<p>All too often our repos here do not (actually, none) contain the definition of what code compilation and build look like. They exist in separate scripts hosted somewhere on the &ldquo;Integration Team&rdquo;&rsquo;s servers and are very inflexible!</p>
<p>Travis CI and services like it, have shown us that the steps to build/test/deploy code should also exist in the code repo. I&rsquo;m gonna try to find some time to explore the possibility of having a Travis CI style service for in-house repositories. I want to mandate the existance of a <code>Dockerfile</code> in every repository so we can at least tell Jenkins to go do a <code>docker build .</code> in every repo in the list. But this is only temporary. The long-term goal is to definitely be able to hook into Jenkins CI from the Github web interface (like Travis CI in the open source world.)</p>
]]></content:encoded></item><item><title>Right after I joined this new job..</title><link>https://sysarcher.github.io/posts/some-thoughts/</link><pubDate>Mon, 01 Oct 2018 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/some-thoughts/</guid><description>&lt;p&gt;&lt;em&gt;Do I scrum-master (is that a verb?) automagically agile?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Many people talk about cross-functional teams, developers getting hit by buses (poor us!) and CI/CD. I am not one to disagree here but I think these other tools are important as well as using the tools available to best effect.&lt;/p&gt;
&lt;h3 id="git"&gt;Git&lt;/h3&gt;
&lt;p&gt;I am having to use Gerrit with a Gitweb frontend all maintained by a local team on servers somewhere upstairs. You want a new repo? Please write an email to this guy.. Private repository? No.&lt;/p&gt;</description><content:encoded><![CDATA[<p><em>Do I scrum-master (is that a verb?) automagically agile?</em></p>
<p>Many people talk about cross-functional teams, developers getting hit by buses (poor us!) and CI/CD. I am not one to disagree here but I think these other tools are important as well as using the tools available to best effect.</p>
<h3 id="git">Git</h3>
<p>I am having to use Gerrit with a Gitweb frontend all maintained by a local team on servers somewhere upstairs. You want a new repo? Please write an email to this guy.. Private repository? No.</p>
<p>The first thing I did when I joined was to set up my own Gitlab instance. This enabled me to do the best practices again (check-in code daily, write markdown README.md files etc. etc. Yes, our repo doesn&rsquo;t understand README.md) We&rsquo;re now moving to Github Enterprise which is definitely awesome.</p>
<h3 id="slack">Slack</h3>
<p>Skype for business should be banned! I have missed slack since day 1. Slack let you create channels for different stuff going on like <code>#github</code> and <code>#pull-requests</code> etc. It was a place where different people from different teams could <code>#discuss</code> <code>#everything</code>. This revolution of hashtags somehow missed out on people here. No more.</p>
<p>Mattermost and RocketChat are great alternatives to Slack. I set up Mattermost for my team and that&rsquo;s where we plan our Kicker tournaments. (I don&rsquo;t like the <code>~</code> that RocketChat uses for it&rsquo;s channels.) I have not tried Zulip yet but one of my cousins works on it.. It looks really nice too.</p>
<p>The org however still runs on Email and Skype for business. Something needs to change! Perhaps Microsoft Teams is a good idea?</p>
<h3 id="rtc">RTC</h3>
<p>RTC stands for Rational Team Concert (Whatever That Means). Its the crappiest tool I&rsquo;ve ever had to deal with but it&rsquo;s mandated across the organization. It&rsquo;s meant to be another tool from IBM that is your enterprise agile management system with strange compliance certifications.</p>
<p>I&rsquo;d rather use Jira or something. I have a Trello-like server (wekan) which I use as a Kanban board. Otherwise, I&rsquo;m stuck with RTC.</p>
<p>Github has cool project boards. I should probably start using that since we <em>are</em> moving to Github anyways.</p>
<h3 id="ci-and-cd">CI and CD</h3>
<p>I am a huge fan of having a <code>Jenkinsfile</code>, <code>.travis.yml</code> file or something of this sort as part of your repository. Why we don&rsquo;t have this now is beyond me. This is something I&rsquo;m working on evangelising:</p>
<p>Every repo must contain:</p>
<ul>
<li><code>Jenkinsfile</code> (even if it&rsquo;s empty!)</li>
<li><code>Dockerfile</code> (to at least build the app)</li>
</ul>
<p>I&rsquo;m also a big fan of having your CI/CD servers automated. Working on this, one-thing, one best-practice at a time!</p>
<h3 id="conclusion">Conclusion</h3>
<p>This is all for today. But I have noticed that your enthusiasm for change is often never reciprocated. Keep chugging! I have been able to achieve some of the things I mentioned above but only after loads of frustration. I still see people having long-winded discussions on email threads though. Bad habits aren&rsquo;t easily lost.</p>
<p>Skunkworks are healthy. I&rsquo;m a proud revolutionary (for the better) from the underground. I hope I&rsquo;ll look back at these frustrations and be proud :) Get people around you that are as enthusiastic for change and march forth!</p>
]]></content:encoded></item><item><title>An intro from containers!</title><link>https://sysarcher.github.io/posts/containers/</link><pubDate>Thu, 27 Sep 2018 20:05:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/containers/</guid><description>&lt;p&gt;I recently got the chance to explain what containers are to colleagues of mine. I could&amp;rsquo;ve chosen the normal path of showing off &lt;code&gt;docker run&lt;/code&gt; commands, how to create a &lt;code&gt;Dockerfile&lt;/code&gt; and then go about creating a Docker container. I understand that this was the common intro to containers for most people but for me, it makes Linux containers somewhat holy. I instead did a session on writing some golang code to explain what containers really are. I used &lt;code&gt;asciinema&lt;/code&gt; to record the whole session and replay it at a fast speed which I screen-recorded using Kazam on Ubuntu. The presentation on the bottom-right of the screen was done using &lt;code&gt;mdp&lt;/code&gt;&lt;/p&gt;</description><content:encoded><![CDATA[<p>I recently got the chance to explain what containers are to colleagues of mine. I could&rsquo;ve chosen the normal path of showing off <code>docker run</code> commands, how to create a <code>Dockerfile</code> and then go about creating a Docker container. I understand that this was the common intro to containers for most people but for me, it makes Linux containers somewhat holy. I instead did a session on writing some golang code to explain what containers really are. I used <code>asciinema</code> to record the whole session and replay it at a fast speed which I screen-recorded using Kazam on Ubuntu. The presentation on the bottom-right of the screen was done using <code>mdp</code></p>
<p>Behold the vid: <a href="https://youtu.be/NK1z3095YvM">https://youtu.be/NK1z3095YvM</a></p>
<p>&hellip; and the code: <a href="https://github.com/shrmrf/container-demo">https://github.com/shrmrf/container-demo</a></p>
<p>Although the first thing you&rsquo;ll note is that I didn&rsquo;t write a proper test. I just find it more pleasurable to go ahead with the code but with a specification at the top. While presenting, I was arguing where the <code>syscall.SysProcAttr</code> configurations could be placed and forgot to actually call the <code>child()</code> function. This caused me to move into the wrong direction and I was about to reel off under pressure (remember, this was a live session). But luckily I figured out what I was doing wrong (I had actually practised the code the day before, so that might&rsquo;ve helped.)</p>
<p>Its a 7 minute video, but I think it gives you a nice idea of what goes behind-the-scenes in docker&rsquo;s magic.</p>
]]></content:encoded></item></channel></rss>