<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>Muthu Palaniyappan Olagappan</title>
    <subtitle>Software Engineer at Appian. Writing about computer science, engineering and learnings.</subtitle>
    <link rel="self" type="application/atom+xml" href="https://muthupalaniyappan.com/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://muthupalaniyappan.com"/>
    <logo>https://muthupalaniyappan.com/icons/brand.jpg</logo>
    <icon>https://muthupalaniyappan.com/icons/brand.jpg</icon>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-11-25T00:00:00+00:00</updated>
    <id>https://muthupalaniyappan.com/atom.xml</id>
    <entry xml:lang="en">
        <title>exec-wrap-mcp: Give your AI agent a terminal that remembers</title>
        <published>2026-11-25T00:00:00+00:00</published>
        <updated>2026-11-25T00:00:00+00:00</updated>
        <author>
          <name>
            Muthu Palaniyappan Olagappan
          </name>
        </author>
        <link rel="alternate" type="text/html" href="https://muthupalaniyappan.com/blog/exec-wrap-mcp/"/>
        <id>https://muthupalaniyappan.com/blog/exec-wrap-mcp/</id>
        <content type="html" xml:base="https://muthupalaniyappan.com/blog/exec-wrap-mcp/">&lt;h2 id=&quot;the-result-first&quot;&gt;The result first&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;exec-wrap-mcp&lt;/code&gt; is a single Go binary that lets an AI agent launch an interactive program once, such as &lt;code&gt;/bin/bash&lt;/code&gt;, &lt;code&gt;lldb&lt;/code&gt; or a Python REPL, and keep talking to it across many tool calls. State survives: &lt;code&gt;export ONE=1&lt;/code&gt; in one call, &lt;code&gt;echo $ONE&lt;/code&gt; in the next, and you get &lt;code&gt;1&lt;/code&gt;. It runs on Linux, macOS and Windows, speaks the &lt;a rel=&quot;external&quot; href=&quot;https://modelcontextprotocol.io&quot;&gt;Model Context Protocol&lt;/a&gt; over stdio, and is MIT licensed. Code and releases: &lt;a rel=&quot;external&quot; href=&quot;https://github.com/Muthu-Palaniyappan-OL/exec-wrap-mcp&quot;&gt;github.com/Muthu-Palaniyappan-OL/exec-wrap-mcp&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;the-problem&quot;&gt;The problem&lt;/h2&gt;
