<?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>sysarcher/@ich_code</title><link>https://sysarcher.github.io/</link><description>Recent content 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/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>RegEx Search for Youtube Ads</title><link>https://sysarcher.github.io/posts/youtube-ads-list/</link><pubDate>Tue, 30 Mar 2021 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/youtube-ads-list/</guid><description>&lt;p&gt;&lt;em&gt;Strategy:&lt;/em&gt; What I&amp;rsquo;m doing is unblock/whitelist any domain that causes video playback issues.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;(Credits for the original list @beshrkayali)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I have started to add to a blacklist here:&lt;/p&gt;
&lt;script src="https://gist.github.com/sysarcher/aea195d78f6ed5e3ca815a999f8707a7.js"&gt;&lt;/script&gt;
&lt;p&gt;I also created a regex which I&amp;rsquo;m experimenting with: &lt;code&gt;^r[0-9]{1,2}-{3}sn-h0je[a-z0-9]*.googlevideo.com&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;I tested this RegEx on &lt;a href="https://regex101.com"&gt;regex101.com&lt;/a&gt; with the following data:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;r4---sn-h0jeener.googlevideo.com
r4---sn-h0jeener.googlevideo.com
r4---sn-h0jeln7l.googlevideo.com
r1---sn-h0jelne7.googlevideo.com
r2---sn-h0jeln7e.googlevideo.com
r1---sn-h0jeln7e.googlevideo.com
r3---sn-h0jeenle.googlevideo.com
r1---sn-h0jeenle.googlevideo.com
r5---sn-h0jeened.googlevideo.com
r1---sn-h0jeenek.googlevideo.com
r5---sn-h0jeln7l.googlevideo.com
r2---sn-h0jeenle.googlevideo.com
r1---sn-h0jeln7e.googlevideo.com
r5---sn-h0jeen76.googlevideo.com
r5---sn-h0jeln7y.googlevideo.com
r5---sn-h0jeenek.googlevideo.com
r5---sn-h0jeened.googlevideo.com
r5---sn-h0jelne7.googlevideo.com
r1---sn-h0jeener.googlevideo.com
r4---sn-h0jeln7l.googlevideo.com
r1---sn-h0jelne7.googlevideo.com
r4---sn-h0jeln7r.googlevideo.com
r2---sn-h0jeenek.googlevideo.com
r6---sn-h0jeen76.googlevideo.com
r3---sn-h0jeener.googlevideo.com
r1---sn-h0jelne7.googlevideo.com
&lt;/code&gt;&lt;/pre&gt;</description><content:encoded><![CDATA[<p><em>Strategy:</em> What I&rsquo;m doing is unblock/whitelist any domain that causes video playback issues.</p>
<p><em>(Credits for the original list @beshrkayali)</em></p>
<p>I have started to add to a blacklist here:</p>
<script src="https://gist.github.com/sysarcher/aea195d78f6ed5e3ca815a999f8707a7.js"></script>
<p>I also created a regex which I&rsquo;m experimenting with: <code>^r[0-9]{1,2}-{3}sn-h0je[a-z0-9]*.googlevideo.com</code></p>
<p>I tested this RegEx on <a href="https://regex101.com">regex101.com</a> with the following data:</p>
<pre tabindex="0"><code>r4---sn-h0jeener.googlevideo.com
r4---sn-h0jeener.googlevideo.com
r4---sn-h0jeln7l.googlevideo.com
r1---sn-h0jelne7.googlevideo.com
r2---sn-h0jeln7e.googlevideo.com
r1---sn-h0jeln7e.googlevideo.com
r3---sn-h0jeenle.googlevideo.com
r1---sn-h0jeenle.googlevideo.com
r5---sn-h0jeened.googlevideo.com
r1---sn-h0jeenek.googlevideo.com
r5---sn-h0jeln7l.googlevideo.com
r2---sn-h0jeenle.googlevideo.com
r1---sn-h0jeln7e.googlevideo.com
r5---sn-h0jeen76.googlevideo.com
r5---sn-h0jeln7y.googlevideo.com
r5---sn-h0jeenek.googlevideo.com
r5---sn-h0jeened.googlevideo.com
r5---sn-h0jelne7.googlevideo.com
r1---sn-h0jeener.googlevideo.com
r4---sn-h0jeln7l.googlevideo.com
r1---sn-h0jelne7.googlevideo.com
r4---sn-h0jeln7r.googlevideo.com
r2---sn-h0jeenek.googlevideo.com
r6---sn-h0jeen76.googlevideo.com
r3---sn-h0jeener.googlevideo.com
r1---sn-h0jelne7.googlevideo.com
</code></pre>]]></content:encoded></item><item><title>Some nice Hacks</title><link>https://sysarcher.github.io/posts/nice-hacks/</link><pubDate>Wed, 24 Feb 2021 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/nice-hacks/</guid><description>&lt;p&gt;&lt;em&gt;Linux only&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;DISCLAIMER: THE FOLLOWING CAN LEAD TO CREATING SECURITY HOLES IN THE VPN-PROTECTED NETWORK&amp;hellip; BE VERY CAREFUL. MAKE SURE YOU KNOW WHAT YOU&amp;rsquo;RE DOING. IF YOU DON&amp;rsquo;T UNDERSTAND WHAT YOU&amp;rsquo;RE DOING, &lt;strong&gt;DO NOT PROCEED&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;VPNs are a pain in the neck. I managed to find a way to have VPN traffic limited to some sites instead of routing everything through your corporate network.&lt;/p&gt;
&lt;p&gt;Routing everything through corporate network is also a cause of load on the company&amp;rsquo;s servers. Imagine a ton of people watching Youtube over VPN. Now, I&amp;rsquo;m talking about traditional VPN here, not p2p stuff.&lt;/p&gt;</description><content:encoded><![CDATA[<p><em>Linux only</em></p>
<p><em>DISCLAIMER: THE FOLLOWING CAN LEAD TO CREATING SECURITY HOLES IN THE VPN-PROTECTED NETWORK&hellip; BE VERY CAREFUL. MAKE SURE YOU KNOW WHAT YOU&rsquo;RE DOING. IF YOU DON&rsquo;T UNDERSTAND WHAT YOU&rsquo;RE DOING, <strong>DO NOT PROCEED</strong></em></p>
<p>VPNs are a pain in the neck. I managed to find a way to have VPN traffic limited to some sites instead of routing everything through your corporate network.</p>
<p>Routing everything through corporate network is also a cause of load on the company&rsquo;s servers. Imagine a ton of people watching Youtube over VPN. Now, I&rsquo;m talking about traditional VPN here, not p2p stuff.</p>
<h2 id="use-vpn-slice">Use <code>vpn-slice</code></h2>
<p><a href="https://github.com/dlenski/vpn-slice"><code>vpn-slice</code></a> is an awesome tool that allows you to use the VPN for only a certain few websites. I used <code>vpn-slice</code> along with <code>openconnect</code>.</p>
<p>Installation is pretty straightforward if you follow the documentation. Just make sure the <code>root</code> user sees the binary. I installed <code>pyenv</code> seperately for the <code>root</code> user and configured the global python env to be 3.9.2 (<code>pyenv global 3.9.2</code>).</p>
<p>That&rsquo;s it. Now install <code>vpn-slice</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>$ pyenv global 3.9.2  <span style="color:#75715e"># or whatever version you want</span>
</span></span><span style="display:flex;"><span>$ pip install --upgrade pip
</span></span><span style="display:flex;"><span>$ pip install dnspython  <span style="color:#75715e"># recommended in project README</span>
</span></span><span style="display:flex;"><span>$ pip install vpn-slice
</span></span></code></pre></div><h2 id="usage-with-openconnect">Usage with <code>openconnect</code></h2>
<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"># Source: https://docs.microsoft.com/en-us/microsoft-365/enterprise/urls-and-ip-address-ranges?view=o365-worldwide#skype-for-business-online-and-microsoft-teams</span>
</span></span><span style="display:flex;"><span>MSFT<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;teams.microsoft.com login.microsoftonline.com microsoftstreams.com 13.107.64.0/18, 52.112.0.0/14, 52.120.0.0/14&#34;</span>
</span></span><span style="display:flex;"><span>MYCOMPANY<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;&#34;</span>  <span style="color:#75715e"># Your company&#39;s domains, IP addr etc.</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>openconnect <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span>  -c /home/$USER/.cert/CERT.crt <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span>  -k /home/$USER/.cert/private.key --key-password-from-fsid <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span>  -s <span style="color:#e6db74">&#34;vpn-slice </span>$MSFT<span style="color:#e6db74"> </span>$MYCOMPANY<span style="color:#e6db74">&#34;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span>  vpn.company.com
</span></span></code></pre></div>]]></content:encoded></item><item><title>VM Optimizations for RT</title><link>https://sysarcher.github.io/posts/realtime-linux-vms/</link><pubDate>Tue, 10 Nov 2020 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/realtime-linux-vms/</guid><description>&lt;p&gt;QEMU/KVM are a popular backend for OpenStack. In StarlingX Openstack (&lt;code&gt;stx-openstack&lt;/code&gt;) this is also the case. I&amp;rsquo;ll try to describe various techniques that I used to optimize RT behavior on an STX 4.0.1 cluster with worker nodes.&lt;/p&gt;
&lt;h4 id="terminology"&gt;Terminology&lt;/h4&gt;
&lt;p&gt;&lt;strong&gt;Bare-Metal&lt;/strong&gt; is a a physical computer and it&amp;rsquo;s base OS&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Host&lt;/strong&gt; is a bare-metal machine that runs VMs&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Thread&lt;/strong&gt; is a core of a CPU&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;CPU thread&lt;/strong&gt; refers to the thread on the host system CPU&lt;/p&gt;</description><content:encoded><![CDATA[<p>QEMU/KVM are a popular backend for OpenStack. In StarlingX Openstack (<code>stx-openstack</code>) this is also the case. I&rsquo;ll try to describe various techniques that I used to optimize RT behavior on an STX 4.0.1 cluster with worker nodes.</p>
<h4 id="terminology">Terminology</h4>
<p><strong>Bare-Metal</strong> is a a physical computer and it&rsquo;s base OS</p>
<p><strong>Host</strong> is a bare-metal machine that runs VMs</p>
<p><strong>Thread</strong> is a core of a CPU</p>
<p><strong>CPU thread</strong> refers to the thread on the host system CPU</p>
<p><strong>vCPU thread</strong> is a thread on a VM&rsquo;s virtualized CPU</p>
<p><em>Note: I borrowed terminology heavily from <a href="https://null-src.com/posts/qemu-optimization/post.php">this article on <code>null-src</code></a></em></p>
<h3 id="isolating-cpus">Isolating CPUs</h3>
<p><a href="https://shrmrf.github.io/rants/stx/2020/11/09/STX-for-RT.html">My last article covers this topic</a>. Isolating a VM&rsquo;s vCPU threads from the host system ensures that host&rsquo;s processes don&rsquo;t interfere with the VM.</p>
<h3 id="scheduling-openstack-vms-on-isolated-cores">Scheduling Openstack VMs on isolated cores</h3>
<h3 id="cpu-affinity">CPU Affinity</h3>
<h4 id="using-taskset">using <code>taskset</code></h4>
<h3 id="linux-process-scheduler-tuning">Linux Process Scheduler Tuning</h3>
<h3 id="grub-cmdline">GRUB cmdline</h3>
<p>Okay&hellip; don&rsquo;t delete the <code>console</code> entries in your command line&hellip; the entries below are for isolated cpu 1. This is not a comprehensive list&hellip; Just append whatever makes sense to you.</p>
<pre tabindex="0"><code>GRUB_CMDLINE_LINUX_DEFAULT=&#34;threadirqs rcu_nocbs=1 rcu_nocb_poll isolcpus=1 nohz_full=1 nohz=off intel_pstate=disable nosoftlockup nohalt&#34;
</code></pre>]]></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-prem Kubernetes</title><link>https://sysarcher.github.io/posts/k8s-on-prem/</link><pubDate>Sun, 14 Jun 2020 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/k8s-on-prem/</guid><description>&lt;p&gt;I have spent time looking at edge deployments of kubernetes, especially, those that are managed by the Ops team in an industry 4.0 setting. Here are my candidates:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;KubeEdge&lt;/li&gt;
&lt;li&gt;k3s and k3os&lt;/li&gt;
&lt;li&gt;StarlingX&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I present my brief impressions of each below. This post will need updates as my research goes on.&lt;/p&gt;
&lt;h3 id="background"&gt;Background&lt;/h3&gt;
&lt;p&gt;&lt;em&gt;Edge&lt;/em&gt; is often used as a vague term for either one of CDN, factory network or IT data center. There is a fair amount of confusion where cloud transforms into &amp;ldquo;Edge&amp;rdquo;.&lt;/p&gt;</description><content:encoded><![CDATA[<p>I have spent time looking at edge deployments of kubernetes, especially, those that are managed by the Ops team in an industry 4.0 setting. Here are my candidates:</p>
<ul>
<li>KubeEdge</li>
<li>k3s and k3os</li>
<li>StarlingX</li>
</ul>
<p>I present my brief impressions of each below. This post will need updates as my research goes on.</p>
<h3 id="background">Background</h3>
<p><em>Edge</em> is often used as a vague term for either one of CDN, factory network or IT data center. There is a fair amount of confusion where cloud transforms into &ldquo;Edge&rdquo;.</p>
<p><em>Fog</em> apparently is used to describe the same concepts and maintains the vaporous water analogue that is so popular in this space (think about it: data lake, fog, clouds &hellip;) Usage of the term &ldquo;Fog&rdquo; has been tainted by Cisco. <a href="https://www.cisco.com/c/en/us/solutions/enterprise-networks/edge-computing.html">They make a poor attempt</a> to show the difference. Meh.</p>
<p><em>kubernetes</em> is a container orchestrator that has become extremely popular in the last few years. It provides a common API to manage all containers running in your system.</p>
<p><em>Cloud native</em> is used to describe container-first and container-based systems. (my own definition)</p>
<p><em>CNCF</em> is the cloud native computing foundation. It manages projects that specifically target cloud native systems. It does not manage all cloud-native projects. To the contrary, there is a small list of projects that are managed by CNCF.</p>
<p><em>Linux Foundation</em> maintains a set of open source projects. LF Edge is the subgroup that does this for projects targeting Edge deployments. LF projects are of all types.</p>
<p><em>OpenStack Foundation</em> is another foundation that was originally formed for OpenStack&rsquo;s projects (next item) but it seems to now be accepting projects related to other systems.</p>
<p><em>OpenStack</em> is the most popular open source cloud. It&rsquo;s the OG thing: was popular before docker, k8s or anything container-related was mainstream. There are still many users of OpenStack in the wild and it&rsquo;s not going anywhere soon.</p>
<h3 id="kubeedge">KubeEdge</h3>
<p>KubeEdge is a CNCF sandbox project designed to extend Kubernetes from cloud to edge. The IoT Edge has unique challenges that no one solution can provide a complete solution for. KubeEdge is designed to meet the challenge of:</p>
<ul>
<li>Network Reliability</li>
<li>Resource constraint; and</li>
<li>Scalability</li>
</ul>
<p>KubeEdge has agents running on the Edge. The control plane resides on the Cloud and if there&rsquo;s a network failure/disconnect, the agents keep on doing the necessary control operations. Metadata is synchronized as soon as the connection is restored.</p>
<p>KubeEdge is an opinionated take on the Edge: it provides services and frameworks for messaging and networking. And, since it&rsquo;s opinionated, everyone might not agree with it.</p>
<p>My opinion is that KubeEdge will keep on serving a large userbase but it might not be extremely well suited to the 20% market that wants extra flexibility. How it pans out long-term is yet to be seen.</p>
<p>KubeEdge is bringing edge-edge communication which will be interesting combined with newer enhancements in the Linux kernel (read: Wireguard.) This is an extremely interesting project but for the Industry I&rsquo;m working in, might not be the first choice - atleast for me.</p>
<h3 id="k3s">k3s</h3>
<p>K3s is a take on Kubernetes that removes lot&rsquo;s of stuff off of standard kubernetes.</p>
<h4 id="k3os">k3os</h4>
<p><em>benefits of not maintaining your OS and it&rsquo;s downsides</em></p>
<h3 id="starlingx">StarlingX</h3>
<p>StarlingX is an integration project centered around Kubernetes. StarlingX makes an opinionated set of decisions for people looking to use Kubernetes for their infrastructure. StarlingX (STX) is part of the OpenStack foundation which is a testament to it&rsquo;s high quality.</p>
]]></content:encoded></item><item><title>Rust Lifetimes</title><link>https://sysarcher.github.io/posts/lifetimes/</link><pubDate>Wed, 15 Apr 2020 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/lifetimes/</guid><description>&lt;p&gt;Coming from a background in C/C++ and other programming languages doesn&amp;rsquo;t help with understanding this one fundamental concept in Rust. Here, I&amp;rsquo;ll try to break it down so it becomes a bit more palatable (and a reference to my future self.)&lt;/p&gt;
&lt;p&gt;A simple example:&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-rust" data-lang="rust"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;fn&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;main&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;let&lt;/span&gt; list &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;vec!&lt;/span&gt;[&lt;span style="color:#ae81ff"&gt;100&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;34&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;72&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;55&lt;/span&gt;]; &lt;span style="color:#75715e"&gt;// list is created
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;let&lt;/span&gt; first_two &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;list[&lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;&lt;span style="color:#f92672"&gt;..&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;2&lt;/span&gt;]; &lt;span style="color:#75715e"&gt;// reference is created (first_two)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;println!&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;first two are &lt;/span&gt;&lt;span style="color:#e6db74"&gt;{:?}&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;, first_two); &lt;span style="color:#75715e"&gt;// first_two is referred
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;println!&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;list is &lt;/span&gt;&lt;span style="color:#e6db74"&gt;{:?}&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;, list); &lt;span style="color:#75715e"&gt;// list is referred
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;println!&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;again, first two: &lt;/span&gt;&lt;span style="color:#e6db74"&gt;{:?}&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;, first_two); &lt;span style="color:#75715e"&gt;// first_two is referred
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;} &lt;span style="color:#75715e"&gt;// first_two is dropped, then, list is dropped
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A complicated (yet valid) example:&lt;/p&gt;</description><content:encoded><![CDATA[<p>Coming from a background in C/C++ and other programming languages doesn&rsquo;t help with understanding this one fundamental concept in Rust. Here, I&rsquo;ll try to break it down so it becomes a bit more palatable (and a reference to my future self.)</p>
<p>A simple example:</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">fn</span> <span style="color:#a6e22e">main</span>() {
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">let</span> list <span style="color:#f92672">=</span> <span style="color:#a6e22e">vec!</span>[<span style="color:#ae81ff">100</span>, <span style="color:#ae81ff">34</span>, <span style="color:#ae81ff">72</span>, <span style="color:#ae81ff">55</span>];               <span style="color:#75715e">// list is created
</span></span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">let</span> first_two <span style="color:#f92672">=</span> <span style="color:#f92672">&amp;</span>list[<span style="color:#ae81ff">0</span><span style="color:#f92672">..</span><span style="color:#ae81ff">2</span>];                    <span style="color:#75715e">// reference is created (first_two)
</span></span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">println!</span>(<span style="color:#e6db74">&#34;first two are </span><span style="color:#e6db74">{:?}</span><span style="color:#e6db74">&#34;</span>, first_two);      <span style="color:#75715e">// first_two is referred
</span></span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">println!</span>(<span style="color:#e6db74">&#34;list is </span><span style="color:#e6db74">{:?}</span><span style="color:#e6db74">&#34;</span>, list);                 <span style="color:#75715e">// list is referred
</span></span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">println!</span>(<span style="color:#e6db74">&#34;again, first two: </span><span style="color:#e6db74">{:?}</span><span style="color:#e6db74">&#34;</span>, first_two);  <span style="color:#75715e">// first_two is referred
</span></span></span><span style="display:flex;"><span>}                                                   <span style="color:#75715e">// first_two is dropped, then, list is dropped
</span></span></span></code></pre></div><p>A complicated (yet valid) example:</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">fn</span> <span style="color:#a6e22e">return_first_two</span>(borrowed_list: <span style="color:#66d9ef">&amp;</span>[<span style="color:#66d9ef">i32</span>]) -&gt; <span style="color:#66d9ef">&amp;</span>[<span style="color:#66d9ef">i32</span>] {      <span style="color:#75715e">// borrowed_list is a reference
</span></span></span><span style="display:flex;"><span>    <span style="color:#f92672">&amp;</span>borrowed_list[<span style="color:#ae81ff">0</span><span style="color:#f92672">..</span><span style="color:#ae81ff">2</span>]
</span></span><span style="display:flex;"><span>}                                                           <span style="color:#75715e">// borrowed_list is not dropped because it references something outside of its scope
</span></span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">fn</span> <span style="color:#a6e22e">main</span>() {
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">let</span> list <span style="color:#f92672">=</span> <span style="color:#a6e22e">vec!</span>[<span style="color:#ae81ff">100</span>, <span style="color:#ae81ff">34</span>, <span style="color:#ae81ff">72</span>, <span style="color:#ae81ff">55</span>];               <span style="color:#75715e">// list is created
</span></span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">let</span> first_two <span style="color:#f92672">=</span> return_first_two(<span style="color:#f92672">&amp;</span>list);        <span style="color:#75715e">// reference is returned (first_two)
</span></span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">println!</span>(<span style="color:#e6db74">&#34;first two are </span><span style="color:#e6db74">{:?}</span><span style="color:#e6db74">&#34;</span>, first_two);      <span style="color:#75715e">// first_two is referred
</span></span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">println!</span>(<span style="color:#e6db74">&#34;list is </span><span style="color:#e6db74">{:?}</span><span style="color:#e6db74">&#34;</span>, list);                 <span style="color:#75715e">// list is referred
</span></span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">println!</span>(<span style="color:#e6db74">&#34;again, first two: </span><span style="color:#e6db74">{:?}</span><span style="color:#e6db74">&#34;</span>, first_two);  <span style="color:#75715e">// first_two is referred
</span></span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p>The main takeaways from the above two examples is:</p>
<ul>
<li><em>the lifetime of values should outlive any of it&rsquo;s references</em></li>
<li><em>a reference&rsquo;s lifetime must be completely contained within the lifetime of the value being referenced</em></li>
</ul>
<p>Generic Lifetimes:</p>
<p><em>the following won&rsquo;t compile</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-rust" data-lang="rust"><span style="display:flex;"><span><span style="color:#66d9ef">extern</span> <span style="color:#66d9ef">crate</span> rand;
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">fn</span> <span style="color:#a6e22e">simulate_game</span>(home: <span style="color:#66d9ef">&amp;</span><span style="color:#66d9ef">str</span>, away: <span style="color:#66d9ef">&amp;</span><span style="color:#66d9ef">str</span>) -&gt; <span style="color:#66d9ef">&amp;</span><span style="color:#66d9ef">str</span> {
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> rand::random() {
</span></span><span style="display:flex;"><span>        home
</span></span><span style="display:flex;"><span>    } <span style="color:#66d9ef">else</span> {
</span></span><span style="display:flex;"><span>        away
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p>Rust can not know the lifetime of the return value. It knows that return is valid when <em>both</em> references are valid!!</p>
<p>Adding a generic lifetime param:</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">extern</span> <span style="color:#66d9ef">crate</span> rand;
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">fn</span> <span style="color:#a6e22e">simulate_game</span><span style="color:#f92672">&lt;</span><span style="color:#a6e22e">&#39;a</span><span style="color:#f92672">&gt;</span>(home: <span style="color:#66d9ef">&amp;</span><span style="color:#a6e22e">&#39;a</span> <span style="color:#66d9ef">str</span>, away: <span style="color:#66d9ef">&amp;</span><span style="color:#a6e22e">&#39;a</span> <span style="color:#66d9ef">str</span>) -&gt; <span style="color:#66d9ef">&amp;</span><span style="color:#a6e22e">&#39;a</span> <span style="color:#66d9ef">str</span> {
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> rand::random() {
</span></span><span style="display:flex;"><span>        home
</span></span><span style="display:flex;"><span>    } <span style="color:#66d9ef">else</span> {
</span></span><span style="display:flex;"><span>        away
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p>This syntax expresses intent in signature</p>
<p><strong>Lifetime Elision:</strong></p>
<p>Lifetimes are a part of the language but the language can create some common lifetimes so we don&rsquo;t have to specify them all the time in our programs. This is called Lifetime Elision. The three rules of elided lifetimes:</p>
<ul>
<li>Each parameter gets its own lifetime</li>
<li>One lifetime in parameters =&gt; return</li>
<li>Self reference&rsquo;s lifetime =&gt; return</li>
</ul>
]]></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>new year</title><link>https://sysarcher.github.io/posts/new-year/</link><pubDate>Mon, 07 Jan 2019 00:00:00 +0200</pubDate><guid>https://sysarcher.github.io/posts/new-year/</guid><description>&lt;p&gt;This is a post for me to set up a new year&amp;rsquo;s wishlist and track it.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; Learn Clojure: I want to learn some FP this year&lt;/li&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; Improve Rust: work on some internal/external tools at work&lt;/li&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; TSN: important in industrial applications&lt;/li&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; Yocto: Finally master this crap&lt;/li&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; ClearLinux: What I want to be working on&lt;/li&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; Firecracker: Get this thing running on my hardware&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Non Technical Goals&lt;/p&gt;</description><content:encoded><![CDATA[<p>This is a post for me to set up a new year&rsquo;s wishlist and track it.</p>
<ul>
<li><input disabled="" type="checkbox"> Learn Clojure: I want to learn some FP this year</li>
<li><input disabled="" type="checkbox"> Improve Rust: work on some internal/external tools at work</li>
<li><input disabled="" type="checkbox"> TSN: important in industrial applications</li>
<li><input disabled="" type="checkbox"> Yocto: Finally master this crap</li>
<li><input disabled="" type="checkbox"> ClearLinux: What I want to be working on</li>
<li><input disabled="" type="checkbox"> Firecracker: Get this thing running on my hardware</li>
</ul>
<p>Non Technical Goals</p>
<ul>
<li><input disabled="" type="checkbox"> Exercise: get a routine in place</li>
<li><input disabled="" type="checkbox"> Read: Some book every month</li>
<li><input disabled="" type="checkbox"> Manage: manage time better</li>
</ul>
<p>This list is kept to a minimum so the goals are achievable. Wish me luck!!</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>Event Driven</title><link>https://sysarcher.github.io/posts/event-driven/</link><pubDate>Fri, 09 Nov 2018 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/event-driven/</guid><description>&lt;p&gt;I spent all day today fiddling around with PowerPoint. I am doing a presentation soon(ish) around &amp;ldquo;Event Driven Microservices&amp;rdquo; (a lightning talk) which is made hard because of the time limit.&lt;/p&gt;
&lt;p&gt;The goal is to introduce events and derivatives of events. Why events are the &lt;em&gt;source of truth&lt;/em&gt; for all software. Below I dump my thoughts so I can come back to them later.&lt;/p&gt;
&lt;h2 id="final-example"&gt;Final Example&lt;/h2&gt;
&lt;p&gt;(11-11-2018) Today, discussing with a friend, I think I came up with the case-study I&amp;rsquo;m gonna go with.&lt;/p&gt;</description><content:encoded><![CDATA[<p>I spent all day today fiddling around with PowerPoint. I am doing a presentation soon(ish) around &ldquo;Event Driven Microservices&rdquo; (a lightning talk) which is made hard because of the time limit.</p>
<p>The goal is to introduce events and derivatives of events. Why events are the <em>source of truth</em> for all software. Below I dump my thoughts so I can come back to them later.</p>
<h2 id="final-example">Final Example</h2>
<p>(11-11-2018) Today, discussing with a friend, I think I came up with the case-study I&rsquo;m gonna go with.</p>
<h3 id="advantages-of-microservices">Advantages of Microservices</h3>
<p>Explain the advantages of microservices.</p>
<ul>
<li>Programming language independence</li>
<li>Scale the bottlenecks</li>
</ul>
<h3 id="advantages-of-event-triggered-architectures">Advantages of Event Triggered Architectures</h3>
<p>Explain the advantages of event-triggered systems.</p>
<ul>
<li>Fire and forget type of architecture</li>
<li>IoT is like that
<ul>
<li>Publish/Subscribe</li>
<li>Any component can pick up the data it needs</li>
</ul>
</li>
</ul>
<h3 id="final-story">Final story</h3>
<p>I&rsquo;ll start with a brief overview of Microservices and event triggered systems.</p>
<ul>
<li>A recommendation engine with a broken algorithm.</li>
<li>Events are used to recommend the next video to play.</li>
<li>The algo is messed up and recommends a certain medicine to all the male viewers OR there&rsquo;s an update that we think the customers will be more happy with.</li>
<li>In an event triggered system
<ul>
<li>deploy new recommendation service</li>
<li>events get replayed in the new service and better recommendations come up</li>
</ul>
</li>
</ul>
]]></content:encoded></item><item><title>Kubernetes Pod Networks and Plugins</title><link>https://sysarcher.github.io/posts/k8s-pod-networks/</link><pubDate>Mon, 22 Oct 2018 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/k8s-pod-networks/</guid><description>&lt;h3 id="pod-networks"&gt;Pod Networks&lt;/h3&gt;
&lt;p&gt;It is natural that to get your first &lt;code&gt;k8s&lt;/code&gt; cluster running you&amp;rsquo;d want to remove the taint from the master node and use it as the cluster (i.e. a single-node cluster). The first thing that a person would do is not set the &lt;a href="https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/#installation"&gt;kubelet network plugin (&amp;ndash;network-plugin=cni)&lt;/a&gt;. It&amp;rsquo;s certainly what I did wrong.&lt;/p&gt;
&lt;p&gt;The problem is you don&amp;rsquo;t see the problem until later because the orchestrator will use docker&amp;rsquo;s default networking which would quickly fail in a more-than-one node cluster. So, it&amp;rsquo;s best practice to immediately apply a pod network!!&lt;/p&gt;</description><content:encoded><![CDATA[<h3 id="pod-networks">Pod Networks</h3>
<p>It is natural that to get your first <code>k8s</code> cluster running you&rsquo;d want to remove the taint from the master node and use it as the cluster (i.e. a single-node cluster). The first thing that a person would do is not set the <a href="https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/#installation">kubelet network plugin (&ndash;network-plugin=cni)</a>. It&rsquo;s certainly what I did wrong.</p>
<p>The problem is you don&rsquo;t see the problem until later because the orchestrator will use docker&rsquo;s default networking which would quickly fail in a more-than-one node cluster. So, it&rsquo;s best practice to immediately apply a pod network!!</p>
<h3 id="device-sharing">Device Sharing</h3>
<p>What if you want to orchestrate the usage of resources (like GPU, audio, crypto) using Kubernetes? Its best practice to create a device plugin. NVIDIA has a <a href="https://github.com/NVIDIA/k8s-device-plugin"><code>k8s-device-plugin</code></a> for it&rsquo;s GPUs. If this plugin isn&rsquo;t used, you basically end up having to install NVIDIA drivers inside the docker container and hope the host&rsquo;s version of the driver is <em>exactly</em> the same and share the devices with the container.</p>
<p>This is more elegant. Do it!</p>
]]></content:encoded></item><item><title>runc and Friends</title><link>https://sysarcher.github.io/posts/runc-and-friends/</link><pubDate>Sat, 20 Oct 2018 21:22:37 +0200</pubDate><guid>https://sysarcher.github.io/posts/runc-and-friends/</guid><description>&lt;p&gt;Had to dig a bit into Kubernetes&amp;rsquo; friends recently. Here&amp;rsquo;s a TL;DR of what&amp;rsquo;s missing from the internet today:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;runc&lt;/code&gt; is the &lt;strong&gt;CLI tool&lt;/strong&gt; for running containers (create/run/delete/&lt;del&gt;manage&lt;/del&gt;)
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;docker&lt;/code&gt; uses &lt;code&gt;runc&lt;/code&gt; as its runtime.&lt;/li&gt;
&lt;li&gt;Kubernetes uses &lt;code&gt;runc&lt;/code&gt; as its runtime through &lt;code&gt;cri-o&lt;/code&gt; (those &amp;ldquo;unsupported Docker version detected&amp;rdquo; errors you&amp;rsquo;ve probably seen.. yeah!) There&amp;rsquo;s no guarantee that &lt;code&gt;runc&lt;/code&gt; will remain &lt;code&gt;cri-o&lt;/code&gt; compatible.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cri-o&lt;/code&gt; is an interface for container runtimes. Any compatible runtime can be used. &lt;code&gt;runc&lt;/code&gt; is one of those others being &lt;code&gt;rkt&lt;/code&gt; (never tested it), Kata containers and I guess many more.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;containerd&lt;/code&gt; - runtime manager created by docker and later contributed to CNCF. It&amp;rsquo;s the daemon that&amp;rsquo;s running in the background doing your bidding that you pass through &lt;code&gt;runc&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;</description><content:encoded><![CDATA[<p>Had to dig a bit into Kubernetes&rsquo; friends recently. Here&rsquo;s a TL;DR of what&rsquo;s missing from the internet today:</p>
<ul>
<li><code>runc</code> is the <strong>CLI tool</strong> for running containers (create/run/delete/<del>manage</del>)
<ul>
<li><code>docker</code> uses <code>runc</code> as its runtime.</li>
<li>Kubernetes uses <code>runc</code> as its runtime through <code>cri-o</code> (those &ldquo;unsupported Docker version detected&rdquo; errors you&rsquo;ve probably seen.. yeah!) There&rsquo;s no guarantee that <code>runc</code> will remain <code>cri-o</code> compatible.</li>
</ul>
</li>
<li><code>cri-o</code> is an interface for container runtimes. Any compatible runtime can be used. <code>runc</code> is one of those others being <code>rkt</code> (never tested it), Kata containers and I guess many more.</li>
<li><code>containerd</code> - runtime manager created by docker and later contributed to CNCF. It&rsquo;s the daemon that&rsquo;s running in the background doing your bidding that you pass through <code>runc</code>.</li>
</ul>
]]></content:encoded></item><item><title>Coding interviews</title><link>https://sysarcher.github.io/posts/coding-interviews/</link><pubDate>Sat, 13 Oct 2018 00:00:00 +0200</pubDate><guid>https://sysarcher.github.io/posts/coding-interviews/</guid><description>&lt;p&gt;Had to take a coding challenge recently. It is a strange experience for any developer. Got me thinking about &lt;em&gt;interviews&lt;/em&gt; that require doing a coding challenge at any stage of the application experience. Here are my views on coding interviews..&lt;/p&gt;
&lt;p&gt;Coding interviews are supposed to test the programming abilities of the testee. Although coding interviews ideally test the ability of the test taker to program, they are far from perfect.&lt;/p&gt;</description><content:encoded><![CDATA[<p>Had to take a coding challenge recently. It is a strange experience for any developer. Got me thinking about <em>interviews</em> that require doing a coding challenge at any stage of the application experience. Here are my views on coding interviews..</p>
<p>Coding interviews are supposed to test the programming abilities of the testee. Although coding interviews ideally test the ability of the test taker to program, they are far from perfect.</p>
<p>What do I classify as coding interviews? I&rsquo;d say interviews that involve the test-taker to do any sort of programming is a coding interview. I&rsquo;d classify whiteboard interviews in the same category.</p>
<h3 id="what-are-the-goals">What are the goals?</h3>
<ul>
<li>
<p>I&rsquo;d say the main goal is to weed out the worst CVs that claim years of experience in a programming language and the person/applicant is not really a good programmer.</p>
</li>
<li>
<p>Another goal is to test if the applicant is versed in the basic computer science concepts of performance tradeoffs etc. i.e. <code>O(someting)</code> PLUS the space-time tradeoffs.</p>
</li>
</ul>
<h3 id="where-coding-interviews-fail">Where coding interviews fail</h3>
<ul>
<li>Online coding challenges fail to catch cheats. I could sit with a friend and have him do solution 4 while I work on 1.</li>
<li>The interviewer may be biased: not really ever obvious, but it&rsquo;s humans doing interviews in the end.</li>
<li>In-person interviews might make the applicant confused. This is just a matter of experience. I think experience helps here.</li>
</ul>
<h3 id="conclusion">Conclusion</h3>
<p>I like the concept of in-person whiteboard sessions. They are abstract enough so that the applicant can feel comfortable with his knownledge, he also doesn&rsquo;t need to remember syntax by heart.</p>
<p>Development environments and editors are a personal thing for developers and programming in a foreign environment isn&rsquo;t the same as doing it on your own machine. Recently, I had to talk to a board over serial (<code>tty</code>) interfaces on a colleague&rsquo;s machine. Took 2 hours of struggle to get nothing done in the end. Went downstairs to my machine, <code>ssh</code>d into the board and 5 min(!) later, done! 2 hours!! I&rsquo;m not joking.</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><item><title>About</title><link>https://sysarcher.github.io/about/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://sysarcher.github.io/about/</guid><description>&lt;p&gt;Hey there!! I&amp;rsquo;m &lt;a href="https://about.me/taimoori"&gt;Taimoor&lt;/a&gt;. I go by &lt;code&gt;@ich_code&lt;/code&gt; on Twitter, &lt;code&gt;sysarcher&lt;/code&gt; on Github and various places. Why KISS?&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll find my CV here soon. (Todo: Add link, I haven&amp;rsquo;t added a link because right now, there&amp;rsquo;s too much info on the CV i.e. phone number etc.)&lt;/p&gt;
&lt;p&gt;I love to work, hack and have fun with software. Rust is my new favorite thing.&lt;/p&gt;</description><content:encoded><![CDATA[<p>Hey there!! I&rsquo;m <a href="https://about.me/taimoori">Taimoor</a>. I go by <code>@ich_code</code> on Twitter, <code>sysarcher</code> on Github and various places. Why KISS?</p>
<p>You&rsquo;ll find my CV here soon. (Todo: Add link, I haven&rsquo;t added a link because right now, there&rsquo;s too much info on the CV i.e. phone number etc.)</p>
<p>I love to work, hack and have fun with software. Rust is my new favorite thing.</p>
]]></content:encoded></item><item><title>Unidirectional Dataflow</title><link>https://sysarcher.github.io/posts/unidirectional-dataflow/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://sysarcher.github.io/posts/unidirectional-dataflow/</guid><description>&lt;p&gt;Unidirectional dataflow is a pattern in which data flows only in one direction. Unidirectional dataflow was introduced by Facebook in Flux architecture. Although flux is meant for client-side UI apps, such an architecture is also very interesting for constrained embedded firmware systems.&lt;/p&gt;
&lt;p&gt;This is why the Flux architecture intrigues me: a restriction (one-way data flow) liberates you from a world of spaghetti. The coder is &lt;em&gt;forced&lt;/em&gt; (or at least, strongly tempted) to create abstractions, dispatchers, stores and queues so that he can meet this criteria. Uni-directional dataflow also has the advantage of inherently suggesting the developer that he should make abstractions based on functionality.&lt;/p&gt;</description><content:encoded><![CDATA[<p>Unidirectional dataflow is a pattern in which data flows only in one direction. Unidirectional dataflow was introduced by Facebook in Flux architecture. Although flux is meant for client-side UI apps, such an architecture is also very interesting for constrained embedded firmware systems.</p>
<p>This is why the Flux architecture intrigues me: a restriction (one-way data flow) liberates you from a world of spaghetti. The coder is <em>forced</em> (or at least, strongly tempted) to create abstractions, dispatchers, stores and queues so that he can meet this criteria. Uni-directional dataflow also has the advantage of inherently suggesting the developer that he should make abstractions based on functionality.</p>
<p>Embedded systems can also benefit from flux designs: events generate information and dispatchers are responsible for broadcast events. This should make embedded systems more modular in design and possible to be extended. I look forward to experimenting with flux-designs in backends or embedded systems in the days ahead.</p>
]]></content:encoded></item></channel></rss>