Build a server that handles thousands of simultaneous connections by spawning a lightweight fiber per request instead of a heavy OS thread
Pass data safely between concurrent tasks using channels without worrying about shared-memory bugs
Structure a concurrent system as independent actors that each process a mailbox of messages, avoiding common threading problems
Requires adding a Java agent flag at runtime beyond the standard Maven or Gradle dependency, which is an extra step.
Quasar is a Java library that adds three tools for writing programs that do many things at once: fibers, channels, and actors. These three ideas come from programming languages designed with concurrency at their core, and Quasar brings them to the Java virtual machine. Fibers are like threads, which are the standard way Java runs code in parallel. The difference is that regular Java threads are heavyweight: the operating system manages them, and having thousands of them running at once is impractical. Fibers are managed by Quasar itself rather than the OS, which means you can have hundreds of thousands of them with far less overhead. This makes it practical to write code that spawns a new fiber per incoming request or connection, a style that is natural to read but would be too expensive with regular threads. Channels are a way for fibers or threads to pass data to each other safely, one piece at a time, without sharing memory directly. One fiber puts data into a channel and another reads from it, with the library handling synchronization. Actors add a layer on top of this: each actor is an independent unit that processes messages from a mailbox, one at a time, which avoids many common problems that arise when multiple threads share the same data. Using Quasar requires adding a Java agent flag when running your program. The library is added as a Maven or Gradle dependency. Quasar is also the foundation for two related projects: Pulsar, which provides a Clojure API on top of it, and Comsat, which connects Quasar to Java's standard web APIs. The README is brief and points to external documentation for full usage details. Quasar is dual-licensed under the Eclipse Public License and the GNU Lesser General Public License.
← puniverse on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.