<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kamlesh Bambarde</title>
    <description>The latest articles on DEV Community by Kamlesh Bambarde (@kamleshbambarde).</description>
    <link>https://dev.to/kamleshbambarde</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F388429%2Fe9995249-24b1-4b59-b13a-a9449718bae5.jpg</url>
      <title>DEV Community: Kamlesh Bambarde</title>
      <link>https://dev.to/kamleshbambarde</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kamleshbambarde"/>
    <language>en</language>
    <item>
      <title>Co-locating Data and Application Code for a 4.5x Performance Gain</title>
      <dc:creator>Kamlesh Bambarde</dc:creator>
      <pubDate>Tue, 30 Jun 2026 03:49:15 +0000</pubDate>
      <link>https://dev.to/kamleshbambarde/co-locating-data-and-application-code-for-a-45x-performance-gain-11o3</link>
      <guid>https://dev.to/kamleshbambarde/co-locating-data-and-application-code-for-a-45x-performance-gain-11o3</guid>
      <description>&lt;p&gt;Modern web application architectures typically run each layer in its own process, like a NodeJS server and database both running in their own processes. They communicate via a network connection or localhost socket. This separation introduces protocol overheads, TCP stack latency, and data serialization/deserialization costs on every single query.&lt;/p&gt;

&lt;p&gt;Planck is designed around the concept of Zero-Distance Architecture that co-locates data and application code. It combines the database engine and a WebAssembly application runtime into a single, unified process. By running your application code directly inside the database process, database calls become direct in-memory function calls rather than network round-trips.&lt;/p&gt;

&lt;p&gt;This article provides a practical guide to getting started with Planck. We will look at the core toolchain, walk through setting up a self-contained local benchmark, compare its performance against a NodeJS, ExpressJS, MongoDB stack, and look at how to build more complex features.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Toolchain: Planck, planctl, and Workbench
&lt;/h2&gt;

&lt;p&gt;Running and managing a zero-distance app requires three main components.&lt;/p&gt;

&lt;p&gt;Planck itself is the core binary. It functions as both the storage engine (a WiscKey-style, LSM-tree-based engine) and the WebAssembly host. Instead of running a database in one process and your application server in another, you run a single Planck process. It loads your compiled WebAssembly application directly into its memory, running it in the same process space as the database.&lt;/p&gt;

&lt;p&gt;To manage this runtime, you use planctl. This is the command-line tool for developers. It handles the compilation of your code, packages it, and deploys it to the Planck host. It also allows you to perform database operations, like creating stores and defining indexes, export/import, backup/restore directly from your terminal.&lt;/p&gt;

&lt;p&gt;Finally, there is the Workbench. This is a web console that comes built into the platform. It provides a visual dashboard to monitor your applications, view database metrics via dashboard, manage schemas, query data and schedule tasks such as backup, import/export, Wal Truncate, Garbage Collect etc. &lt;/p&gt;

&lt;h2&gt;
  
  
  Installing and Starting Planck Locally
&lt;/h2&gt;

&lt;p&gt;Before deploying applications, you need to install the Planck binaries, initialize the environment, and configure your local CLI profile. &lt;/p&gt;

&lt;h3&gt;
  
  
  1. Download and Extract the Binaries
&lt;/h3&gt;

