<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[The Hypervisor]]></title><description><![CDATA[The Hypervisor is a Substack about various topics of software-engineering]]></description><link>https://www.thehypervisor.blog</link><image><url>https://substackcdn.com/image/fetch/$s_!eCSK!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf7f1646-9248-40c8-a717-6f1ed8bb8d61_800x800.png</url><title>The Hypervisor</title><link>https://www.thehypervisor.blog</link></image><generator>Substack</generator><lastBuildDate>Fri, 15 May 2026 22:12:55 GMT</lastBuildDate><atom:link href="https://www.thehypervisor.blog/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Matthew Leone]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[thehypervisor@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[thehypervisor@substack.com]]></itunes:email><itunes:name><![CDATA[Matthew Leon]]></itunes:name></itunes:owner><itunes:author><![CDATA[Matthew Leon]]></itunes:author><googleplay:owner><![CDATA[thehypervisor@substack.com]]></googleplay:owner><googleplay:email><![CDATA[thehypervisor@substack.com]]></googleplay:email><googleplay:author><![CDATA[Matthew Leon]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Running your first CUDA kernel]]></title><description><![CDATA[Introduction:]]></description><link>https://www.thehypervisor.blog/p/running-your-first-cuda-kernel</link><guid isPermaLink="false">https://www.thehypervisor.blog/p/running-your-first-cuda-kernel</guid><dc:creator><![CDATA[Matthew Leon]]></dc:creator><pubDate>Fri, 08 Aug 2025 01:32:14 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!pmz0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0437c4a2-7875-4a0d-8234-8297c0772aff_1675x1075.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1>Introduction:</h1><p>CUDA, short for Compute Unified Device Architecture, is Nvidia's parallel computing platform that allows developers and engineers to build incredibly powerful computation systems and programs through the use of GPUs, known as Graphics Processing Units. With the development of CUDA, developers can now easily use their Nvidia GPUs for computationally-expensive tasks.</p><p>Difference between GPU and CPU for parallel processing</p><p>You might be asking yourself why CUDA and GPU programming matters. The reason why is because while CPUs are great for general-purpose computing, GPUs are good for computationally-expensive workloads. If you need to programmatically add 2 very large vectors or multiply matrices, a modern GPU can handle the operations in parallel whereas a CPU would need to process the operations serially albeit in parallel if the processing is multi-threaded.</p><p>This post serves as a basic tutorial for getting CUDA running on a GPU and running a custom built kernel that will add 2 vectors.</p><p>For this exercise, the readers should have a somewhat modern GPU. An RTX 5050 or even a GTX 1080 will work fine in a 22.04 version of Ubuntu Linux.</p><p>For this guide we are using Ubuntu 22.04. If you have a different version of Ubuntu or distribution of Linux, you will need to adjust your installation step.</p><h2>Installing Nvidia drivers and CUDA:</h2><p>The first thing that you should do on your ubuntu 22.04 machine is install the Nvidia drivers and CUDA packages so that your programs can dispatch workloads to the GPU.<br><br>This can be done by running the following commands. If you run something besides Ubuntu 22.04, then adjust the commands to whatever version of Ubuntu or other distribution that you are running.</p><pre><code><code>wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt update

sudo apt install cuda

sudo reboot
</code></code></pre><p>Once this runs and the machine reboots, run the following:</p><pre><code>nvidia-smi

nvcc --version
</code></pre><p>You should get an output that looks similar to the following:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pmz0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0437c4a2-7875-4a0d-8234-8297c0772aff_1675x1075.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pmz0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0437c4a2-7875-4a0d-8234-8297c0772aff_1675x1075.png 424w, https://substackcdn.com/image/fetch/$s_!pmz0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0437c4a2-7875-4a0d-8234-8297c0772aff_1675x1075.png 848w, https://substackcdn.com/image/fetch/$s_!pmz0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0437c4a2-7875-4a0d-8234-8297c0772aff_1675x1075.png 1272w, https://substackcdn.com/image/fetch/$s_!pmz0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0437c4a2-7875-4a0d-8234-8297c0772aff_1675x1075.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!pmz0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0437c4a2-7875-4a0d-8234-8297c0772aff_1675x1075.png" width="1456" height="934" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0437c4a2-7875-4a0d-8234-8297c0772aff_1675x1075.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:934,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:112798,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.thehypervisor.blog/i/170409701?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0437c4a2-7875-4a0d-8234-8297c0772aff_1675x1075.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pmz0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0437c4a2-7875-4a0d-8234-8297c0772aff_1675x1075.png 424w, https://substackcdn.com/image/fetch/$s_!pmz0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0437c4a2-7875-4a0d-8234-8297c0772aff_1675x1075.png 848w, https://substackcdn.com/image/fetch/$s_!pmz0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0437c4a2-7875-4a0d-8234-8297c0772aff_1675x1075.png 1272w, https://substackcdn.com/image/fetch/$s_!pmz0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0437c4a2-7875-4a0d-8234-8297c0772aff_1675x1075.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>In my case, I have an RTX 3090 installed.</p><p></p><h2>Running the add vectors CUDA kernel:</h2><p>In a add_vectors.cu file, insert the following</p><pre><code>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;cuda_runtime.h&gt;

__global__ void add(float *a, float *b, float *c, int n) {
    int i = blockIdx.x * blockDim.x + threadIdx.x;
    if (i &lt; n) c[i] = a[i] + b[i];
}

void check(cudaError_t err, const char *msg) {
    if (err != cudaSuccess) {
        printf("Error: %s - %s\n", msg, cudaGetErrorString(err));
        exit(1);
    }
}

