mirror of
https://github.com/hanzoai/papers.git
synced 2026-10-22 17:20:17 +00:00
Design paper describing the Hanzo unified Go binary architecture: one statically linked process (hanzoai/cloud) mounting every platform subsystem, built on the zip framework (Fiber v3) with embedded goja for in-process JS, esbuild for TS->ES5 transpilation, and ZAP RPC serving both the wire and the in-process dispatch seam. Covers motivation (microservices overhead for co-located control planes), architecture, the TS->goja->native-Go migration path (esign tRPC->ZAP case study, 14/14 routers server-side), multi-tenancy by configuration, the in-process-goja vs sandboxed hanzoai/runtime code-execution boundary, a cost model anchored in published service-mesh measurements, and performance (function call vs network RPC, promise pipelining). 8 pages, two TikZ figures (layered architecture, cost comparison), 20 references. Compiles clean with tectonic; no missing citations.
58 lines
2.3 KiB
TeX
58 lines
2.3 KiB
TeX
\begin{figure}[t]
|
|
\centering
|
|
\begin{tikzpicture}[
|
|
font=\scriptsize,
|
|
node distance=4.5mm,
|
|
box/.style={draw, rounded corners=2pt, align=center, minimum height=6.5mm,
|
|
inner xsep=3pt, text width=66mm},
|
|
layer/.style={box, fill=hzslate!8, draw=hzslate!60},
|
|
native/.style={box, fill=hzgreen!12, draw=hzgreen!70, text width=31mm},
|
|
js/.style={box, fill=hzred!10, draw=hzred!60, text width=31mm},
|
|
arr/.style={-{Latex[length=2mm]}, hzslate!80, line width=0.4pt}
|
|
]
|
|
|
|
\node[layer, fill=hzblue!10, draw=hzblue!70] (clients)
|
|
{HTTP / WebSocket clients \\ \textit{SDKs, browsers, peer clusters}};
|
|
|
|
\node[layer, below=of clients] (router)
|
|
{Fiber~v3 router (\texttt{zip})};
|
|
|
|
\node[layer, below=of router] (registry)
|
|
{\texttt{zaprpc.Registry} \;---\; method $\rightarrow$ handler \\
|
|
\textit{ZAP over wire $\;\parallel\;$ in-process dispatch}};
|
|
|
|
% two handler strategies
|
|
\node[native, below left=8mm and -30mm of registry] (go)
|
|
{\textbf{native Go handler} \\ function call, no serialization};
|
|
\node[js, below right=8mm and -30mm of registry] (js)
|
|
{\textbf{goja handler} \\ ES5 via esbuild, interpreted};
|
|
|
|
\node[layer, below=14mm of registry, text width=70mm, fill=hzslate!12] (subsys)
|
|
{Subsystem APIs \;(one address space)\\[1pt]
|
|
\footnotesize iam \,$\cdot$\, kms \,$\cdot$\, base \,$\cdot$\, gateway \,$\cdot$\, ai \,$\cdot$\,
|
|
commerce \,$\cdot$\, vfs \,$\cdot$\, mq \,$\cdot$\, dns \,$\cdot$\, o11y};
|
|
|
|
\draw[arr] (clients) -- (router);
|
|
\draw[arr] (router) -- (registry);
|
|
\draw[arr] (registry.south) -- (go.north);
|
|
\draw[arr] (registry.south) -- (js.north);
|
|
\draw[arr] (go.south) -- (subsys.north);
|
|
\draw[arr] (js.south) -- (subsys.north);
|
|
|
|
\begin{scope}[on background layer]
|
|
\node[draw=hzslate!40, dashed, rounded corners=3pt,
|
|
fit=(router)(registry)(go)(js)(subsys),
|
|
inner sep=4pt, fill=hzslate!3] (binary) {};
|
|
\end{scope}
|
|
\node[hzslate!70, anchor=south east, font=\scriptsize\itshape]
|
|
at ([xshift=-2pt,yshift=1pt]binary.north east) {one Go process};
|
|
|
|
\end{tikzpicture}
|
|
\caption{The unified binary request path. Clients reach a Fiber~v3 router;
|
|
\texttt{zaprpc.Registry} resolves each method to either a native Go handler
|
|
or a goja-evaluated handler transpiled to ES5 by esbuild. Both terminate in
|
|
the same subsystem APIs within one address space; the choice is invisible
|
|
to clients and peers.}
|
|
\label{fig:cake}
|
|
\end{figure}
|