&lt;p&gt;Download the archive matching your machine from the &lt;a href="https://github.com/plancksystems/plancks/releases" rel="noopener noreferrer"&gt;releases page&lt;/a&gt;. For macOS (local development), install it under your home directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; ~/.planck
&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-xzf&lt;/span&gt; ~/Downloads/planck-0.3.0-macos-arm64.tar.gz &lt;span class="nt"&gt;-C&lt;/span&gt; ~/.planck &lt;span class="nt"&gt;--strip-components&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, add the bin directory to your shell configuration (&lt;code&gt;~/.zshrc&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;&lt;span class="s2"&gt;/.planck/bin:&lt;/span&gt;&lt;span class="nv"&gt;$PATH&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reload your shell (&lt;code&gt;source ~/.zshrc&lt;/code&gt;) and verify the binaries are accessible:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;which planck planctl workbench
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Initialize the Host Services
&lt;/h3&gt;

&lt;p&gt;Run the system initialization. This is a one-time command that creates the directory layout, registers supervised services, and installs the internal identity database used by the Workbench:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;planctl system init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;(On macOS, this registers and starts launchd background agents; on Linux it uses systemd.)&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Create your CLI Developer Profile
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open your browser and navigate to the Workbench UI at &lt;a href="http://localhost:2369" rel="noopener noreferrer"&gt;http://localhost:2369&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Log in using the username &lt;code&gt;admin&lt;/code&gt; and the default key, which is shown right under the Connect button.&lt;/li&gt;
&lt;li&gt;Save this profile in your local configurations file at &lt;code&gt;~/.planctl/config.yaml&lt;/code&gt; so the command-line tool knows where to deploy your code:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;profiles&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;dev&lt;/span&gt;
    &lt;span class="na"&gt;nodes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;server&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;http://127.0.0.1:2369&lt;/span&gt;
        &lt;span class="na"&gt;uid&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;admin&lt;/span&gt;
        &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;UGxhbmNrX0RlZmF1bHRfQWRtaW5fS2V5XzAwMTA=&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Developer Experience: NodeJS vs. Zig on Planck
&lt;/h2&gt;

&lt;p&gt;A common concern with co-locating application code inside the database process using WebAssembly is that it might make the code complex or low-level. In practice, writing handlers in Zig using the Schnell framework is highly comparable to writing standard Express routes.&lt;/p&gt;

&lt;p&gt;Here is a side-by-side comparison of a simple route that fetches categories and returns them as HTML:&lt;/p&gt;

&lt;h3&gt;
  
  
  NodeJS and Express
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/categories&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;categories&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;categories&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;toArray&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;renderCategories&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;categories&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Zig and Schnell
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight zig"&gt;&lt;code&gt;&lt;span class="k"&gt;pub&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="n"&gt;handle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;?*&lt;/span&gt;&lt;span class="n"&gt;anyopaque&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;allocator&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Allocator&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;Response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;categories&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listCategories&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;allocator&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;html_fragment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="n"&gt;renderCategories&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;allocator&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;categories&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;html&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;html_fragment&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Schnell framework handles routing, request parsing, and response delivery. The build tool planctl automates the compilation of this code into WebAssembly, meaning you do not have to write manual WASM bindings or build configurations.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Benchmark: Planck-Pizzahub
&lt;/h2&gt;

&lt;p&gt;For a quick demonstration, we will use the planck-pizzahub performance benchmark located in the perf-compare directory. This project is ideal for getting started because it is completely self-contained. It requires no external integrations, which means you do not have to set up Google OAuth or Stripe keys to see it run.&lt;/p&gt;

&lt;p&gt;You can clone the repository from &lt;a href="https://github.com/plancksystems/perf-compare" rel="noopener noreferrer"&gt;perf-compare&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The repository contains two versions of the same service:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;planck-pizzahub: A Zig application running as a WebAssembly module inside Planck.&lt;/li&gt;
&lt;li&gt;express-pizzahub: A NodeJS and ExpressJS application running against a local MongoDB database.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Both implementations use the exact same seed dataset containing 17 categories and 201 products, and they serve the same HTML fragments formatted for the Datastar hypermedia framework.&lt;/p&gt;

&lt;h3&gt;
  
  
  Running express-pizzahub
&lt;/h3&gt;

&lt;p&gt;First, let us get the NodeJS version up and running. Make sure you have MongoDB running locally, then run the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;perf-compare/express-pizzahub
npm &lt;span class="nb"&gt;install
&lt;/span&gt;npm run seed
npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Express application will start listening on port 4000. You can test it by sending a request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl http://127.0.0.1:4000/categories
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Running planck-pizzahub
&lt;/h3&gt;

&lt;p&gt;Next, let us build and deploy the Planck version. Open a new terminal and run these commands from the planck-pizzahub directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;perf-compare/planck-pizzahub
planctl deploy &lt;span class="nt"&gt;--all&lt;/span&gt; &lt;span class="nt"&gt;--arch&lt;/span&gt; mono &lt;span class="nt"&gt;--profile&lt;/span&gt; dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command compiles the Zig source code into a WebAssembly module and uploads it to your local Planck server.&lt;/p&gt;

&lt;p&gt;Once deployed, you need to create the database stores and indexes. Run the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;planctl create store categories &lt;span class="nt"&gt;--profile&lt;/span&gt; dev
planctl create store products &lt;span class="nt"&gt;--profile&lt;/span&gt; dev

planctl create index products.ProductID &lt;span class="nt"&gt;--type&lt;/span&gt; i64 &lt;span class="nt"&gt;--profile&lt;/span&gt; dev
planctl create index products.CategoryID &lt;span class="nt"&gt;--type&lt;/span&gt; i64 &lt;span class="nt"&gt;--profile&lt;/span&gt; dev
planctl create index products.Name &lt;span class="nt"&gt;--type&lt;/span&gt; string &lt;span class="nt"&gt;--profile&lt;/span&gt; dev
planctl create index categories.CategoryID &lt;span class="nt"&gt;--type&lt;/span&gt; i64 &lt;span class="nt"&gt;--profile&lt;/span&gt; dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the database schema ready, you can now import the same seed data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;app/seed
planctl import &lt;span class="nt"&gt;--manifest&lt;/span&gt; import.categories.yaml &lt;span class="nt"&gt;--profile&lt;/span&gt; dev
planctl import &lt;span class="nt"&gt;--manifest&lt;/span&gt; import.products.yaml &lt;span class="nt"&gt;--profile&lt;/span&gt; dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Planck service will now be running on port 3020. You can test it using curl:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl http://127.0.0.1:3020/categories
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Running the Benchmark
&lt;/h2&gt;

&lt;p&gt;Now that both servers are running and populated with the same dataset, we can run a performance comparison using a load testing tool like oha.&lt;/p&gt;

&lt;p&gt;To test the NodeJS and MongoDB stack, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;oha &lt;span class="nt"&gt;-z&lt;/span&gt; 6s http://127.0.0.1:4000/categories
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To test the Planck stack, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;oha &lt;span class="nt"&gt;-z&lt;/span&gt; 6s http://127.0.0.1:3020/categories
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you compare the results, you will notice a substantial difference.&lt;/p&gt;

&lt;p&gt;Here is a comparison of typical results captured on a standard Apple M1 MacBook 8GB RAM and 256GB SSD under local testing:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Planck (WASM)&lt;/th&gt;
&lt;th&gt;Node + Express + MongoDB&lt;/th&gt;
&lt;th&gt;Ratio&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Requests per second&lt;/td&gt;
&lt;td&gt;24,949&lt;/td&gt;
&lt;td&gt;5,433&lt;/td&gt;
&lt;td&gt;4.59x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Average latency&lt;/td&gt;
&lt;td&gt;2.00 ms&lt;/td&gt;
&lt;td&gt;9.21 ms&lt;/td&gt;
&lt;td&gt;4.60x faster&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fastest response&lt;/td&gt;
&lt;td&gt;0.08 ms&lt;/td&gt;
&lt;td&gt;2.26 ms&lt;/td&gt;
&lt;td&gt;29x faster&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Slowest response&lt;/td&gt;
&lt;td&gt;54.65 ms&lt;/td&gt;
&lt;td&gt;109.91 ms&lt;/td&gt;
&lt;td&gt;2.0x better tail&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sustained throughput&lt;/td&gt;
&lt;td&gt;94.24 MiB/s&lt;/td&gt;
&lt;td&gt;20.49 MiB/s&lt;/td&gt;
&lt;td&gt;4.60x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Success rate&lt;/td&gt;
&lt;td&gt;100%&lt;/td&gt;
&lt;td&gt;100%&lt;/td&gt;
&lt;td&gt;same&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This performance gain is a direct consequence of the zero-distance architecture. Because the Zig application is co-located within the Planck process, database queries are simple in-memory function calls instead of network round-trips over localhost TCP sockets. The tail latency is also significantly lower and more stable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exploring Advanced Features with pizzaqsr-hda-mono
&lt;/h2&gt;

&lt;p&gt;While the pizzahub benchmark is a great way to verify raw performance, real-world applications require more complex features.&lt;/p&gt;

&lt;p&gt;If you want to see how Planck handles real-time updates and third-party integrations, look at the pizzaqsr-hda-mono sample app in &lt;a href="https://github.com/plancksystems/samples" rel="noopener noreferrer"&gt;repo&lt;/a&gt;. This project acts as a reference implementation for a complete  monolith, showcasing features such as:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Server-Sent Events (SSE): It leverages Planck's built-in SSE hub to push live order status updates directly to kitchen and delivery dashboards.&lt;/li&gt;
&lt;li&gt;Third-Party Authentication: It implements Google OAuth for user sign-in.&lt;/li&gt;
&lt;li&gt;Payments: It integrates Stripe checkout flows and handles Stripe webhook events.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can deploy and run this sample application using the same planctl workflow. It serves as a blueprint for building modern hypermedia apps using Datastar and Planck.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>database</category>
      <category>performance</category>
      <category>datastardev</category>
    </item>
    <item>
      <title>Performance Comparison of C#, Node, Java, Go &amp; Rust on k8s</title>
      <dc:creator>Kamlesh Bambarde</dc:creator>
      <pubDate>Sun, 26 Nov 2023 07:52:34 +0000</pubDate>
      <link>https://dev.to/kamleshbambarde/performance-comparison-of-c-node-java-go-rust-5gbh</link>
      <guid>https://dev.to/kamleshbambarde/performance-comparison-of-c-node-java-go-rust-5gbh</guid>
      <description>&lt;p&gt;In continuation to my &lt;a href="https://dev.to/rustoncloud/sustainable-cloud-computing-using-rust-language-4m82"&gt;earlier post&lt;/a&gt; about using Rust Language for sustainable cloud computing, here, in this post, I would like to present comparison of facts like the CPU &amp;amp; Memory utilisation by languages like C#, NodeJS, Java, Go &amp;amp; Rust on k8s. &lt;/p&gt;

&lt;p&gt;To perform this comparative study, I developed very basic Rest Api's in all these languages that serve exactly similar kind of data. All these Rest Api's are built based on the project template of ASP.Net Core Web Api, yes, the WeatherForeCast, containerised, deployed to Kubernetes and exposed using NGINX Ingress Controller.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Frameworks Used&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Language&lt;/th&gt;
&lt;th&gt;Framework&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;C#&lt;/td&gt;
&lt;td&gt;ASP.Net Core&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Java&lt;/td&gt;
&lt;td&gt;SpringBoot&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Node&lt;/td&gt;
&lt;td&gt;ExpressJS&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Go&lt;/td&gt;
&lt;td&gt;Fiber&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rust&lt;/td&gt;
&lt;td&gt;Warp&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Test Environment;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Apple MacBook Air M1 with 8GB RAM&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://microk8s.io/" rel="noopener noreferrer"&gt;Microk8s&lt;/a&gt; by Canonical &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/wg/wrk" rel="noopener noreferrer"&gt;wrk&lt;/a&gt; for Stress Testing &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;k8s Deployment Resource Limits;&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Language&lt;/th&gt;
&lt;th&gt;Request CPU&lt;/th&gt;
&lt;th&gt;Request Memory&lt;/th&gt;
&lt;th&gt;Limit CPU&lt;/th&gt;
&lt;th&gt;Limit Memory&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;C#&lt;/td&gt;
&lt;td&gt;250m&lt;/td&gt;
&lt;td&gt;32M&lt;/td&gt;
&lt;td&gt;500m&lt;/td&gt;
&lt;td&gt;64M&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Java&lt;/td&gt;
&lt;td&gt;250m&lt;/td&gt;
&lt;td&gt;128M&lt;/td&gt;
&lt;td&gt;500m&lt;/td&gt;
&lt;td&gt;256M&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Node&lt;/td&gt;
&lt;td&gt;250m&lt;/td&gt;
&lt;td&gt;32M&lt;/td&gt;
&lt;td&gt;500m&lt;/td&gt;
&lt;td&gt;64M&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Go&lt;/td&gt;
&lt;td&gt;250m&lt;/td&gt;
&lt;td&gt;32M&lt;/td&gt;
&lt;td&gt;500m&lt;/td&gt;
&lt;td&gt;64M&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rust&lt;/td&gt;
&lt;td&gt;250m&lt;/td&gt;
&lt;td&gt;32M&lt;/td&gt;
&lt;td&gt;500m&lt;/td&gt;
&lt;td&gt;64M&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Stress Test Parameters&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Threads - 12&lt;/li&gt;
&lt;li&gt;Connections - 400&lt;/li&gt;
&lt;li&gt;Duration - 30 Seconds&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Stress Test Results&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Language&lt;/th&gt;
&lt;th&gt;Total Requests&lt;/th&gt;
&lt;th&gt;Throughput&lt;/th&gt;
&lt;th&gt;Data Received&lt;/th&gt;
&lt;th&gt;Transfer Rate&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;C#&lt;/td&gt;
&lt;td&gt;451463&lt;/td&gt;
&lt;td&gt;15006/sec&lt;/td&gt;
&lt;td&gt;288MB&lt;/td&gt;
&lt;td&gt;9.56MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Java&lt;/td&gt;
&lt;td&gt;57992&lt;/td&gt;
&lt;td&gt;1928/sec&lt;/td&gt;
&lt;td&gt;41MB&lt;/td&gt;
&lt;td&gt;1.35MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Node&lt;/td&gt;
&lt;td&gt;104504&lt;/td&gt;
&lt;td&gt;3472/sec&lt;/td&gt;
&lt;td&gt;67MB&lt;/td&gt;
&lt;td&gt;2.23MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Go&lt;/td&gt;
&lt;td&gt;595449&lt;/td&gt;
&lt;td&gt;19815/sec&lt;/td&gt;
&lt;td&gt;392MB&lt;/td&gt;
&lt;td&gt;13.05MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rust&lt;/td&gt;
&lt;td&gt;672391&lt;/td&gt;
&lt;td&gt;22344/sec&lt;/td&gt;
&lt;td&gt;467MB&lt;/td&gt;
&lt;td&gt;15.52MB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Resource Utilisation in Idle and Stressed State&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Language&lt;/th&gt;
&lt;th&gt;Idle CPU&lt;/th&gt;
&lt;th&gt;Idle Memory&lt;/th&gt;
&lt;th&gt;Stressed CPU&lt;/th&gt;
&lt;th&gt;Stressed Memory&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;C#&lt;/td&gt;
&lt;td&gt;1m&lt;/td&gt;
&lt;td&gt;35Mi&lt;/td&gt;
&lt;td&gt;483m&lt;/td&gt;
&lt;td&gt;45Mi&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Java&lt;/td&gt;
&lt;td&gt;1m&lt;/td&gt;
&lt;td&gt;129Mi&lt;/td&gt;
&lt;td&gt;500m&lt;/td&gt;
&lt;td&gt;228Mi&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Node&lt;/td&gt;
&lt;td&gt;1m&lt;/td&gt;
&lt;td&gt;30Mi&lt;/td&gt;
&lt;td&gt;500m&lt;/td&gt;
&lt;td&gt;41Mi&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Go&lt;/td&gt;
&lt;td&gt;1m&lt;/td&gt;
&lt;td&gt;7Mi&lt;/td&gt;
&lt;td&gt;465m&lt;/td&gt;
&lt;td&gt;17Mi&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rust&lt;/td&gt;
&lt;td&gt;0m&lt;/td&gt;
&lt;td&gt;0Mi&lt;/td&gt;
&lt;td&gt;352m&lt;/td&gt;
&lt;td&gt;9Mi&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Observations&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;All the Rest Api's that I deployed to k8s, k8s was able to spin up the pods, but not Java SpringBoot based Rest Api pod. k8s was failing to spin up the Java SpringBoot based Rest Api pod for [OOMKilled] error, I had to then increase the memory from request 32M to 128M and limit from 64M to 256M. Despite the fact that SpringBoot deployment was configured with more memory than other deployments, its worst in throughput.&lt;/p&gt;

&lt;p&gt;To my pleasant surprise ASP.Net Core pod was able to run with request memory of 32M and limit memory of 64M and much better throughput as compared to SpringBoot. Microsoft has definitely done a tremendous job at improving .NET Runtime in terms of the memory requirements and its utilisation even the garbage collection post stress test was faster than Java.&lt;/p&gt;

&lt;p&gt;In an idle state all the frameworks were consistently eating up 1m core of CPU and that's the need of GC background thread, where as Rust was 0m.&lt;/p&gt;

&lt;p&gt;Go Fiber implementation was somewhere closer to Rust Warp implementation from throughput perspective, was consuming close to 25% more CPU.&lt;/p&gt;

&lt;p&gt;Node Express based Rest Api was much better compared to SpringBoot based Api, almost double the throughput.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What can you build using Rust?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Rust can be used to develop applications for cloud, Microservices, Azure Functions, AWS Lambdas. There are number of Rust Crates (packages) available to build applications for cloud, some of the widely used ones are listed below.&lt;/p&gt;

&lt;p&gt;Web Frameworks&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://crates.io/crates/warp" rel="noopener noreferrer"&gt;Warp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://crates.io/crates/axum" rel="noopener noreferrer"&gt;Axum&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://crates.io/crates/actix-web" rel="noopener noreferrer"&gt;Actix&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://crates.io/crates/rocket" rel="noopener noreferrer"&gt;Rocket&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://crates.io/crates/tide" rel="noopener noreferrer"&gt;Tide&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ORM&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://crates.io/crates/diesel" rel="noopener noreferrer"&gt;Diesel&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://crates.io/crates/sea-orm" rel="noopener noreferrer"&gt;SeaORM&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Database Clients&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://crates.io/crates/sqlx" rel="noopener noreferrer"&gt;SQLX&lt;/a&gt; (supports MS Sql, MySql, PostGres &amp;amp; SqlLite)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Additionally, both Amazon and Microsoft has sdk for Rust to utilise services from their respective cloud platforms. Microsofts Azure sdk for Rust is part of Azure organisation on GitHub, but it's, still under heavy development and not official yet.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/Azure/azure-sdk-for-rust" rel="noopener noreferrer"&gt;Azure sdk for Rust&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/awslabs/aws-sdk-rust" rel="noopener noreferrer"&gt;AWS sdk for Rust&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Is it easy to adopt Rust?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No, not at all, Rust is a language that has a very steep learning curve, lot of new stuff at conceptual level. &lt;/p&gt;

&lt;p&gt;Not very long ago, Java too, was considered little difficult adopt for people who were trying to shift from procedural languages to Java. But with proper trainings and mentoring, people gained the required level of skills, so, the same is applicable to Rust.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As you can clearly make out from the about test results, that Rust outperforms every other language &amp;amp; framework in both throughput and resource utilization. &lt;/p&gt;

&lt;p&gt;Languages like, Java, C#.NET, JS on Backend have served their purpose in an era where the world was getting into the internet based apps from desktop based apps. Now, that most of the IT workloads are moving to Cloud, it has become imperative to use modern languages like Rust that uses less resources, saves compute cost on cloud and more importantly, emits less carbon which results in to a lesser impact to our planet.&lt;/p&gt;

&lt;p&gt;You can get all the source code and k8s manifests in my Git Repository, request me in comments for the same.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Sustainable Cloud Computing Using Rust Language</title>
      <dc:creator>Kamlesh Bambarde</dc:creator>
      <pubDate>Sun, 26 Nov 2023 07:51:45 +0000</pubDate>
      <link>https://dev.to/kamleshbambarde/sustainable-cloud-computing-using-rust-language-4m82</link>
      <guid>https://dev.to/kamleshbambarde/sustainable-cloud-computing-using-rust-language-4m82</guid>
      <description>&lt;p&gt;Sustainable Cloud Computing is an ecologically conscious and sustainable method to utilise cloud computing resources. Its main objective is to reduce the energy consumption by various cloud services and thereby the environmental effect of data centers.&lt;br&gt;
Sustainable cloud computing benefits not only the environment but also organisations that rely on cloud services. By using environmentally friendly Platforms/Frameworks/Languages to build their services to run on cloud platforms, businesses can align their IT infrastructure with their sustainability goals and potentially reduce operational costs. It’s also an essential part of the broader effort to address the environmental impact of the IT industry and promote a more sustainable future.&lt;br&gt;
Following are some of the Key principals of Sustainable Cloud Computing, where Rust can help achieve maximum benefits.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Energy Efficiency&lt;/li&gt;
&lt;li&gt;Resource Management&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Rust Language&lt;/strong&gt;&lt;br&gt;
Rust, a systems programming language developed at Mozilla by Graydon Hoare back in 2006. It was heavily influenced by the ideas from functional programming like immutability and algebraic data types etc. Though, Rust was mainly developed as a replacement of C++, but over the period of time it has acquired a convenience of high-level languages, which makes it possible to be used for the development of services that run on cloud platforms.&lt;br&gt;
Following are some of the reasons for which Rust is increasingly being used in the context of sustainable cloud computing:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Performance and Efficiency:&lt;/strong&gt; Rust is made to guarantee memory safety while offering low-level control over system resources. It is therefore a cost-effective option for developing services that run under cloud environment. Efficiency is a significant consideration in sustainable cloud computing since it may assist reduce energy consumption and optimize resource usage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Memory Safety:&lt;/strong&gt; Rust’s ownership and borrowing model of memory management can significantly help eliminate issues like null pointer dereferences and data races. The memory safety provided by Rust, enables developers to fearlessly write concurrent code that is both safe and efficient. As a result, there may be less need for resource-intensive error handling and debugging, leading to more stable and dependable cloud services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Energy Efficiency:&lt;/strong&gt; Rust’s emphasis on performance frequently results in code that uses less energy. Rust can contribute to lowering the overall energy usage of cloud services by decreasing the computational resources needed to complete activities. This is one of the most impending reasons for choosing Rust over other languages to develop services that run on Cloud Platforms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reduce Resource Consumption:&lt;/strong&gt; Rust’s resource management features can assist developers in making the best use of CPU, memory, and other resources, therefore reducing the environmental impact.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scalability:&lt;/strong&gt; Rust’s architecture makes it ideal for creating scalable and highly concurrent systems, which are critical in cloud computing environments. Minimising the number of CPUs and amount of RAM needed can help significantly reduce the overall environmental impact of cloud computing.&lt;br&gt;
Long-Term Maintainability: Long-term software system sustainability is a component of sustainable cloud computing. Because of its robust type system and emphasis on memory safety, Rust can facilitate the evolution and maintenance of services that run in a cloud environment over time, minimising the need for resource-intensive rewrites or replacements.&lt;br&gt;
Open Source Ecosystem: Rust has a strong open-source community and ecosystem, which can foster the development of sustainable cloud computing solutions and encourage collaboration on eco-friendly initiatives.&lt;/p&gt;

&lt;p&gt;In the &lt;a href="https://dev.to/rustoncloud/performance-comparison-of-c-node-java-go-rust-5gbh"&gt;next part&lt;/a&gt; of we will look at the evidence of how Rust is better compared to other languages from the perspective of resource utilisation and efficiency.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