int main() {
    int n = 1024;
    size_t size = n * sizeof(float);
    
    float *a = (float*)malloc(size);
    float *b = (float*)malloc(size);
    float *c = (float*)malloc(size);
    
    for (int i = 0; i &lt; n; i++) {
        a[i] = i;
        b[i] = i * 2;
    }
    
    float *d_a, *d_b, *d_c;
    check(cudaMalloc(&amp;d_a, size), "malloc a");
    check(cudaMalloc(&amp;d_b, size), "malloc b");
    check(cudaMalloc(&amp;d_c, size), "malloc c");
    
    check(cudaMemcpy(d_a, a, size, cudaMemcpyHostToDevice), "copy a");
    check(cudaMemcpy(d_b, b, size, cudaMemcpyHostToDevice), "copy b");
    
    int threads = 256;
    int blocks = (n + threads - 1) / threads;
    
    add&lt;&lt;&lt;blocks, threads&gt;&gt;&gt;(d_a, d_b, d_c, n);
    check(cudaGetLastError(), "kernel launch");
    check(cudaDeviceSynchronize(), "sync");
    
    check(cudaMemcpy(c, d_c, size, cudaMemcpyDeviceToHost), "copy result");
    
    for (int i = 0; i &lt; 10; i++) {
        printf("%.0f + %.0f = %.0f\n", a[i], b[i], c[i]);
    }
    
    cudaFree(d_a);
    cudaFree(d_b);
    cudaFree(d_c);
    free(a);
    free(b);
    free(c);
    
    return 0;
}</code></pre><p></p><h2>Running the kernel:</h2><p></p><p>Now that we have a basic CUDA file, we can compile and run it by running the following commands:</p><pre><code>nvcc -o vector_add vector_add.cu
./vector_add</code></pre><p>After running this program, you should see an output that matches the following:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!bdMT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1788f746-70ba-4c8c-adda-5dd307cdd883_210x385.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!bdMT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1788f746-70ba-4c8c-adda-5dd307cdd883_210x385.png 424w, https://substackcdn.com/image/fetch/$s_!bdMT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1788f746-70ba-4c8c-adda-5dd307cdd883_210x385.png 848w, https://substackcdn.com/image/fetch/$s_!bdMT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1788f746-70ba-4c8c-adda-5dd307cdd883_210x385.png 1272w, https://substackcdn.com/image/fetch/$s_!bdMT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1788f746-70ba-4c8c-adda-5dd307cdd883_210x385.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!bdMT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1788f746-70ba-4c8c-adda-5dd307cdd883_210x385.png" width="210" height="385" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1788f746-70ba-4c8c-adda-5dd307cdd883_210x385.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:385,&quot;width&quot;:210,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:11445,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.thehypervisor.blog/i/170409701?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1788f746-70ba-4c8c-adda-5dd307cdd883_210x385.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!bdMT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1788f746-70ba-4c8c-adda-5dd307cdd883_210x385.png 424w, https://substackcdn.com/image/fetch/$s_!bdMT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1788f746-70ba-4c8c-adda-5dd307cdd883_210x385.png 848w, https://substackcdn.com/image/fetch/$s_!bdMT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1788f746-70ba-4c8c-adda-5dd307cdd883_210x385.png 1272w, https://substackcdn.com/image/fetch/$s_!bdMT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1788f746-70ba-4c8c-adda-5dd307cdd883_210x385.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p></p><p>And now you have run your first add vectors CUDA kernel! If you want to dive deeper you can check dive into this kernel and driver program in the next blog post!</p>]]></content:encoded></item><item><title><![CDATA[When to use jupyter/colab notebooks vs dedicated python or other language projects]]></title><description><![CDATA[Finding the correct balance between pragmatic data exploration and data engineering efforts]]></description><link>https://www.thehypervisor.blog/p/when-to-use-jupytercolab-notebooks</link><guid isPermaLink="false">https://www.thehypervisor.blog/p/when-to-use-jupytercolab-notebooks</guid><dc:creator><![CDATA[Matthew Leon]]></dc:creator><pubDate>Fri, 21 Mar 2025 07:37:25 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/56f00e1b-a119-49a1-b9ec-f4ee8a617913_754x393.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>As companies and products utilize data more extensively as time progresses, it is becoming evermore important to understand which data processing tools are the best fit for any given work item.<br><br>This post explains the benefit and consequence tradeoffs of using tools that give a machine-learning or data engineer easy access to runnable scripts/outputs versus tools that allow an engineer to build complex systems. It also explains which tools you might use more extensively for certain engineering roles. First let&#8217;s dive into jupyter and colab notebooks:<br><br>A Jupyter/Colab notebook enables a developer to easily run python code in a web browser. The way this works is for a jupyter notebook, you can run a server that will host the notebook middleware on said server, you can go to the server&#8217;s host and develop python code/scripts from there in an easy-to-run format. Google&#8217;s colab simplifies this further by allowing you to go to your Google drive and merely create and open a new colaboratory file. These are the tradeoffs of developing in this manner:<br></p><h2><strong>Strengths of notebooks</strong></h2><p></p><h4><strong>Simplified Development Environment:</strong> </h4><p>The notebooks allow you to develop and execute python code in a simplified manner making it easy to hit the ground running. Here is an example of a hello world cell:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YIIM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6d2ca7-8b3d-43a5-b396-be80dc296130_286x96.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YIIM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6d2ca7-8b3d-43a5-b396-be80dc296130_286x96.png 424w, https://substackcdn.com/image/fetch/$s_!YIIM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6d2ca7-8b3d-43a5-b396-be80dc296130_286x96.png 848w, https://substackcdn.com/image/fetch/$s_!YIIM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6d2ca7-8b3d-43a5-b396-be80dc296130_286x96.png 1272w, https://substackcdn.com/image/fetch/$s_!YIIM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6d2ca7-8b3d-43a5-b396-be80dc296130_286x96.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YIIM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6d2ca7-8b3d-43a5-b396-be80dc296130_286x96.png" width="286" height="96" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6d6d2ca7-8b3d-43a5-b396-be80dc296130_286x96.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:96,&quot;width&quot;:286,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:4343,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://www.thehypervisor.blog/i/159529783?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6d2ca7-8b3d-43a5-b396-be80dc296130_286x96.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!YIIM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6d2ca7-8b3d-43a5-b396-be80dc296130_286x96.png 424w, https://substackcdn.com/image/fetch/$s_!YIIM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6d2ca7-8b3d-43a5-b396-be80dc296130_286x96.png 848w, https://substackcdn.com/image/fetch/$s_!YIIM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6d2ca7-8b3d-43a5-b396-be80dc296130_286x96.png 1272w, https://substackcdn.com/image/fetch/$s_!YIIM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d6d2ca7-8b3d-43a5-b396-be80dc296130_286x96.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><p><br>With this example, we have a code cell, a place where we write code, and can press shift+enter to run it, and we see the output. All I needed to do was create a colab notebook file in my Google drive and was up-and-running quickly.<br><br>This is the main benefit of running these notebooks. You can easily create them, open them, and code immediately with them and get results quickly.<br></p><h4><strong>Smooth Output And Visualizations:</strong> </h4><p>In addition to showing the text output of the cell, we can easily visualize data:<br></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tteT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8330330-ac3d-4545-b326-32d91b05c6d3_781x667.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tteT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8330330-ac3d-4545-b326-32d91b05c6d3_781x667.png 424w, https://substackcdn.com/image/fetch/$s_!tteT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8330330-ac3d-4545-b326-32d91b05c6d3_781x667.png 848w, https://substackcdn.com/image/fetch/$s_!tteT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8330330-ac3d-4545-b326-32d91b05c6d3_781x667.png 1272w, https://substackcdn.com/image/fetch/$s_!tteT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8330330-ac3d-4545-b326-32d91b05c6d3_781x667.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tteT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8330330-ac3d-4545-b326-32d91b05c6d3_781x667.png" width="781" height="667" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f8330330-ac3d-4545-b326-32d91b05c6d3_781x667.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:667,&quot;width&quot;:781,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:42904,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.thehypervisor.blog/i/159529783?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8330330-ac3d-4545-b326-32d91b05c6d3_781x667.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tteT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8330330-ac3d-4545-b326-32d91b05c6d3_781x667.png 424w, https://substackcdn.com/image/fetch/$s_!tteT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8330330-ac3d-4545-b326-32d91b05c6d3_781x667.png 848w, https://substackcdn.com/image/fetch/$s_!tteT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8330330-ac3d-4545-b326-32d91b05c6d3_781x667.png 1272w, https://substackcdn.com/image/fetch/$s_!tteT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8330330-ac3d-4545-b326-32d91b05c6d3_781x667.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><br>This data visualization is very powerful, because we immediately see it from running the code. We don&#8217;t have to run a python script from the command line that saves a plot to an image file and then open the image file to see the data. It is all just there in the notebook UI.</p><h4><strong><br>Reproducibility:</strong></h4><p>If we want to easily get results from the notebook, but we close it or cleared it, we can just restart the runtime and rerun the cells in order to set up the environment. Clearing the runtime means we restart the python backend process so that we no longer have variables that were created and modified in the previous runtime.</p><p></p><h2><strong>Weakness of notebooks</strong></h2><p></p><h4><strong>Low Version Control:</strong> </h4><p>While the notebooks allow you to get up and running quickly, it can be quite difficult to be able to share the results with other engineers. This means the engineer needs to find a way to bring the notebook to other engineers. If you run your own server, you need to commit it to a Git repo or FTP it to another engineer if they need to run it, which complicates the development process. Colab is easier because you can just share the drive and your peers can copy the notebook and run it themselves, but any changes will require manual merge conflict resolution which can be quite painful.<br></p><h4><strong><br>Code Execution Order:</strong></h4><p>Code execution order refers to the process of running the individual cells for a notebook. When we are exploring and working with variables and data, if we don&#8217;t run the notebook cells from top to bottom, we can get conflicts in the variables for a runtime. This means that at the end of development, users need to clear the runtime and run the entire notebook from beginning to end to make sure everything is correct. It gets easy to screw up the runtime, so care needs to be given for that.</p><p></p><h4><strong>Not Suitable for Production:</strong></h4><p>When developing code and scripts in the notebook, it becomes quite difficult to push that code to a production environment that needs to provide services to users. The reason why is because the format of the notebook is meant for ease of use, not power and functionality. You could theoretically run a production environment from a notebook, but it would be quite fragile and painful.</p><p></p><p>We have just explored the tradeoffs of developing in a notebook. Now let&#8217;s explore the dedicated strengths and weaknesses of the dedicated project:<br></p><h2><strong>Strengths of dedicated projects</strong></h2><p></p><h4><strong>Reliable and Scalable Execution:</strong> </h4><p>With a dedicated python, c++, or other language project, we can write compile and run scripts to launch a project properly in a more-scalable manner. This is incredibly important when building systems that people need to access frequently.<br></p><h4><strong>High Version Control:</strong> </h4><p>Version control is a cornerstone of any mature software product. By using a project-based data application, it eases the ability for teams and engineers to check in their project&#8217;s progress. This becomes incredibly important as projects involve more engineers that need to work together as seamlessly as possible.</p><p></p><h4><strong>Increased Modularity:</strong> </h4><p>With a project, it can be built in a way such that other projects or services can import and integrate easily with a project. This is great for a development system where a lot of services are being developed at the same time and they use one another.</p><p></p><h2><strong>Weakness of dedicated projects</strong></h2><h4></h4><h4><strong>More Complex Management:</strong></h4><p>With a dedicated project, it takes quite a bit of effort to build out the qualities we would expect from a well-designed and developed project such as reliability, scalability, and elasticity. It is possible to run a python script or the runtime from the command-line, but as engineers build features into the project, it increases the complexity of the project, and eventually it will become necessary to spend time to build out the building, running, and deployment systems for the project.<br></p><h4><strong>Less Interactive:</strong></h4><p>We saw before with the notebook that it is quite easy to work with a notebook. Just type the code and run a given cell. With the dedicated project, there is more friction to execute the program. We might have build/run scripts and output directories. We won&#8217;t be able to see easy visualizations without writing to a file on disk and opening the file.<br></p><h4><strong><br>More Complicated To Develop:</strong></h4><p>One issue with projects is that in order to code for them, you need to know enough about the project&#8217;s source code to know what changes should be made to achieve a desirable result. With the notebook, you just follow the code in the file until you need to make a change, but with the project, you need to dig through the source code references to find what you are looking for.<br><br><br>Now that we have explored the tradeoffs for both approaches to development, I would like to describe the ideal users and roles that would naturally gravitate towards each tool:</p><h4><strong><br><br>Notebook Developers: The Data Explorers<br></strong></h4><p><strong>Data Scientist:</strong> This role is the major user of notebooks. Data scientists perform analysis on data for the purposes of fulfilling feature-engineering and model development/validation/optimization.</p><p><strong>Data Analyst: </strong>This role is another major user of notebooks. Data analysts take existing data to derive insights about business metrics in order to understand optimal business strategies and to visualize these details.</p><p><strong>Educator and Student: </strong>These roles make effective use of notebooks in order to better teach and learn course material. Notebooks allow people to learn and teach in a more interactive manner.</p><p></p><h4><strong><br>Project Developers: The Data System Builders</strong></h4><p></p><p><strong>Software Engineer: </strong>This role primarily develops using projects. The reason why is that they need to build systems that scale properly with a standardized development flow. These systems could be data-processing systems, but they could also be general purpose systems outside of data.</p><p><strong>Data Engineer: </strong>This role uses projects to develop data-processing pipelines. They primarily use projects because they are essentially software engineers with a focus on data processing. They focus more on the ETL pipelines and infrastructure.</p><p><strong>DevOps and MLOps Engineer: </strong>This role is essentially a combination between the software/data engineer and operations engineer. This role also works on data-processing systems, but they also work on making sure systems fulfill their SLOs and SLAs and also maintaining the pipelines that run.</p><p><strong>Educator and Student: </strong>These roles along with the notebook user also use projects for learning and growth as well. They might implement highly-technical assignments using projects that are not conducive to being developed in a not<strong>ebook.<br></strong></p><p><br>This concludes the more specific users for both notebooks and projects, but there are a couple roles that I want to mention that I think will use both notebooks and projects:<br><br><strong>Machine Learning Engineer: </strong>This role is primarily focused on building data-intensive systems. This engineer should be prepared to bridge the role of data scientists and software/MLOps engineers. </p><p><strong>Tech Lead: </strong>This role serves the purpose of leading teams and organizations. Usually this contributor starts with one of the previously mentioned roles, but has gained enough competency, influence, and trust to be able to lead the building of entire services and products.<br></p><p><br>In conclusion, both notebooks and development projects have their roles and purposes. If you need fast and prototype development, then notebooks are your best bet. If you need systems, a project will be your goto.</p>]]></content:encoded></item><item><title><![CDATA[How to run deepseek-r1 locally]]></title><description><![CDATA[A basic guide for setting up and running deepseek's r1 model]]></description><link>https://www.thehypervisor.blog/p/how-to-run-deepseek-r1</link><guid isPermaLink="false">https://www.thehypervisor.blog/p/how-to-run-deepseek-r1</guid><dc:creator><![CDATA[Matthew Leon]]></dc:creator><pubDate>Mon, 27 Jan 2025 21:31:39 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/973d3bee-cad6-4014-a8af-5f45c13ee4cc_500x365.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Recently, High-Flyer - a Chinese hedge fund published an LLM model that delivers similar performance to OpenAI&#8217;s ChatGPT-o1 and Anthropic&#8217;s Claude-Sonnet3.5 model. This model is unique because it can be run locally on your own consumer graphics hardware, making AI accessible to anyone with a decent GPU.</p><p></p><p>This is a guide for getting deepseek-r1 up and running on your system. Make sure that you have a system with a GPU(s) that have a total of around 16 GB of VRAM to make it feasible to run the model.<br></p><p>Before starting, make sure you have the relevant drivers for your GPUs. I am running Nvidia currently, so I have the drivers and CUDA toolkit installed.</p><p></p><p>1: You must first install a platform like ollama in order to pull the model and start inferencing on it. Follow these steps to install ollama:<br><br>For Mac and Ubuntu and Windows Subsystem For Linux, do the following:</p><pre><code><code>curl -fsSL https://ollama.com/install.sh | sh</code></code></pre><p>This will install ollama.</p><p><br>2: Next, you need to run ollama&#8217;s backend in order to inference on it:<br><br>On the various platforms, you can run:</p><pre><code>ollama serve</code></pre><p>and that should allow you to create another terminal to run deepseek.</p><p>On Linux systems running systemd, you can run:</p><pre><code>sudo systemctl start ollama</code></pre><p>After doing this you should see something like the following:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!W_AJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7db1f7c-558e-463b-a321-a444730eb6ea_3840x2088.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!W_AJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7db1f7c-558e-463b-a321-a444730eb6ea_3840x2088.png 424w, https://substackcdn.com/image/fetch/$s_!W_AJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7db1f7c-558e-463b-a321-a444730eb6ea_3840x2088.png 848w, https://substackcdn.com/image/fetch/$s_!W_AJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7db1f7c-558e-463b-a321-a444730eb6ea_3840x2088.png 1272w, https://substackcdn.com/image/fetch/$s_!W_AJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7db1f7c-558e-463b-a321-a444730eb6ea_3840x2088.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!W_AJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7db1f7c-558e-463b-a321-a444730eb6ea_3840x2088.png" width="1456" height="792" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d7db1f7c-558e-463b-a321-a444730eb6ea_3840x2088.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:792,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:689907,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!W_AJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7db1f7c-558e-463b-a321-a444730eb6ea_3840x2088.png 424w, https://substackcdn.com/image/fetch/$s_!W_AJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7db1f7c-558e-463b-a321-a444730eb6ea_3840x2088.png 848w, https://substackcdn.com/image/fetch/$s_!W_AJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7db1f7c-558e-463b-a321-a444730eb6ea_3840x2088.png 1272w, https://substackcdn.com/image/fetch/$s_!W_AJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd7db1f7c-558e-463b-a321-a444730eb6ea_3840x2088.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><br>when you do ollama serve, or<br></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!9gTg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefc336c5-5845-45d7-9d43-ce41fa4104b4_3840x2088.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9gTg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefc336c5-5845-45d7-9d43-ce41fa4104b4_3840x2088.png 424w, https://substackcdn.com/image/fetch/$s_!9gTg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefc336c5-5845-45d7-9d43-ce41fa4104b4_3840x2088.png 848w, https://substackcdn.com/image/fetch/$s_!9gTg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefc336c5-5845-45d7-9d43-ce41fa4104b4_3840x2088.png 1272w, https://substackcdn.com/image/fetch/$s_!9gTg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefc336c5-5845-45d7-9d43-ce41fa4104b4_3840x2088.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9gTg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefc336c5-5845-45d7-9d43-ce41fa4104b4_3840x2088.png" width="1456" height="792" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/efc336c5-5845-45d7-9d43-ce41fa4104b4_3840x2088.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:792,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:348774,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!9gTg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefc336c5-5845-45d7-9d43-ce41fa4104b4_3840x2088.png 424w, https://substackcdn.com/image/fetch/$s_!9gTg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefc336c5-5845-45d7-9d43-ce41fa4104b4_3840x2088.png 848w, https://substackcdn.com/image/fetch/$s_!9gTg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefc336c5-5845-45d7-9d43-ce41fa4104b4_3840x2088.png 1272w, https://substackcdn.com/image/fetch/$s_!9gTg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefc336c5-5845-45d7-9d43-ce41fa4104b4_3840x2088.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><br>when running systemctl to launch ollama service.</p><p><br>Once you have these, we can finally start inferencing!</p><p></p><p>3: Pull and run the deepseek model<br><br>For this step we are going to run the model locally. There are several models with varying amounts of parameters. The goal is the pick the best bang-for-the-buck model to run on your hardware. Here is a ranking of the models and their sizes:<br><br>1.5b version (smallest)</p><p>8b version</p><p>14b version</p><p>32b version</p><p>70b version</p><p>671b version (biggest)<br><br>There are a lot of different variations of r1, so here is a general breakdown to the best of my knowledge:<br><br>Use 1.5b, 8b, or 14b if you have around 16 GB of VRAM on your system. These are the economy models that will get the job done, but they are not the smartest.</p><p>Use 32b if you have around 32 GB of VRAM. You might actually need more VRAM, so running a 32GB GPU will probably cut it close.</p><p>Use 70b if you have something like an A100, and you probably need to run several state-of-the-art cards to run the 671b parameter model.</p><p>These are just guesstimates based off my experience using the 14b and smaller models on my GTX 1080s. I will show you how to determine which model is best for your system now.<br><br>4: Running the model<br><br>For actually running the model, open a terminal and run the following:</p><pre><code>ollama run deepseek-r1:8b</code></pre><p>This will kick off the process for ollama to pull the model and run it locally. To determine if your hardware is capable, run the folllowing in another terminal assuming you have Nvidia GPUs:</p><pre><code>nvidia-smi</code></pre><p>You will get an output like the following:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!wn9M!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a24806-1c0d-4ae4-8aad-4d1b43f1b2bd_1280x688.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wn9M!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a24806-1c0d-4ae4-8aad-4d1b43f1b2bd_1280x688.png 424w, https://substackcdn.com/image/fetch/$s_!wn9M!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a24806-1c0d-4ae4-8aad-4d1b43f1b2bd_1280x688.png 848w, https://substackcdn.com/image/fetch/$s_!wn9M!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a24806-1c0d-4ae4-8aad-4d1b43f1b2bd_1280x688.png 1272w, https://substackcdn.com/image/fetch/$s_!wn9M!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a24806-1c0d-4ae4-8aad-4d1b43f1b2bd_1280x688.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!wn9M!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a24806-1c0d-4ae4-8aad-4d1b43f1b2bd_1280x688.png" width="1280" height="688" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c7a24806-1c0d-4ae4-8aad-4d1b43f1b2bd_1280x688.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:688,&quot;width&quot;:1280,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:82166,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wn9M!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a24806-1c0d-4ae4-8aad-4d1b43f1b2bd_1280x688.png 424w, https://substackcdn.com/image/fetch/$s_!wn9M!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a24806-1c0d-4ae4-8aad-4d1b43f1b2bd_1280x688.png 848w, https://substackcdn.com/image/fetch/$s_!wn9M!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a24806-1c0d-4ae4-8aad-4d1b43f1b2bd_1280x688.png 1272w, https://substackcdn.com/image/fetch/$s_!wn9M!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a24806-1c0d-4ae4-8aad-4d1b43f1b2bd_1280x688.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><br>Notice that in my case I have dual GTX 1080s running, and they currently have the 14b model loaded. This model is the highest I can run with without overloading my GPUs.</p><p></p><p>If you have multiple GPUs, run the following command to use both in parallel for inferencing:</p><pre><code>CUDA_VISIBLE_DEVICES=0,1 ollama run deepseek-r1:14b</code></pre><p><br>Once you have completed these steps, you should be able to send a message and now you have the best AI running locally!<br><br>For an example, I gave it the following prompt: &#8220;Write a simple C++ hello world program&#8221; and it gave me the following output:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!7o6Q!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39612276-91d7-4f43-8355-24aa30c78242_1920x1032.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7o6Q!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39612276-91d7-4f43-8355-24aa30c78242_1920x1032.png 424w, https://substackcdn.com/image/fetch/$s_!7o6Q!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39612276-91d7-4f43-8355-24aa30c78242_1920x1032.png 848w, https://substackcdn.com/image/fetch/$s_!7o6Q!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39612276-91d7-4f43-8355-24aa30c78242_1920x1032.png 1272w, https://substackcdn.com/image/fetch/$s_!7o6Q!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39612276-91d7-4f43-8355-24aa30c78242_1920x1032.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!7o6Q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39612276-91d7-4f43-8355-24aa30c78242_1920x1032.png" width="1456" height="783" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/39612276-91d7-4f43-8355-24aa30c78242_1920x1032.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:783,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:155237,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7o6Q!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39612276-91d7-4f43-8355-24aa30c78242_1920x1032.png 424w, https://substackcdn.com/image/fetch/$s_!7o6Q!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39612276-91d7-4f43-8355-24aa30c78242_1920x1032.png 848w, https://substackcdn.com/image/fetch/$s_!7o6Q!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39612276-91d7-4f43-8355-24aa30c78242_1920x1032.png 1272w, https://substackcdn.com/image/fetch/$s_!7o6Q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39612276-91d7-4f43-8355-24aa30c78242_1920x1032.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><br>Enjoy!</p>]]></content:encoded></item><item><title><![CDATA[Introducing InfraMatrix Global Systems Version 0.01]]></title><description><![CDATA[A new hyperscaler for the modern cloud]]></description><link>https://www.thehypervisor.blog/p/introducing-inframatrix-global-systems</link><guid isPermaLink="false">https://www.thehypervisor.blog/p/introducing-inframatrix-global-systems</guid><dc:creator><![CDATA[Matthew Leon]]></dc:creator><pubDate>Sat, 25 Jan 2025 03:03:22 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/9d2f306e-8d99-432f-8419-574e0f1203c0_400x400.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1><strong>Introduction:</strong></h1><p><strong><br></strong>Cloud computing infrastructure today forces companies to choose between the convenience of public clouds like AWS and the control of private solutions like OpenStack. Each path requires tradeoffs - either sacrificing infrastructure control and cost optimization for ease of use, or investing heavily in complex private cloud maintenance.</p><p></p><p>InfraMatrix Global Systems(IGS) is designed to bring the ease of use of the public cloud with the finely-tuned control of the private cloud together in an environment that can run on any amount of hardware that a company or individual owns. Our hyperscaler provides a seamless cloud experience that runs on your own hardware and scales from small deployments to large enterprise infrastructure. The reason we are currently working on this hyperscaler is because we are building infrastructure software products, and we want to build a system that will scale to any amount of hardware in a simplified manner.</p><p></p><p>The source code and guide for running IGS is available <a href="https://github.com/InfraMatrix/IGS/tree/v0.01">here</a>. Please note that this system is entirely experimental and not production-ready yet.</p><h1><strong>Architecture:</strong></h1><p></p><p>Before diving into the supported features, it would be helpful to first understand the current version&#8217;s system design and architecture. This is the current architecture of the hyperscaler:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LrTz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae839728-704a-46d9-994d-997367df0849_452x452.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LrTz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae839728-704a-46d9-994d-997367df0849_452x452.png 424w, https://substackcdn.com/image/fetch/$s_!LrTz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae839728-704a-46d9-994d-997367df0849_452x452.png 848w, https://substackcdn.com/image/fetch/$s_!LrTz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae839728-704a-46d9-994d-997367df0849_452x452.png 1272w, https://substackcdn.com/image/fetch/$s_!LrTz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae839728-704a-46d9-994d-997367df0849_452x452.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LrTz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae839728-704a-46d9-994d-997367df0849_452x452.png" width="452" height="452" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ae839728-704a-46d9-994d-997367df0849_452x452.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:452,&quot;width&quot;:452,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:34257,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LrTz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae839728-704a-46d9-994d-997367df0849_452x452.png 424w, https://substackcdn.com/image/fetch/$s_!LrTz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae839728-704a-46d9-994d-997367df0849_452x452.png 848w, https://substackcdn.com/image/fetch/$s_!LrTz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae839728-704a-46d9-994d-997367df0849_452x452.png 1272w, https://substackcdn.com/image/fetch/$s_!LrTz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae839728-704a-46d9-994d-997367df0849_452x452.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>In this diagram, we see an IGS node that represents a server with several different components. We have various hardware resources like memory, NICs, disks, and GPUs. For the server&#8217;s operating system, we are using Ubuntu and that serves as the main coordinator for us being able to reach the hardware devices. We have a data plane which is what IGS represents currently, and that program talks to a hypervisor, in this case KVM, using QEMU for interfacing it and it talks to kernel in order to provision currently supported hardware, which are NICs and disks, currently.</p><p></p><p>As you can see, this is a monolithic software architecture making the hyperscaler not yet suitable for an enterprise production environment. The reason why it is not suitable is because a hyperscaler should be able to work from a single interface that will handle the communication between any amount of hardware. This monolith means that for every server that an organization has, it needs to install the hyperscaler on it, which is not feasible.<br></p><h1><strong>Subsystems:</strong></h1><p><br>Moving on we have 3 main subsystems that the hyperscaler has implemented, and they are compute, networking, and storage. Here is a brief overview of each and the technologies associated with them:</p><p>Compute - This serves as the main subsystem for providing VMs, containers, and serverless resources to applications. Currently, we are using KVM with QEMU to provision and launch the VMs.</p><p>Networking - This serves as the communication subsystem for compute resources to communicate with each other and external networks. Without this subsystem, we would not be able to push updates, install software, or run distributed systems. Currently, we are solely using QEMU&#8217;s SLiRP networking functionality to enable basic internet connectivity. A major problem with using SLiRP is that we can&#8217;t effectively server public key authentication for SSH, so the only way to communicate with the VMs running is effectively through serial, which can be a major issue.</p><p>Storage - This serves as the main memory subsystem for compute resources to save their state and data properly. Without this subsystem, we would not be able to make persistent changes or enable databases for services that are running on the node. Currently, IGS only supports provisioning and partitioning disks on the host and plugging partitions into VMs.<br><br></p><p>These are the main subsystems of IGS, currently. You may notice that there is an abundant reliance on existing systems that are mature like Linux and KVM. These mature OSSs provide us the ability to do whatever we want with our hardware, and it makes this project&#8217;s undertaking possible. Perhaps eventually it would make sense to write our own OS, hypervisor, networking/storage stacks, but these provide a ton of easy-to-use features for us now.<br><br></p><h1><strong>Main Functionalities:</strong></h1><p></p><p>Given that this project is quite immature, it only supports a couple main features:</p><p>Compute - On the compute side, we currently support creating, deleting, starting, stopping, and connecting to VMs over serial.</p><p>Networking - On the networking side, we currently support connecting VMs to internet</p><p>Storage - On the storage side, we currently support adding and removing, partitioning disks, and placing partitions into VMs.</p><p>These are baseline minimum functionalities for a hyperscaler Minimum-Viable-Product(MVP), but it is a good start. The system is quite buggy and thus not suitable for production environments yet, but it will be a lot closer once version 1.00 is released. This is a good segue into what to expect for version 1.</p><p></p><h1><strong>Version 1.00 Expected Features:</strong></h1><p></p><p>Version 1.00 is going to be a large release for the hyperscaler and make a lot of progress towards making it production ready. These are the improvements that will be made to the hyperscaler and its subsystems:</p><p>Testing - Create integration tests to validate all paths for the hyperscaler.</p><p>Compute - Provide a cleaner way to produce a golden VM image, be it serving it on the internet or autogeneration scripts that will produce the image in an automated manner instead of having to manually create it on the node.</p><p>Networking - Use Open vSwitch to connect VMs directly to Linux&#8217;s networking stack in a cleaner manner than using SLiRP to enable critical features like SSH and enable Security infrastructure in version 2.00.</p><p>Security - Enable SSH only communication. Isolate VM networking interfaces.</p><p>Observability - Enable Prometheus and Grafana metrics for capturing performance data for the node and the subsystems.</p>]]></content:encoded></item><item><title><![CDATA[Using Tcpdump to Observe Linux Networking]]></title><description><![CDATA[Networking is a core functionality of any operating system, including Linux.]]></description><link>https://www.thehypervisor.blog/p/using-tcpdump-to-observe-linux-networking</link><guid isPermaLink="false">https://www.thehypervisor.blog/p/using-tcpdump-to-observe-linux-networking</guid><dc:creator><![CDATA[Matthew Leon]]></dc:creator><pubDate>Tue, 14 Jan 2025 23:02:39 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/0e635f2d-3000-4dce-b011-5b349ed1416c_1280x720.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Networking is a core functionality of any operating system, including Linux. It enables us to connect with other systems that people are operating and are building on. One of my current projects is building a hyperscaler, and I figure that sharing my knowledge of some of the tools that I am using and will use to implement the networking for the scaler would be valuable for others to read. I want to build up to my scaler&#8217;s full functionality by laying the groundwork of the existing systems that I rely on, and it starts with getting basic networking working on Linux and understanding the debugging and troubleshooting tools that I rely on.<br><br>This leads up to tcpdump, which is a networking interface monitoring tool. This tool allows us to inspect the traffic that is flowing across networking interfaces on Linux. A networking interface in any operating system is the means by which we can connect our physical machine to the network and operate it at the software, userspace level.</p><p>This post is a walkthrough of how we can use Linux networking interfaces and tcpdump to observe the traffic going across our host. For this example, we are going to show different ways to use tcpdump to observe traffic:</p><p></p><p>The first example is to just dump all the traffic going through our physical NIC. First we need to figure out what our external-facing NIC is, and we do the following:</p><pre><code>ip route show</code></pre><p>We should see a default entry that looks like the following:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Hq11!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ab25f9-6cb2-4ca2-b40d-e9fb113e1707_717x31.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Hq11!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ab25f9-6cb2-4ca2-b40d-e9fb113e1707_717x31.png 424w, https://substackcdn.com/image/fetch/$s_!Hq11!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ab25f9-6cb2-4ca2-b40d-e9fb113e1707_717x31.png 848w, https://substackcdn.com/image/fetch/$s_!Hq11!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ab25f9-6cb2-4ca2-b40d-e9fb113e1707_717x31.png 1272w, https://substackcdn.com/image/fetch/$s_!Hq11!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ab25f9-6cb2-4ca2-b40d-e9fb113e1707_717x31.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Hq11!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ab25f9-6cb2-4ca2-b40d-e9fb113e1707_717x31.png" width="717" height="31" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/61ab25f9-6cb2-4ca2-b40d-e9fb113e1707_717x31.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:31,&quot;width&quot;:717,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:5269,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Hq11!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ab25f9-6cb2-4ca2-b40d-e9fb113e1707_717x31.png 424w, https://substackcdn.com/image/fetch/$s_!Hq11!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ab25f9-6cb2-4ca2-b40d-e9fb113e1707_717x31.png 848w, https://substackcdn.com/image/fetch/$s_!Hq11!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ab25f9-6cb2-4ca2-b40d-e9fb113e1707_717x31.png 1272w, https://substackcdn.com/image/fetch/$s_!Hq11!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61ab25f9-6cb2-4ca2-b40d-e9fb113e1707_717x31.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><p>This tells us our NIC for accessing the internet is enp14s0. Next run the following command:</p><pre><code>sudo tcpdump -i enp14s0</code></pre><p>We should see all of our traffic running across the NIC. This is a straight dump of all the traffic and it helps us understand what our network is doing. For the next example, open 2 terminals and run these in separate terminals:</p><pre><code><code>sudo tcpdump -i enp14s0 -n icmp</code></code></pre><p>and in another terminal run:</p><pre><code><code>ping 192.168.1.29</code></code></pre><p>Go back to your tcpdump terminal and should see traffic that looks like this:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0xgK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a509fad-eda8-4efa-8cc7-8d7e78ba6492_1152x112.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0xgK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a509fad-eda8-4efa-8cc7-8d7e78ba6492_1152x112.png 424w, https://substackcdn.com/image/fetch/$s_!0xgK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a509fad-eda8-4efa-8cc7-8d7e78ba6492_1152x112.png 848w, https://substackcdn.com/image/fetch/$s_!0xgK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a509fad-eda8-4efa-8cc7-8d7e78ba6492_1152x112.png 1272w, https://substackcdn.com/image/fetch/$s_!0xgK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a509fad-eda8-4efa-8cc7-8d7e78ba6492_1152x112.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0xgK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a509fad-eda8-4efa-8cc7-8d7e78ba6492_1152x112.png" width="1152" height="112" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1a509fad-eda8-4efa-8cc7-8d7e78ba6492_1152x112.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:112,&quot;width&quot;:1152,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:37858,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0xgK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a509fad-eda8-4efa-8cc7-8d7e78ba6492_1152x112.png 424w, https://substackcdn.com/image/fetch/$s_!0xgK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a509fad-eda8-4efa-8cc7-8d7e78ba6492_1152x112.png 848w, https://substackcdn.com/image/fetch/$s_!0xgK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a509fad-eda8-4efa-8cc7-8d7e78ba6492_1152x112.png 1272w, https://substackcdn.com/image/fetch/$s_!0xgK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a509fad-eda8-4efa-8cc7-8d7e78ba6492_1152x112.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>We can run tcpdump and specify a specific protocol like ICMP that we want to capture the traffic on. This makes it really useful for observing and debugging network configurations as ICMP is used for validating and testing network functionality. Finally, run the following:</p><pre><code><code>sudo tcpdump -i enp14s0 -n -v port 443</code></code></pre><p>and in another terminal run:</p><pre><code><code>curl https://www.thehypervisor.blog &gt; /dev/null</code></code></pre><p>Go to the tcpdump terminal, and you should see something like this:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!PXx4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec3c6617-2768-4436-9399-644d6f4409fb_3370x244.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PXx4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec3c6617-2768-4436-9399-644d6f4409fb_3370x244.png 424w, https://substackcdn.com/image/fetch/$s_!PXx4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec3c6617-2768-4436-9399-644d6f4409fb_3370x244.png 848w, https://substackcdn.com/image/fetch/$s_!PXx4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec3c6617-2768-4436-9399-644d6f4409fb_3370x244.png 1272w, https://substackcdn.com/image/fetch/$s_!PXx4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec3c6617-2768-4436-9399-644d6f4409fb_3370x244.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!PXx4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec3c6617-2768-4436-9399-644d6f4409fb_3370x244.png" width="1456" height="105" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ec3c6617-2768-4436-9399-644d6f4409fb_3370x244.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:105,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:127398,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!PXx4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec3c6617-2768-4436-9399-644d6f4409fb_3370x244.png 424w, https://substackcdn.com/image/fetch/$s_!PXx4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec3c6617-2768-4436-9399-644d6f4409fb_3370x244.png 848w, https://substackcdn.com/image/fetch/$s_!PXx4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec3c6617-2768-4436-9399-644d6f4409fb_3370x244.png 1272w, https://substackcdn.com/image/fetch/$s_!PXx4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec3c6617-2768-4436-9399-644d6f4409fb_3370x244.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>This shows that we can specify the specific networking port that we want to capture traffic on as well. In this case, we are tracking port 443 because that is the port used for HTTPS traffic, and curl allows us to initiate an HTTPS connection using the network transport protocol: TCP.</p><p>In summary, we can use tcpdump for observing and debugging issues at any level of our networking stack, which corresponds to the OSI model. Network software engineers use this tool frequently to verify that their software and networking configurations work properly.<br></p>]]></content:encoded></item><item><title><![CDATA[Getting Started with Traefik: The Modern Load Balancer]]></title><description><![CDATA[Exploring a next-gen cloud-optimized reverse-proxy and load-balancer]]></description><link>https://www.thehypervisor.blog/p/getting-started-with-traefik</link><guid isPermaLink="false">https://www.thehypervisor.blog/p/getting-started-with-traefik</guid><dc:creator><![CDATA[Matthew Leon]]></dc:creator><pubDate>Sun, 12 Jan 2025 05:20:07 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/99227bf7-5d72-4c4c-b5b8-53f9c66e77f3_225x225.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><code>In cloud computing, efficient management of resources is critical, especially for web and distributed systems. There are many technologies that enable these systems to perform in an optimized manner. One such family of technologies is called the reverse-proxy AKA the load-balancer.<br><br>The reverse-proxy / load-balancer is a core component of service-oriented architected systems. In this style of software architecture, the system runs light-weight software services that are decoupled from each other and expose interfaces to enable features and implement functional requirements. We also see that there are numerous instances of the same service that allow the system to distribute its workloads across as opposed to pushing them through a single service. The job of the reverse-proxy / load-balancer is to enable the distribution of workloads across service instances in order to increase reliability of the system substantially.</code></p><p><code>There are several projects that implement this technology. A few of them are HAProxy, nginx, Envoy, and Traefik. They all have their tradeoffs, but today I want to show the power of Traefik.<br><br>First, it will be helpful to discuss some recurring issues with a lot of reverse-proxies.<br></code></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.thehypervisor.blog/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption"><code>Thanks for reading The Hypervisor! Subscribe for free to receive new posts and support my work.</code></p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><ol><li><p><code>A lot of manual and static configuration is required to configure and maintain reverse-proxies.These two points can make developing distributed systems challenging. The reason why is because these systems need to be told what services running on a given host need to be connected to and fed traffic. Adding services may require complex configuration changes, and may also require the system to be taken down to bring on more services running on a host.</code></p><p></p></li><li><p><code>Enabling security protocols like SSL can be painful for the services added to the proxy. On load-balancers, there may be a large subsystem designed just for handling the certificates that a service handles, which means making direct changes to the host environment, requiring complex maintenance that can disrupt the services.</code></p><p></p></li></ol><p><code>Traefik does a beautiful job of handling these at the expense of a little bit more over-head than non-cloud optimized reverse-proxies like HAProxy and nginx.<br></code></p><p><code>Traefik has a very simple system for enabling a self-managing service easily, which we will do now. It runs on top of docker, and you manage it by making changes to a container management system like kubernetes or docker compose. This guide uses docker compose.<br><br>The requirements for running Traefik are relatively straightforward. Assuming you are running an ubuntu server, you can perform the following 3 steps to prep your system to run Traefik in a containerized environment:<br><br>1: Install ca-certificates and curl:</code></p><pre><code><code>sudo apt-get update &amp;&amp; sudo apt-get install -y ca-certificates curl</code></code></pre><p><code>2: Install docker and docker compose by following the guide. I would recommend using the apt method, but use whatever works best for you: https://docs.docker.com/desktop/setup/install/linux/ubuntu/<br><br>3: Install the docker packages:</code></p><pre><code><code>sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin</code></code></pre><p><code>Once you have performed these steps, you are all set to run Traefik.</code></p><p><code><br>There are a couple more steps for actually running Traefik, though. Those steps are to create a traefik and docker-compose configurations:<br><br>1: Create the traefik configuration:<br><br>The goal of this step is to set up a repository or directory such that it can pull and run a Traefik docker container in a proxy network and connect it to a service running on the same host.<br></code></p><p><code>In a base directory or repository, run the following:</code></p><pre><code><code>mkdir -p config

