SwimOS

SwimOS is a complete, self-contained distributed software platform for
building stateful, massively real-time streaming applications. SwimOS
implements a distributed microkernel, called the Swim Kernel, that is
persistent without a database, reactive without a message broker, autonomous
without a job manager, and which executes general purpose stateful applications
without a separate app server.
Getting Started
Check out the SwimOS cookbook to learn
how to build massively real-time streaming applications. Use the
Swim API to write
Web Agents that run on the Swim Kernel. Use the
Swim Server
library to embed the Swim Kernel directly into an application, creating
a self-sufficient stateful distributed application plane.
To write WARP client applications that run in Node.js and web browsers,
install the @swim/mesh library from npm.
To build a real-time Web UI, npm install the @swim/ui
and @swim/ux libraries.
Visit SwimOS.org to learn more.
Architecture
SwimOS, and the multiplexed streaming WARP protocol, make the World Wide
Web stateful, and massively real-time. Massive real-time means that every
aspect of a Web application can be efficiently streamed in real-time—keeping
the whole WARP Web continuously in sync. The Swim Kernel accomplishes this
by running general purpose, stateful distributed processes, called Web Agents,
that continuously communicate with each other, and with other applications,
using point-to-point multiplexed streaming APIs. Web Agents can also natively
expose HTTP, WebSocket, and MQTT interfaces, making it easy to integrate
Web Agents into existing systems.
The architecture of SwimOS fundamentally differs from traditional
distributed software platforms. Instead of depending on a stack of middleware,
SwimOS is architected like a higher order distributed operating system.
The Swim Kernel holistically distributes and executes all aspects of
stateful Web Agent applications, providing builtin distributed persistence,
messaging, scheduling, and multiplexed streaming APIs.
Vertical integration greatly simplifies application development and operations,
while radically improving performance. CPUs are 1,000,000x+ faster than
networks. By optimizing for data locality, and thereby eliminating numerous
superfluous network round-trips, SwimOS slashes the time it takes to
perform many application operations from milliseconds to nanoseconds.
This performance boost doesn't trade-off scalability: SwimOS is fully
distributed, and linearly scalable.
The Swim System Java implementation provides a self-contained distributed
software platform for building stateful, massively real-time streaming
applications that run on any Java 8+ VM. Swim System has no external
dependencies beyond a minimal JVM.
The Swim Core Java framework implements a dependency-free foundation
framework, with a lightweight concurrency engine, incremental I/O engine,
and flow-controlled network protocol implementations. Swim Core consists
of the following component libraries:
-
swim-util –
extended collection, iterator, and builder interfaces, lightweight cache
sets and maps, and other foundational utilities.
-
swim-codec –
incremental I/O; functional parsers and writers; display, debug, and
diagnostic formatters; and Unicode and binary codecs.
-
swim-collections –
immutable, structure sharing collections, including hash array mapped tries,
finger tries, B-trees, and S-trees (sequence trees).
-
swim-args –
composable command line argument parser.
-
swim-structure –
generic structured data model, with support for selectors, expressions,
and lambda functions. Used as a common abstract syntax tree for Recon,
JSON, XML, and other data languages.
-
swim-recon –
object notation with attributes, like if JSON and XML had a baby.
-
swim-json –
JavaScript Object Notation (JSON) codec that incrementally parses and writes
swim-structure values.
-
swim-xml –
eXtensible Markup Language (XML) codec that incrementally parses and writes
swim-structure values.
-
swim-csv –
Comma-Separated Values (CSV) codec that incrementally parses and writes
swim-structure values.
-
swim-avro –
Apache Avro codec that incrementally parses and writes swim-structure values.
-
swim-protobuf –
Protocol Buffers (protobuf) codec that incrementally parses and writes
swim-structure values.
-
swim-decipher –
universal decoder that detects and incrementally parses Recon, JSON, XML,
Protobuf, raw text, and binary data formats as swim-structure values.
-
swim-math –
mathematical and geometric structures, including rings, fields, vector
modules and spaces, affine spaces, tensor spaces, probability distributions,
and associated operators.
-
swim-security –
signing and encryption of swim-structure values using the JSON Web Key
(JWK), JSON Web Signature (JWS), JSON Web Token (JWT), and OpenID standards.
-
swim-spatial –
geospatial projections and spatial collections, including sparse prefix
Q-trees optimized for continuous n-body geofencing and real-time spatial
clustering and reduction.
-
swim-streamlet –
stateful, streaming component model for application componets that
continuously consume input state from streaming inlets, and continuously
produce output state on streaming outlets.
-
swim-dataflow –
compiler from swim-structure expressions to live-updated data models.
-
swim-observable –
collection interfaces that notify registered observers of precise state changes.
-
swim-uri –
rich object model for working with Uniform Resource Identifiers,
URI subcomponents, and URI patterns, including an efficient and
safe codec for parsing and writing compliant URI strings.
-
swim-deflate –
DEFLATE codec that incrementally compresses and decompresses streams.
-
swim-mqtt –
MQTT packet model and wire protocol codec that incrementally decodes
and encodes MQTT streams without intermediate buffering.
-
swim-http –
HTTP message model and wire protocol codec that incrementally decodes
and encodes HTTP streams without intermediate buffering.
-
swim-ws –
WebSocket frame model and wire protocol codec that incrementally decodes
and encodes fragmented WebSocket streams without intermediate buffering.
-
swim-warp –
WebSocket protocol for dynamically multiplexing large numbers of
bidirectional links to streaming API endpoints, called lanes, of
URI-addressed distributed objects, called nodes, that run stateful
distributed processes, called Web Agents.
-
swim-concurrent –
timer, task, and continuation passing style interfaces, with lightweight
scheduler and execution stage implementations.
-
swim-db –
lock-free document store—optimized for high rate atomic state changes—that
concurrently commits and compacts on-disk log-structured storage files
without blocking parallel in-memory updates to associative B-tree maps,
spatial Q-tree maps, sequential S-tree lists, and singleton U-tree values.
-
swim-io –
explicitly flow-controlled, non-blocking, parallel I/O engine, with
swim-codec-modulated socket modems, and TCP and TLS transports.
-
swim-io-mqtt –
MQTT socket modem for concurrently transporting explicitly flow-controlled
MQTT streams over a network without blocking or intermediate buffering.
-
swim-io-http –
HTTP client and server socket modems for pipelining and concurrently
transporting explicitly flow-controlled HTTP streams over a network
without blocking or intermediate buffering.
-
swim-io-ws –
WebSocket modem for concurrently transporting explicitly flow-controlled
WebSocket streams over a network without blocking or intermediate buffering,
and swim-io-http requesters and responders for upgrading HTTP client
and server modems to WebSocket modems.
-
swim-io-warp –
WARP socket modem for multiplexing and concurrently transporting prioritized,
explicitly flow-controlled WARP treams over a network, without blocking or
intermediate buffering
-
swim-web –
high-level web server API and routing DSL, with HTTP, WebSocket, and WARP
routing directives.
The Swim Mesh Java framework provides the Web Agent API, and implements
a distributed WARP microkernel. Swim Mesh consists of the following
component libraries:
The Swim Polyglot Java framework provides multi-language API bindings and
GraalVM integration for embedding guest languages
into SwimOS applications. Swim Polyglot consists of the following
component libraries:
The Swim System Typescript implementation provides a standalone set of
frameworks for building massively real-time streaming WARP client applications.
Swim System encompasses the Swim Core
foundation framework, and the Swim Mesh
multiplexed streaming WARP framework. Swim System provides the following
top-level libraries:
-
@swim/system –
umbrella package that depends on, and re-exports, all Swim System child
frameworks and libraries.
The Swim Core TypeScript framework provides a lightweight, portable,
dependency-free, and strongly typed baseline on which to build higher level
libraries. Swim Core consists of the following component libraries:
-
@swim/core –
umbrella package that depends on, and re-exports, all Swim Core libraries.
-
@swim/util –
ordering, equality, and hashing; type conversions; iterators; builders;
maps; caches; and assertions.
-
@swim/codec –
incremental I/O; functional parsers and writers; display, debug, and
diagnostic formatters; and Unicode and binary codecs.
-
@swim/args –
composable command line argument parser.
-
@swim/unit –
specializable unit testing framework.
-
@swim/collections –
immutable, structure sharing collections, including B-trees and S-trees
(sequence trees).
-
@swim/interpolate –
extensible interpolators for smoothly blending between values.
-
@swim/structure –
generic structured data model, with support for selectors, expressions,
and lambda functions. Used as a common abstract syntax tree for Recon,
JSON, XML, and other data languages.
-
@swim/streamlet –
stateful, streaming component model for application componets that
continuously consume input state from streaming inlets, and continuously
produce output state on streaming outlets.
-
@swim/dataflow –
compiler from @swim/structure expressions to live-updated data models.
-
@swim/recon –
object notation with attributes, like if JSON and XML had a baby.
-
@swim/math –
mathematical and geometric structures and operators.
-
@swim/time –
date-time, time zone, and time interval data types,
with
strptime
/strftime
-style parsers and formatters.
-
@swim/uri –
rich object model for working with Uniform Resource Identifiers and URI
subcomponents, including an efficient and safe codec for parsing and
writing compliant URI strings.
The Swim Mesh TypeScript framework implements a multiplexed streaming WARP
client that runs in both Node.js and web browsers. Swim Mesh consists of
the following component libraries:
-
@swim/mesh –
umbrella package that depends on, and re-exports, all Swim Mesh libraries.
-
@swim/warp –
WebSocket protocol for dynamically multiplexing large numbers of
bidirectional links to streaming API endpoints, called lanes, of
URI-addressed distributed objects, called nodes, that run stateful
distributed processes, called Web Agents.
-
@swim/client –
streaming API client for linking to lanes of stateful Web Agents using the
WARP protocol, enabling massively real-time applications that continuously
synchronize all shared states with ping latency.
-
@swim/cli –
command line client for linking to Web Agent lanes over the WARP protocol.
The Swim Toolkit TypeScript implementation provides user interface
frameworks for building advanced real-time applications. Swim Toolkit
incorporates the Swim UI real-time user
interface toolkit, the Swim UX real-time
application framework, the Swim Visualizations
framework, the Swim Maps framework, and the
Swim Web real-time web application framework.
Swim Toolkit provides the following top-level libraries:
-
@swim/toolkit –
umbrella package that depends on, and re-exports, all Swim Toolkit
child frameworks and libraries.
The Swim UI TypeScript framework implements a user interface toolkit for
pervasively real-time applications. A unified view hierarchy, with builtin
procedural styling and animation, makes it easy for Swim UI components to
uniformly style, animate, and render mixed HTML, SVG, Canvas, and WebGL
components. Swim UI consists of the following component libraries:
-
@swim/ui –
umbrella package that depends on, and re-exports, all Swim UI libraries.
-
@swim/angle –
dimensional angle types with unit-aware algebraic operators, conversions,
and parsers.
-
@swim/length –
DOM-relative length types with unit-aware algebraic operators, conversions,
and parsers.
-
@swim/color –
RGB and HSL color types with color-space-aware operators, conversions,
and parsers.
-
@swim/font –
CSS font property types and parsers.
-
@swim/shadow –
CSS box shadow types and parsers.
-
@swim/transform –
CSS and SVG compatible transform types with unit-aware algebraic operators
and parsers.
-
@swim/scale –
scale types that map numeric and temporal input domains to interpolated
output ranges, with support for continuous domain clamping, domain solving,
range unscaling, and interpolation between scales.
-
@swim/transition –
transition types that specify duration, ease, interpolator, and lifecycle
callback parameters for tween animations.
-
@swim/animate –
property-managing animator types that efficiently tween values between
discrete state changes.
-
@swim/style –
CSS style types and universal style value parser.
-
@swim/render –
renderable graphic types for SVG/Canvas-compatible path drawing contexts,
and Canvas-compatible rendering contexts.
-
@swim/constraint –
incremental solver for systems of linear layout constraints.
-
@swim/view –
unified HTML, SVG, and Canvas view hierarchy, with integrated controller
architecture, animated procedural styling, and constraint-based layouts.
-
@swim/shape –
canvas shape views, with animated geometry and style properties.
-
@swim/typeset –
canvas typesetting views, with animated text, layout, font, and style properties.
-
@swim/gesture –
multitouch gesture recognizers, with kinematic surface modeling.
The Swim UX TypeScript framework implements a user interface framework for
advanced real-time applications. Swim UX provides popovers, drawers, menus,
toolbars, controls, and other interactive application views and controllers.
Swim UX consists of the following component libraries:
-
@swim/ux –
umbrella package that depends on, and re-exports, all Swim UX libraries.
-
@swim/theme –
semantic looks and feels for mood-aware UX components.
-
@swim/app –
application model for coordinating window-level components, such as popovers
and drawers.
-
@swim/controls –
buttons, switches, sliders, and other user interface controls.
-
@swim/navigation –
menus, tree views, nav bars, tab bars, and other user interface navigation
components.
The Swim Visualizations TypeScript framework implements seamlessly animated
diagram widgets, including gauges, pie charts, and line, area, and bubble
charts. Swim Visualizations consists of the following component libraries:
-
@swim/vis –
umbrella package that depends on, and re-exports, all Swim Visualizations libraries.
-
@swim/gauge –
multi-dial, fully animatable, canvas rendered gauge widget.
-
@swim/pie –
multi-slice, fully animatable, canvas rendered pie chart widget.
-
@swim/chart –
multi-plot, fully animatable, canvas rendered chart widget, suppporting line,
area, and bubble graphs, with customizeable axes, and kinematic multitouch
scale gestures for panning and zooming with momentum.
The Swim Maps TypeScript framework implements real-time geospatial map
overlays, with support for Mapbox, Google, and Esri maps. Swim Maps
consists of the following component libraries:
-
@swim/maps –
umbrella package that depends on, and re-exports, all Swim Maps libraries.
-
@swim/map –
canvas views for efficiently rendering geospatially located map overlays,
including fully animatable views for lines, circles, and polygons.
-
@swim/mapbox –
support for overlaying @swim/map views on Mapbox maps.
-
@swim/googlemap –
support for overlaying @swim/map views on Google maps.
-
@swim/esrimap –
support for overlaying @swim/map views on ArcGIS maps.
The Swim Web TypeScript framework implements a thin web application
framework built on the Swim UI toolkit. Swim Web consists of the
following component libraries:
-
@swim/web –
umbrella package that depends on, and re-exports, all Swim Web libraries.
-
@swim/website –
minimalist components that implement common dynamic website behaviors.
-
@swim/webapp –
lightweight web application loader that dynamically instantiates views and
controllers declared by
swim-
HTML attributes.
Concepts
SwimOS unifies the traditionally disparate roles of database, message broker,
job manager, and application server, into a few simple constructs: Web Agents,
Lanes, Links, and Recon. Web Agents run like continuous, general purpose
processes on heterogeneous distributed computers, called a Fabrics.
Web Agents
SwimOS applications consist of interconnected, distributed objects, called
Web Agents. Each Web Agent has URI address, like a REST endpoint. But unlike
RESTful Web Services, Web Agents are stateful, and accessed via streaming APIs.
Lanes
If Web Agents are distributed objects, then lanes serve as the properties and
methods of those objects. Lanes come in many flavors, value lanes, map lanes,
command lanes, and join lanes, to name a few. Many lanes are internally
persistent, acting like encapsulated databas tables.
Links
Distributed objects need a way to communicate. Links establishes active
references to lanes of Web Agents, transparently streaming bi-directional state
changes to keep all parts of an application in sync, without the overhead of
queries or remote procedure calls.
Recon
Communication only works if all parties understands one another. SwimOS
natively speaks a universal, structured data language, called Recon. A superset
of JSON, XML, Protocol Buffers, and more, Recon naturally translates into many
tongues.
Fabrics
SwimOS serves as the higher order operating system for distributed computers,
called Fabrics, which SwimOS coherently stitches together from non-uniformly
distributed, heterogeneous sets of machines.