Skip to main content
JDK 17+Scala 3.3+High Performance

Otavia

A high-performance IO & Actor programming model for Scala 3

Build scalable concurrent applications with zero-cost abstractions, type-safe message passing, and a powerful Netty-based IO stack.

PingPong.scala
// Define messages with type safety
case class Ping(id: Int) extends Ask[Pong]
case class Pong(id: Int) extends Reply

// Actors handle messages asynchronously
class PingActor(pong: Address[Ping])
extends StateActor[Start] {
def resumeNotice(stack) = stack.state match {
case StartState =>
pong.ask(Ping(1))
stack.suspend(FutureState())
case s: FutureState[Pong] =>
println("Pong received: " + s.future.getNow.toString)
stack.return()
}
}

// Build and run
val system = ActorSystem()
val pong = system.buildActor(() => PongActor())
val ping = system.buildActor(() => PingActor(pong))
ping.notice(Start(1))

Why Otavia?

Built for high-performance Scala with unique features you won't find elsewhere

Zero-Cost Ask Pattern

Send ask messages and get replies like calling a method. No Future overhead, no allocation on hot paths.

T

Type-Safe Messaging

Message passing between actors is type-safe at compile time. Catch errors before runtime.

async

Stack Coroutines

async/await syntax via CPS using Scala 3 metaprogramming. Sequential code, async performance.

No More Locks

Single-threaded actors mean no race conditions, no deadlocks, no thread safety headaches.

IOC for Actors

ActorSystem is also an IOC container. Type-safely autowire dependent actors at compile time.

Netty IO Stack

Ported from Netty with AIO and file channel support. Leverage the rich Netty codec ecosystem.

Object Pooling

Zero-cost abstractions with object pooling for hot paths. Millions of actors, billions of messages.

Zero Dependencies

Core modules depend on nothing but Scala and JDK. Pure, portable, predictable.

Why Otavia?

Traditional Threading

  • Complex thread management
  • Race conditions & deadlocks
  • Blocking kills performance
  • Hard to reason about

With Otavia

  • Single-threaded actors
  • No locks needed
  • Zero-cost async/await
  • Compile-time type safety

Ready to get started?

Check out our documentation to learn more about Otavia and start building your first actor-based application.