Skip to content

0.5.0

Choose a tag to compare

@ktoso ktoso released this 06 Jul 07:08
0.5.0

New Features

Core / Actors

  • Support for Swift 5.3 (and 5.2)
    • 5.1 support was dropped
  • Minor: New GCD Dispatcher, meaning that actors can run on specified dispatch queues #703
  • Ability to DeathWatch using a Message that the actor can receive directly, rather than having to implement .receiveSignal
    • This is not only a "nice to have" but enables expressing some patterns which otherwise would require storing mappings in dictionaries (and there having trouble with typesafely implementing those contexts)
  • Minor: ActorSystem gained .park() call, allowing for simpler "wait until terminated" and building simple 1 file applications. #459
  • Minor: new shutdown() overloads to integrate nicer with swift-service-lifecycle #230

Serialization

  • Support for plist (xml or binary) message encoding #557 (per-message configurable) based on user feedback

Actorable

  • 🎉 Actorables can now be generic types
    • for example, struct Proxy<Message: Codable>: Actorable { ... }
    • Actorable protocols with associated types are not yet supported, see: #656

(Reusable) Gossiper / GossipLogic

  • Extracted shared needs of various gossip implementations into Gossiper imeplementation, and re-used it in CRDT gossip as well as re-phrasing Membership gossip in it's terms. This already spotted minor issues which we would have missed in the ad-hoc implementations otherwise. #28
  • Gossiper can in the near future become a public type offering "if you need any gossip protocol, just plug in your GossipLogic and it just works" for end-users, including peer discovery, gossip round management etc.

CRDTs

  • 📘 Introduced high-level documentation for the feature #638
  • 🎉 Implemented (naive) gossip replication; currently remains somewhat naive, however it is a good enough step 1 (our of 3 planned ones). #28
    • Gossiper is re-using new Gossiper type.

Cluster Singleton Actors

  • 📘 Added documentation #468 and polished API #396 based on user-feedback

Instrumentation and Instruments(.app) instruments

  • Introduced a few initial Instrumentation cut-points in the system #475
    • These will be used for future tracing efforts as well as general measurements and other instrumentation (eagerly awaiting swift-baggage-context). See Sources/DistributedActors/Instrumentation, for the current Instrumentation types.
  • Implemented need-driven custom instruments for the following use-cases:
    • ReceptionistInstrumentation,ActorInstrumentation, ActorTransportInstrumentation (incl. Serialization events), and ActorMailboxInstrumentation; See example screenshot.
    • These tools are becoming tremendously helpful in deciding about implementation tradeoffs and inspecting runtime behavior, we expect users to value them as well, in order to avoid treating the actor system as a black box.
  • ActorInstruments package definition is fully implemented in type-safe Swifty Instruments DSL, meaning there is no possibility to mis-configure the instrumentation for non-existing fields/tables/schemas:
  • Introduced SwiftyInstruments DSL, which enabled efficiently building specialized custom instruments for Instruments.app using plain Swift.
    • Definitions cover most of the Instruments package definition schema, some missing bits easy to fill-in in the upcoming future on an as-needed basis. See: SwiftyInstruments, discussed with Instruments team a little bit.
    • Brought up some function-builder limitations which are a bit annoying for this API on the forums:

ActorTestKit

  • Introduced fishForMessage which allows hooking into event streams and fishing for messages which satisfy some criteria. #474

Improvements

Core

  • ⚠️ Removed ClassBehavior in favor of making Actorable a first-class citizen in all APIs #562
  • Logging: Ability to pass in fully constructed Logger for the system to use as base logger: #662 after multiple design discussions and improvements made to swift-log
  • 🚀 Avoid un-necessary CoW on DeathWatch container causing performance issues when spawning thousands of child actors. 0cf3dc0