touch config/acme.json
chmod 600 config/acme.json

touch config/traefik.yml
chmod 644 config/traefik.yml</code></code></pre><p><code>and then place the following content in traefik.yml:</code></p><pre><code><code>entryPoints:
  web:
    address: ":80"
    http:
      redirections:
        entryPoint:
          to: websecure
          scheme: https

  websecure:
    address: ":443"

providers:
  docker:
    endpoint: "unix:///var/run/docker.sock"
    exposedByDefault: false
    network: proxy

certificatesResolvers:
  letsencrypt:
    acme:
      email: *your_email*
      storage: acme.json
      httpChallenge:
        entryPoint: web
</code></code></pre><p><code>&#8230;and make sure to replace your_email in the file with the email that you want to coordinate with letsencrypt.</code></p><p><code>After this has been completed, create a docker-compose.yml file in the same directory as the config directory, and place the following content in it:</code></p><pre><code><code>networks:

  proxy:
    external: true

services:

  traefik:
    image: traefik:v2.10
    container_name: traefik
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./config/traefik.yml:/traefik.yml:ro
      - ./config/acme.json:/acme.json
    networks:
      - proxy

  site:
    build: .
    image: site
    volumes:
      - .:/site/app
      - /site/app/node_modules
      - /site/app/.next
      - ./site/public:/usr/src/app/public
    networks:
      - proxy
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.myservice-http.rule=PathPrefix(`/`)"
      - "traefik.http.routers.myservice-http.entrypoints=web"
      - "traefik.http.routers.myservice-https.rule=PathPrefix(`/`)"
      - "traefik.http.routers.myservice-https.entrypoints=websecure"
      - "traefik.http.routers.myservice-https.tls=true"
      #- "traefik.http.routers.nextjs-https.tls.certresolver=letsencrypt"
      - "traefik.http.services.nextjs.loadbalancer.server.port=3000"