&lt;p&gt;Most “run a command” tools for agents start a fresh process on every call, so everything the program knew is gone when it exits:&lt;/p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;text&quot;&gt;call 1:  export ONE=1     -&amp;gt; new bash, sets ONE, exits
call 2:  echo $ONE        -&amp;gt; new bash, prints an empty line
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That breaks &lt;code&gt;cd&lt;/code&gt;, virtualenvs, &lt;code&gt;ssh&lt;/code&gt; sessions, &lt;code&gt;gdb&lt;/code&gt; breakpoints, open database transactions, and a Python REPL that already loaded your dataset. Anywhere the state is the point, the agent has to replay everything on each call or give up.&lt;/p&gt;
&lt;h2 id=&quot;the-idea&quot;&gt;The idea&lt;/h2&gt;
&lt;p&gt;Wrap the program instead of re-running it. &lt;code&gt;exec-wrap-mcp&lt;/code&gt; starts the program inside a pseudo-terminal, keeps it running, and exposes it to the agent as a &lt;strong&gt;session&lt;/strong&gt; with an id. The agent sends input to the session and gets the output back.&lt;/p&gt;
&lt;p&gt;It is not specific to shells. Anything that reads lines and prints a prompt works, and I tested bash, the Python REPL and lldb. Many sessions can run at the same time, and each one has its own state.&lt;/p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Wrap this&lt;/th&gt;&lt;th&gt;So the agent can&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;bash&lt;/code&gt;, &lt;code&gt;zsh&lt;/code&gt;, &lt;code&gt;sh&lt;/code&gt;, &lt;code&gt;cmd.exe&lt;/code&gt;, &lt;code&gt;pwsh&lt;/code&gt;&lt;/td&gt;&lt;td&gt;keep &lt;code&gt;cd&lt;/code&gt;, env vars, virtualenvs and background jobs&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;gdb&lt;/code&gt;, &lt;code&gt;lldb&lt;/code&gt;&lt;/td&gt;&lt;td&gt;set breakpoints, step and inspect over many turns&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;python3&lt;/code&gt;, &lt;code&gt;node&lt;/code&gt;&lt;/td&gt;&lt;td&gt;build up state in a REPL&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;psql&lt;/code&gt;, &lt;code&gt;mysql&lt;/code&gt;, &lt;code&gt;sqlite3&lt;/code&gt;&lt;/td&gt;&lt;td&gt;run a transaction across several calls&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ssh host&lt;/code&gt;, &lt;code&gt;docker exec -it c sh&lt;/code&gt;&lt;/td&gt;&lt;td&gt;work on a remote box without reconnecting&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;h2 id=&quot;install&quot;&gt;Install&lt;/h2&gt;
&lt;p&gt;With Go 1.25 or newer:&lt;/p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;sh&quot;&gt;go install github.com/Muthu-Palaniyappan-OL/exec-wrap-mcp@latest
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or download a binary for Linux, macOS or Windows (amd64 and arm64) from the &lt;a rel=&quot;external&quot; href=&quot;https://github.com/Muthu-Palaniyappan-OL/exec-wrap-mcp/releases&quot;&gt;releases page&lt;/a&gt;. Every release ships a &lt;code&gt;checksums.txt&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Then add it to your MCP client. The entry is the same everywhere:&lt;/p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;json&quot;&gt;{
  &amp;quot;mcpServers&amp;quot;: {
    &amp;quot;exec-wrap&amp;quot;: { &amp;quot;command&amp;quot;: &amp;quot;exec-wrap-mcp&amp;quot; }
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For Claude Code it is one line: &lt;code&gt;claude mcp add exec-wrap -- exec-wrap-mcp&lt;/code&gt;. Kiro, Cursor, VS Code and Claude Desktop take the JSON above in their own MCP config file.&lt;/p&gt;
&lt;h2 id=&quot;seven-tools&quot;&gt;Seven tools&lt;/h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Tool&lt;/th&gt;&lt;th&gt;What it does&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;launch&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Start a program as a session. Returns &lt;code&gt;session_id&lt;/code&gt; and the first output.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;send&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Write input, flush it, and return the output it produced.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;read&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Fetch pending output without sending anything.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;signal&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Ctrl-C (&lt;code&gt;interrupt&lt;/code&gt;), Ctrl-D (&lt;code&gt;eof&lt;/code&gt;), &lt;code&gt;terminate&lt;/code&gt;, &lt;code&gt;kill&lt;/code&gt;, &lt;code&gt;suspend&lt;/code&gt;.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;resize&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Change the terminal size.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;list&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Show all sessions and their state.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;kill&lt;/code&gt;&lt;/td&gt;&lt;td&gt;End a session, gracefully first, forced after a grace period.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;h2 id=&quot;a-real-session&quot;&gt;A real session&lt;/h2&gt;
&lt;p&gt;This is the actual output from the released binary, with one call per line. The &lt;code&gt;output&lt;/code&gt; and &lt;code&gt;done_reason&lt;/code&gt; fields are the interesting part.&lt;/p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;text&quot;&gt;launch  {&amp;quot;command&amp;quot;: &amp;quot;/bin/bash&amp;quot;}
        -&amp;gt; session_id &amp;quot;s_7fc971c5&amp;quot;, tty_mode &amp;quot;pty&amp;quot;, done_reason &amp;quot;prompt&amp;quot;

send    {&amp;quot;input&amp;quot;: &amp;quot;export ONE=1&amp;quot;}
        -&amp;gt; output &amp;quot;&amp;quot;,  done_reason &amp;quot;prompt&amp;quot;, last_exit_status 0, 25 ms

send    {&amp;quot;input&amp;quot;: &amp;quot;echo $ONE&amp;quot;}
        -&amp;gt; output &amp;quot;1&amp;quot;, done_reason &amp;quot;prompt&amp;quot;, last_exit_status 0, 26 ms

send    {&amp;quot;input&amp;quot;: &amp;quot;ls /nonexistent&amp;quot;}
        -&amp;gt; output &amp;quot;ls: /nonexistent: No such file or directory&amp;quot;,
           last_exit_status 1, 37 ms

send    {&amp;quot;input&amp;quot;: &amp;quot;sleep 2; echo finished&amp;quot;, &amp;quot;wait&amp;quot;: {&amp;quot;timeout_ms&amp;quot;: 500}}
        -&amp;gt; output &amp;quot;&amp;quot;, done_reason &amp;quot;timeout&amp;quot;        (still running)

read    {&amp;quot;wait&amp;quot;: {&amp;quot;timeout_ms&amp;quot;: 5000}}
        -&amp;gt; output &amp;quot;finished&amp;quot;, done_reason &amp;quot;prompt&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The second call is the whole point: the environment variable set in call 1 is still there in call 2. The last two calls show what happens with a slow command. &lt;code&gt;send&lt;/code&gt; gives up waiting after the timeout, the process keeps running, and &lt;code&gt;read&lt;/code&gt; collects the rest.&lt;/p&gt;
&lt;h2 id=&quot;the-hard-part-knowing-when-a-command-is-done&quot;&gt;The hard part: knowing when a command is done&lt;/h2&gt;
&lt;p&gt;A terminal never announces “this command finished”. If you return too early you lose output, and if you wait too long every call feels slow. &lt;code&gt;send&lt;/code&gt; returns on the first of these:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;exited&lt;/code&gt;&lt;/strong&gt;: the process ended. You get the remaining output and the exit code.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;until&lt;/code&gt;&lt;/strong&gt;: your own &lt;code&gt;until_regex&lt;/code&gt; matched, for example &lt;code&gt;&quot;Listening on port&quot;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;prompt&lt;/code&gt;&lt;/strong&gt;: the program printed its prompt again. This is the normal, precise case.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;idle&lt;/code&gt;&lt;/strong&gt;: no new output for a while, the fallback for programs without a known prompt.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;timeout&lt;/code&gt;&lt;/strong&gt;: the hard limit elapsed. The process keeps running.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For shells I did not want to guess at &lt;code&gt;$ &lt;/code&gt;, because a command can print that too. At launch the server switches bash, sh or zsh to a private prompt: an invisible record-separator character wrapped around the last exit status. The server strips it from the output and reports the number as &lt;code&gt;last_exit_status&lt;/code&gt;. Bash and zsh also start without line editing and with terminal echo off, so the output comes back clean, with no echoed input and no escape sequences.&lt;/p&gt;
&lt;p&gt;Other programs use built-in presets: &lt;code&gt;(gdb) &lt;/code&gt;, &lt;code&gt;(lldb) &lt;/code&gt;, &lt;code&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/code&gt;, &lt;code&gt;postgres=# &lt;/code&gt;, &lt;code&gt;&amp;gt; &lt;/code&gt; for Node, and the &lt;code&gt;cmd&lt;/code&gt; and PowerShell prompts. For anything else, pass your own &lt;code&gt;prompt_regex&lt;/code&gt; on &lt;code&gt;launch&lt;/code&gt;, or rely on idle detection.&lt;/p&gt;
&lt;h2 id=&quot;try-it-with-a-debugger&quot;&gt;Try it with a debugger&lt;/h2&gt;
&lt;p&gt;The end-to-end tests include lldb, because it is the case that shows why persistence matters. Calls like these keep the debugger’s state across turns:&lt;/p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;text&quot;&gt;launch  {&amp;quot;command&amp;quot;: &amp;quot;lldb&amp;quot;, &amp;quot;args&amp;quot;: [&amp;quot;./a.out&amp;quot;]}
send    {&amp;quot;input&amp;quot;: &amp;quot;breakpoint set --name main&amp;quot;}
send    {&amp;quot;input&amp;quot;: &amp;quot;run&amp;quot;}
send    {&amp;quot;input&amp;quot;: &amp;quot;bt&amp;quot;}
send    {&amp;quot;input&amp;quot;: &amp;quot;frame variable&amp;quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then ask your agent something like: &lt;em&gt;“Launch lldb on &lt;code&gt;./a.out&lt;/code&gt;, break on &lt;code&gt;main&lt;/code&gt;, run, and show me the backtrace after the crash.”&lt;/em&gt; It no longer has to rebuild a debugger session from scratch on every step.&lt;/p&gt;
&lt;h2 id=&quot;things-i-got-right-on-purpose&quot;&gt;Things I got right on purpose&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;No orphans.&lt;/strong&gt; Every session is its own process group, and closing the server terminates all of them. I checked this by closing the client’s end of the pipe and looking for leftover processes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Bounded memory.&lt;/strong&gt; Output is buffered per session up to 4 MiB, and each response is capped at 64 KiB by default. When a response is too long, the server keeps the first 25% and last 75% and says how many bytes it dropped in between.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Clean text.&lt;/strong&gt; Escape sequences are stripped by default, and carriage returns and backspaces are applied the way a terminal would, so progress bars do not turn into noise.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Many sessions, no mixing.&lt;/strong&gt; Two sessions never share state, and a second call into a session that is busy returns a &lt;code&gt;busy&lt;/code&gt; error instead of interleaving.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Real tests.&lt;/strong&gt; The tests build the actual binary and drive it with the MCP client from the Go SDK, the same way an AI client would. Linux runs them on every change, and macOS and Windows run weekly and on demand.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;safety&quot;&gt;Safety&lt;/h2&gt;
&lt;p&gt;This server runs arbitrary programs as your user. That is the feature, and it is also the risk, so treat it like handing the agent a shell.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It speaks stdio only. There is no network listener and no open port.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;launch&lt;/code&gt; takes an executable and arguments, never a shell string, so the server adds no injection surface of its own.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--allow-command &apos;/usr/bin/*&apos;&lt;/code&gt; restricts which programs can start (repeatable). &lt;code&gt;--max-sessions&lt;/code&gt;, &lt;code&gt;--idle-ttl&lt;/code&gt; and &lt;code&gt;--clean-env&lt;/code&gt; bound the rest.&lt;/li&gt;
&lt;li&gt;Input and output are not logged unless you pass &lt;code&gt;--log-io&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Keep human approval of tool calls on in your MCP client, and use a container or VM for untrusted work. There is no sandbox.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;what-it-does-not-do&quot;&gt;What it does not do&lt;/h2&gt;
&lt;p&gt;It reads a line-oriented stream, so full-screen programs like &lt;code&gt;vim&lt;/code&gt; and &lt;code&gt;htop&lt;/code&gt; are out of scope. Pagers are disabled by default (&lt;code&gt;PAGER=cat&lt;/code&gt;, &lt;code&gt;TERM=dumb&lt;/code&gt;) for the same reason.&lt;/p&gt;
&lt;h2 id=&quot;how-it-is-maintained&quot;&gt;How it is maintained&lt;/h2&gt;
&lt;p&gt;Dependabot checks the Go modules daily and the GitHub Actions weekly. Its pull requests merge themselves once CI passes. The first run already did this for a real case: &lt;code&gt;golang.org/x/crypto&lt;/code&gt; had 13 open security advisories, and the fix PR merged without anyone touching it. Releases follow semantic versioning, and &lt;code&gt;go install&lt;/code&gt; and the release binaries are both built from tags.&lt;/p&gt;
&lt;h2 id=&quot;try-it&quot;&gt;Try it&lt;/h2&gt;
&lt;p&gt;Start with the install line, point your MCP client at it, and ask your agent to open a bash session, set a variable, and read it back. If it prints the value, everything else (debuggers, REPLs, database shells) works the same way. Issues and ideas are welcome on &lt;a rel=&quot;external&quot; href=&quot;https://github.com/Muthu-Palaniyappan-OL/exec-wrap-mcp&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Hydrator: Making EBS snapshot restoration faster through prewarming</title>
        <published>2026-11-11T00:00:00+00:00</published>
        <updated>2026-11-11T00:00:00+00:00</updated>
        <author>
          <name>
            Muthu Palaniyappan Olagappan
          </name>
        </author>
        <link rel="alternate" type="text/html" href="https://muthupalaniyappan.com/blog/hydrator/"/>
        <id>https://muthupalaniyappan.com/blog/hydrator/</id>
        <content type="html" xml:base="https://muthupalaniyappan.com/blog/hydrator/">&lt;h2 id=&quot;making-ebs-snapshot-restoration-faster-through-prewarming&quot;&gt;Making EBS Snapshot Restoration Faster Through Prewarming&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;By Muthu Palaniyappan Olagappan · 5 min read&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&quot;executive-summary&quot;&gt;Executive Summary&lt;/h2&gt;
&lt;p&gt;Restoring an Amazon Elastic Block Store (EBS) volume from a snapshot does not necessarily mean every block will be ready when an application first accesses it. Depending on the volume and its initialization state, early filesystem operations and file reads can incur additional latency as data is made available.&lt;/p&gt;
&lt;p&gt;Consider restoring an Appian environment from a snapshot. When services start and begin accessing files on the restored volume, these initial operations can take longer than expected, delaying environment readiness. In our investigation, we explored whether we could reduce this overhead by preparing the filesystem metadata and file data the application needs, rather than always reading an entire volume.&lt;/p&gt;
&lt;p&gt;This led us to Hydrator, an approach that combines filesystem scanning and targeted file prewarming. Using this approach, we reduced our Appian Engine startup time on a cold EBS volume from up to 90 minutes down to 10 minutes for customer sites with large volumes (&amp;gt;40GB) of engine data. This Hydrator method is 8x faster than the AWS suggested method.&lt;/p&gt;
&lt;h2 id=&quot;understanding-the-cold-ebs-problem&quot;&gt;Understanding the Cold EBS Problem&lt;/h2&gt;
&lt;p&gt;To understand the problem, we need to look at two distinct sources of delay.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Unresponsive file system on cold EBS.&lt;/strong&gt; When I ran &lt;code&gt;ls -al&lt;/code&gt; on a freshly started EBS volume, it took 6m 38s. Rerunning the same command took 11.4s. The first run took that long because it had to restore inode information for all files from S3 and store it in local EBS blocks, and it restored them sequentially, one block at a time. Each S3 read IO call takes 100ms. This means a script that lists files in a folder on a cold volume can take a long time.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Slow reads of large files on cold EBS.&lt;/strong&gt; The file and the file system are restored from S3 block by block. If a program scans large files, it can take a long time to scan the whole file.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;solutions-offered-by-aws&quot;&gt;Solutions Offered by AWS&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Using &lt;code&gt;dd&lt;/code&gt;/&lt;code&gt;fio&lt;/code&gt; to read the entire volume.&lt;/strong&gt; Prewarming the entire disk is inefficient just to start some apps on cold EBS. Many apps only need some files to be warm to start faster.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Fast Snapshot Restore (FSR).&lt;/strong&gt; AWS can provide a fully hot EBS volume snapshot using FSR, but it takes 1 hour per TiB of snapshot to become FSR ready. We could not afford to wait that long.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Faster volume initialization rate.&lt;/strong&gt; AWS can initialize an EBS volume faster by raising the initialization rate from 100 MiB/s to 300 MiB/s, but this does not guarantee that the files you need are initialized first.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Since the above methods did not help Appian, we developed the Hydrator CLI.&lt;/p&gt;
&lt;h2 id=&quot;basics-understanding-the-limits-of-ebs&quot;&gt;Basics: Understanding the Limits of EBS&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;/hydrator/ebs-limits.png&quot; alt=&quot;Chart of EBS volume read throughput limits, showing the 2 KB to 512 KB block ratio that bounds sequential reads&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Only four variables control EBS and its behavior:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Volume type&lt;/strong&gt; (io2 or gp3).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;IOPS&lt;/strong&gt; (gp3: 3,000–80,000).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Throughput&lt;/strong&gt; (125 MB/s–2,000 MB/s).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Initialization rate&lt;/strong&gt; (100 MiB/s–300 MiB/s).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;IOPS is the number of I/O calls executed in one second. Throughput is the amount of data you can read from EBS. io2 is the costly volume type and gp3 is the cheaper one. We should maximize the use of the variables we can control.&lt;/p&gt;
&lt;h2 id=&quot;how-to-prewarm-a-cold-file-system-on-ebs&quot;&gt;How to Prewarm a Cold File System on EBS&lt;/h2&gt;
&lt;p&gt;The solution is to use &lt;code&gt;fd&lt;/code&gt;. &lt;code&gt;fd&lt;/code&gt; is a multi-threaded &lt;code&gt;find&lt;/code&gt;, so it can scan all the required directories quickly. Once the directory entries are looked up, subsequent reads are faster. If a script does not work well with a cold file system, run this command to maximize IOPS and keep the file system you care about warm:&lt;/p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;sh&quot;&gt;fd --threads 64 --full-path /path/to/pre-warm
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Why do we need to scan in parallel?&lt;/strong&gt; The XFS file system stores metadata in multiple disk blocks scattered across the disk. When we run &lt;code&gt;ls&lt;/code&gt;, we must scan this metadata across many blocks. Each block read takes 100ms for AWS to load from S3. The way XFS stores data, combined with AWS restoring block data lazily from S3, is what makes a simple operation like &lt;code&gt;ls&lt;/code&gt; take 60 seconds.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Would &lt;code&gt;fd&lt;/code&gt; solve all the problems?&lt;/strong&gt; If all the files live in a single directory, scanning the directory entries cannot be parallelized, so prewarming takes longer. Split the files into multiple directories so they can be scanned in parallel.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/hydrator/fd-prewarm.png&quot; alt=&quot;Benchmark output for prewarming a file with fio, showing the time to read the whole file&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;how-to-prewarm-a-cold-file-on-ebs&quot;&gt;How to Prewarm a Cold File on EBS&lt;/h2&gt;
&lt;p&gt;We ran latency experiments that measured reading a large file sequentially in 2 KB chunks. We found that when we request 2 KB of data, AWS restores 512 KB from S3. We can use this 2 KB to 512 KB ratio to issue many parallel I/O calls, maximize IOPS, and reduce the throughput bottleneck. The core idea is one 2 KB read per 512 KB block, issued in parallel. Previously, with &lt;code&gt;dd&lt;/code&gt;/&lt;code&gt;fio&lt;/code&gt;, we could prewarm a 60 GB file in 25 minutes. With this technique, we prewarmed it in 8 minutes.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/hydrator/512kb-prewarm.png&quot; alt=&quot;Benchmark output for the 2 KB-per-512 KB strided prewarm, which finishes in a fraction of the time of the full read&quot; /&gt;&lt;/p&gt;
&lt;p&gt;With default gp3 storage we could run 3,000 IO operations per second, and each I/O call could prewarm 512 KB. With a 125 MB/s throughput limit, we could force EBS to prewarm the disk at its full 125 MB/s. This method worked better than AWS’s suggested methods because it prewarms only the files needed to start the site faster, instead of the entire volume.&lt;/p&gt;
&lt;h2 id=&quot;idea-why-warm-entire-files-when-partial-initialization-is-enough&quot;&gt;Idea: Why Warm Entire Files When Partial Initialization Is Enough?&lt;/h2&gt;
&lt;p&gt;Sometimes a service does not need the whole file warm to start. For example, MySQL reads only some header details and does not parse the whole file, so we prewarm just the first few bytes to start faster.&lt;/p&gt;
&lt;h2 id=&quot;results&quot;&gt;Results&lt;/h2&gt;
&lt;div class=&quot;table-wrap&quot;&gt;
&lt;table class=&quot;results-table&quot;&gt;
&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Method&lt;/th&gt;&lt;th&gt;Command&lt;/th&gt;&lt;th&gt;Time for file prewarming&lt;/th&gt;&lt;th&gt;Notes&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class=&quot;row&quot;&gt;&lt;td&gt;AWS recommended method (full volume initialization)&lt;/td&gt;&lt;td&gt;&lt;code&gt;fio --filename=/dev/&lt;device&gt; --rw=read --bs=128k --iodepth=32 --ioengine=libaio --direct=1 --name=volume-initialize&lt;/code&gt;&lt;/td&gt;&lt;td&gt;7 hrs (whole disk)&lt;/td&gt;&lt;td&gt;Inefficiently tries to prewarm the whole file system&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;row&quot;&gt;&lt;td&gt;AWS method with modification (selective file prewarming using default fio)&lt;/td&gt;&lt;td&gt;&lt;code&gt;fio --filename=/path/to/your/file.dat --rw=read --bs=128k --iodepth=32 --ioengine=libaio --direct=1 --name=volume-initialize&lt;/code&gt;&lt;/td&gt;&lt;td&gt;12m 19s (12 GB file, 1 engine file)&lt;/td&gt;&lt;td&gt;Reads the whole selected files and does not maximize IOPS utilization. Many times we could avoid prewarming the whole disk.&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;row-green&quot;&gt;&lt;td&gt;Appian&apos;s strided block read (fio)&lt;/td&gt;&lt;td&gt;&lt;code&gt;fio --name=skip-read --filename=&quot;$FILE&quot; --rw=read --bs=2k --zonemode=strided --zonesize=2k --zoneskip=510k --number_ios=$N --direct=1 --ioengine=libaio --iodepth=$D --iodepth_batch_submit=$D --iodepth_batch_complete_min=1&lt;/code&gt;&lt;/td&gt;&lt;td&gt;1m 38s (12 GB file, 1 engine file)&lt;/td&gt;&lt;td&gt;Maximizes IOPS utilization by reading the first 2 KB of each 512 KB block&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;row-green&quot;&gt;&lt;td&gt;Appian&apos;s optimized Hydrator CLI tool&lt;/td&gt;&lt;td&gt;Hydrator CLI (internal tool)&lt;/td&gt;&lt;td&gt;1m 33s (12 GB file, 1 engine file)&lt;/td&gt;&lt;td&gt;Prewarms both files and file systems as a single CLI tool&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Using the prewarming method above, we reduced Appian Engine startup on cold EBS volumes (60 GB across multiple engine files) from 90 minutes to 10 minutes. This Hydrator method is 8x faster than the AWS suggested method. Prewarming the file system metadata also improved scan speeds across the file system.&lt;/p&gt;
&lt;p&gt;We recommend using Appian’s Hydrator CLI, or running &lt;code&gt;fio&lt;/code&gt; alongside &lt;code&gt;fd&lt;/code&gt; with the right configuration, to prewarm both files and the file system. That mitigates cold EBS volume latency.&lt;/p&gt;
&lt;p&gt;The Hydrator CLI code is at &lt;a rel=&quot;external&quot; href=&quot;https://github.com/appian/tech-blog-examples/tree/main/hydrator-cli&quot;&gt;appian/tech-blog-examples: hydrator-cli&lt;/a&gt;.&lt;/p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>MEI VR: Collaborative Extended Reality Workspace for Immersive Industrial Simulations</title>
        <published>2024-05-22T00:00:00+00:00</published>
        <updated>2024-05-22T00:00:00+00:00</updated>
        <author>
          <name>
            Muthu Palaniyappan Olagappan
          </name>
        </author>
        <link rel="alternate" type="text/html" href="https://muthupalaniyappan.com/blog/mei-vr-collaborative-workspace/"/>
        <id>https://muthupalaniyappan.com/blog/mei-vr-collaborative-workspace/</id>
        <content type="html" xml:base="https://muthupalaniyappan.com/blog/mei-vr-collaborative-workspace/">&lt;h2 id=&quot;the-result-first&quot;&gt;The result first&lt;/h2&gt;
&lt;p&gt;We built a low-cost collaborative VR workspace for industrial simulations that runs on Google Cardboard. A Jetson Nano recognises hand gestures on the edge, the NanoDet gesture model reached 96% accuracy, and wired Ethernet cut latency to 6 ms. The project was our final-year B.Tech work at the College of Engineering, Guindy, Anna University, Chennai, submitted May 2024.&lt;/p&gt;
&lt;h2 id=&quot;why-it-matters&quot;&gt;Why it matters&lt;/h2&gt;
&lt;p&gt;Industrial training usually needs expensive headsets, fixed rigs, or cloud GPUs. We wanted a setup that a team could buy cheaply and still get three things at once: hand-based interaction without controllers, several people in the same simulated space, and inference fast enough to feel responsive. Most of the work was in making those three parts run on one small, low-power board.&lt;/p&gt;
&lt;h2 id=&quot;the-system&quot;&gt;The system&lt;/h2&gt;
&lt;p&gt;The project is split into five pieces.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MEI VR client (Unity):&lt;/strong&gt; The app runs on the phone in a Cardboard headset. It renders a stereoscopic view, the menus, and the 3D industrial scene.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;MR Planning Manager:&lt;/strong&gt; Detects the ground plane, renders 3D objects onto it, and applies barrel distortion so the image looks right through the Cardboard lenses.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;MR Feed Stream Manager:&lt;/strong&gt; Projects frames onto a render texture, encodes them as JPEG, and sends them over a WebSocket.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Audio Stream Manager:&lt;/strong&gt; Captures the user’s microphone and streams it as bytes for voice chat.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Environment Manager and Central Server:&lt;/strong&gt; Serialises user changes to the environment (transform and rotation) and routes them through a buffer and a Unity environment server, so late-joining players can retrieve state.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;/mei-vr/architecture.webp&quot; alt=&quot;Architecture of MEI VR, showing the MR planning, feed stream, audio, environment managers and the central server&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;gesture-recognition&quot;&gt;Gesture recognition&lt;/h2&gt;
&lt;p&gt;We built two gesture pipelines and compared them.&lt;/p&gt;
&lt;h3 id=&quot;mediapipe-based-classifier&quot;&gt;MediaPipe-based classifier&lt;/h3&gt;
&lt;p&gt;MediaPipe gives 21 hand landmarks per frame. We encoded the landmarks as angles between fingers, which cut the classifier from 7,650 to 4,873 parameters, and fed them to a small neural network. It reached 88.20% test accuracy over nine gestures, slightly ahead of an earlier Google HGR model with 87.9% over six gestures. An SVM baseline with a linear, polynomial, or RBF kernel reached 79.7%, 77.5%, and 83.8%.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/mei-vr/hand-landmarks.webp&quot; alt=&quot;The 21 hand landmarks produced by MediaPipe, from wrist (0) to pinky tip (20)&quot; /&gt;&lt;/p&gt;
&lt;h3 id=&quot;nanodet-based-classifier&quot;&gt;NanoDet-based classifier&lt;/h3&gt;
&lt;p&gt;For the second pipeline, NanoDet detects the hand box and a classifier labels the gesture. We trained the detector on eight repurposed hand datasets, including sign language, rock-paper-scissors, and EgoHands for first-person views. The combined set was 5.4 GB with 48,906 training, 3,435 test, and 10,872 validation images. Training ran 80 epochs with Adam (learning rate 0.001, weight decay 0.05), cosine annealing, and mixed-precision training on two GPUs.&lt;/p&gt;
&lt;p&gt;The detector reached AP 0.821 over IoU 0.50 to 0.95, AP50 of 98.7%, and mAP of 82.1% for the hand class. The gesture classifier, an SVM over four gestures (peace, shoot, three, no-gesture), reached 96% accuracy on a 20% validation split.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/mei-vr/dataset-distribution.webp&quot; alt=&quot;Dataset distribution across the nine gesture classes&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;performance-on-the-edge&quot;&gt;Performance on the edge&lt;/h2&gt;
&lt;p&gt;The main question was whether the Jetson Nano could keep up. It has four CPU cores, 4 GB RAM, and two power modes (5V and MAXN).&lt;/p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Configuration&lt;/th&gt;&lt;th&gt;RAM (GB)&lt;/th&gt;&lt;th&gt;CPU per core (%)&lt;/th&gt;&lt;th&gt;GPU (%)&lt;/th&gt;&lt;th&gt;Notes&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;MediaPipe, 5V mode&lt;/td&gt;&lt;td&gt;1.40&lt;/td&gt;&lt;td&gt;54, 95, off, off&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;CPU-bound, GPU idle&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;MediaPipe, MAXN mode&lt;/td&gt;&lt;td&gt;1.54&lt;/td&gt;&lt;td&gt;45, 26, 36, 27&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;CPU spread across all four cores&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;NanoDet, 5V mode&lt;/td&gt;&lt;td&gt;2.2&lt;/td&gt;&lt;td&gt;92, 87, off, off&lt;/td&gt;&lt;td&gt;67&lt;/td&gt;&lt;td&gt;Moves work to GPU&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;NanoDet, MAXN mode&lt;/td&gt;&lt;td&gt;2.5&lt;/td&gt;&lt;td&gt;43, 33, 32, 12&lt;/td&gt;&lt;td&gt;87&lt;/td&gt;&lt;td&gt;Best GPU use, about 27.8 FPS&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;MediaPipe leaned on the CPU and left the GPU idle. NanoDet moved most of the work to the GPU and ran at about 27.8 FPS in accelerated mode. The NanoDet pipeline runs at a stable 30 FPS target.&lt;/p&gt;
&lt;h2 id=&quot;connecting-the-jetson-and-the-phone&quot;&gt;Connecting the Jetson and the phone&lt;/h2&gt;
&lt;p&gt;We tested three links between the Jetson and the phone: Wi-Fi, USB serial, and USB Ethernet.&lt;/p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Connection&lt;/th&gt;&lt;th&gt;Min (ms)&lt;/th&gt;&lt;th&gt;Max (ms)&lt;/th&gt;&lt;th&gt;Average (ms)&lt;/th&gt;&lt;th&gt;Notes&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Wi-Fi&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;259&lt;/td&gt;&lt;td&gt;59&lt;/td&gt;&lt;td&gt;Usable but jittery&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Wired Ethernet&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;13&lt;/td&gt;&lt;td&gt;6&lt;/td&gt;&lt;td&gt;Recommended for training rooms&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Wi-Fi was usable but jittery. Wired Ethernet was consistently fast enough for real-time gesture feedback, which is why we recommend it for training rooms.&lt;/p&gt;
&lt;h2 id=&quot;the-mr-interface&quot;&gt;The MR interface&lt;/h2&gt;
&lt;p&gt;Users open a home menu in the headset with options such as the object visualiser, an MR call, and a simulation launcher. Objects are selected with an AR raycast, and each interactable object sits on a dedicated Unity layer so that selection stays precise.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/mei-vr/mr-ui-headset.webp&quot; alt=&quot;The MEI XR home menu seen through the Cardboard lenses&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The object controls let a user increase size, reduce size, and rotate a selected object.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/mei-vr/object-controls.webp&quot; alt=&quot;Object control panel in the Unity editor&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;the-3d-industrial-simulation&quot;&gt;The 3D industrial simulation&lt;/h2&gt;
&lt;p&gt;The simulation runs in Unity3D. Gaze tracking drives the focus, and Unity’s physics engine handles object movement, so users can pick up and move parts of an industrial scene.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/mei-vr/unity-scene.webp&quot; alt=&quot;Unity scene of the industrial environment with hand models interacting with a crate&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;multiplayer&quot;&gt;Multiplayer&lt;/h2&gt;
&lt;p&gt;Players share a room over Photon. Each player is a networked capsule, and vehicles, tyres, batteries, and mud guards are network objects. Ownership of an object can transfer between players, and transform sync corrects for network lag so that remote players see smooth movement.&lt;/p&gt;
&lt;h2 id=&quot;limits-and-what-we-would-change-next&quot;&gt;Limits and what we would change next&lt;/h2&gt;
&lt;p&gt;The Wi-Fi jitter is the main limit, and the phone’s CPU is a bottleneck for MediaPipe. A future version should move the whole gesture pipeline to the GPU path and add more gestures. We also want to test with more than two players and in a real training session with trainees.&lt;/p&gt;
&lt;h2 id=&quot;team&quot;&gt;Team&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Balaji A (2020115018)&lt;/li&gt;
&lt;li&gt;Dinesh A (2020115029)&lt;/li&gt;
&lt;li&gt;Muthu Palaniyappan OL (2020115054)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Project guide:&lt;/strong&gt; Dr. Selvi Ravindran, Associate Professor, Department of Information Science and Technology, CEG, Anna University, Chennai.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Head of Department:&lt;/strong&gt; Dr. S. Swamynathan.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Final-year project report, May 2024, College of Engineering, Guindy, Anna University, Chennai.&lt;/em&gt;&lt;/p&gt;
</content>
    </entry>
</feed>