Transport

  • 🔥 Hardened and re-worked the Association design as well as connection management
    • This was a long outstanding task which we knew was important to revisit; New implementation guarantees no dropped messages even during racy connection establishments (e.g. nodes A and B joining "eachother" simultaniously -- neither A's or B's sent messages will be dropped when they face such racy handshake and multiple similar races were fixed).
  • 🔥 Hardened RemotePersonality for ActorRefs, lessening the use of locks tremendously as well as improving correctness at the same time #382 & #383
  • 🔥 Hardened Handshake handling with non-existing or dead nodes, cluster performs exponential backoff when attempting to join such nodes and eventually gives up (rathe than trying to join a dead node forever) #389

Membership Gossip

  • 🚀 Vastly improved Membership Gossip implementation including stop conditions and improved ACK handling #699 Resulting in correct and reliable membership gossip.
  • 🚀 Drastically improved membership's network utilization (more to be done here in the future), by "smart" encoding schemes used to serialize the membership state, resulting in 4~6x payload size decrease of gossip payloads (measured for 20 node clusters). #676

SWIM Membership / Failure Detector

  • Implemented Local Health Aware Probe extension, as defined in the Lifeguard SWIM extensions paper #352
  • Implemented Buddy System extension, as defined in the Lifeguard SWIM extensions paper, see: #180 for details

Receptionist

  • 🎉 Cluster Receptionist: dropped previous placeholder implementation (full-state sync based) and replaced with operation sync based one. Similar to op-based CRDTs however not using the CRDT infra (long story why not, happy to discuss).
  • 🚀 Performance work resulting in API redesign for greater reusability and exploiting CoW semantics correctly for Receptionist.Listing avoiding copying of read-only data to subscribers. Greatly improved scalability of some sample apps, speeding up spawning/registering/looking up 15,000 actors to ~300ms, from previous patological cases of >1minute.

Serialization

  • Serialization infrastructure re-design around Codable (docs: #538)
    • This means that Actor messages MUST be Codable, leading to an easier way between "hello world" and "now my hello world is distributed!"
    • Introduced NonTransportableActorMessage as way to "cheat" when non-codable types intended for local only actor messaging need to be sent around.
    • We are aware of some usability issues and limitations with that approach, e.g. the lack of automatically synthesized Codable conformances for enums with associated values, and we intend to fix those limitations in the language itself.
  • New serialization infrastructure makes use of Serialization.Manifest and (optionally, when available) _getMangledTypeName ⚠️ Need to discuss future direction with security aspects of this feature and alternative tradeoffs we can take. Had discussions planned but things got rescheduled a bit.

CRDT

  • Serialization implementations for LWWRegister, ORMap #509 #598 and Codable conformances for all CRDT types #507

Actorable

  • ⚠️ To re-gain the fine-grained control over what functions should be exposed as actor messages we introduced the "comment annotation" of // @actor.
    • Previously magic method names were used for this, resulting in terribly looking code like __notAnActorFunction(hello: Hello)
  • Continued work on full feature-parity with Behavior API
    • Actorables can now context.stop() #558
    • and have complete feature parity and complete inter-op with Behavior types (and ActorRefs) forDeathWatch as well as spawn() APIs
  • swift run GenActors is now compatible with Swift 5.3 (as well as 5.2)
  • Minor: Removed custom argument parser implementation and using Swift Argument Parser from OSS ecosystem 💕

Examples

  • Investigated and fixed performance issues uncovered by some internal sample apps.
  • New CRDT sample app: SampleDistributedCRDTScoreGame
  • Sample app spawning 10,000 actors and registering with Receptionist: SampleReceptionist used to stress test some of the new features

Stats

A total of 128 issues was closed since the 0.4.0 release, including 21 bug 🐞 and 26 failed 💥 tickets, resulting in the best and most stable release we ever made 🎉

We'd also like to thank Anton and Artem for their contributions, thanks!

You can view all resolved tickets on the 0.5.0 milestone.

commits  added  removed
    147  38076    23089 Konrad `ktoso` Malawski
     15   3534     1474 Yim Lee
      6   1804      829 Anton Volokhov
      5    737      608 Tomer Doron
      1     17        7 Artem Redkin