</code></code></pre><p><code>This docker compose configuration launches a Traefik container in the proxy network and passes the configuration that we just created to it. We also give it ports 80 and 443 from the host, because this example is running a web application and it needs HTTP and HTTPS ports. Notice that the certresolve label is commented out. The reason why is because we aren&#8217;t trying to forward traffic to a specific site to the app, we are just forwarding all traffec based on the http.rule and the https.rules give by the &#8216;/&#8217; above it.<br><br><br>After that we run the following to launch the configuration:</code></p><pre><code><code>docker network create proxy
docker build --force-rm -t site .
docker compose up</code></code></pre><p><code>Assuming that everything is set up properly, we should see that Traefik launches and handles everything from the configuration setup to coordinating with letsencrypt for enabling TLS for the traffic that we receive. We should see an output that looks similar to the following:</code></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pzgJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8cf3a33f-194f-4054-be76-90edd4503b16_1414x844.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pzgJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8cf3a33f-194f-4054-be76-90edd4503b16_1414x844.png 424w, https://substackcdn.com/image/fetch/$s_!pzgJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8cf3a33f-194f-4054-be76-90edd4503b16_1414x844.png 848w, https://substackcdn.com/image/fetch/$s_!pzgJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8cf3a33f-194f-4054-be76-90edd4503b16_1414x844.png 1272w, https://substackcdn.com/image/fetch/$s_!pzgJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8cf3a33f-194f-4054-be76-90edd4503b16_1414x844.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!pzgJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8cf3a33f-194f-4054-be76-90edd4503b16_1414x844.png" width="1414" height="844" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8cf3a33f-194f-4054-be76-90edd4503b16_1414x844.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:844,&quot;width&quot;:1414,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:128221,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pzgJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8cf3a33f-194f-4054-be76-90edd4503b16_1414x844.png 424w, https://substackcdn.com/image/fetch/$s_!pzgJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8cf3a33f-194f-4054-be76-90edd4503b16_1414x844.png 848w, https://substackcdn.com/image/fetch/$s_!pzgJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8cf3a33f-194f-4054-be76-90edd4503b16_1414x844.png 1272w, https://substackcdn.com/image/fetch/$s_!pzgJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8cf3a33f-194f-4054-be76-90edd4503b16_1414x844.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><code>Just to summarize, the beauty of Traefik is that we have a simple system for running and handling web applications and servers. Traefik enables me to host however many services I want, but in my case, it automatically handles my website&#8217;s encryption. This comes at the tradeoff of high-performance, but if your usecase is focused more on the features, then Traefik is an incredibly powerful tool that makes building and running a website simple.</code></p><p><code>The source code for this example can be downloaded and ran by doing the following:</code></p><pre><code><code>git clone https://github.com/leonematt/research
cd research/cloud/load-balancers/traefik/example
./install.sh
./run.sh</code></code></pre><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.thehypervisor.blog/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption"><code>Thanks for reading The Hypervisor! Subscribe for free to receive new posts and support my work.</code></p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Welcome to The Hypervisor!]]></title><description><![CDATA[This is my main blog for posting my notes and understanding of software systems.Thanks for reading The Hypervisor!]]></description><link>https://www.thehypervisor.blog/p/welcome-to-the-hypervisor</link><guid isPermaLink="false">https://www.thehypervisor.blog/p/welcome-to-the-hypervisor</guid><dc:creator><![CDATA[Matthew Leon]]></dc:creator><pubDate>Sat, 11 Jan 2025 06:47:34 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!eCSK!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf7f1646-9248-40c8-a717-6f1ed8bb8d61_800x800.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This is my main blog for posting my notes and understanding of software systems.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.thehypervisor.blog/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading The Hypervisor! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item></channel></rss>