I’m happy to announce that I am handing off maintenance of Partisan, the distributed runtime system I built as part of my Ph.D. (and my first paper published at CMU!), to Alejandro Ramallo at Leapsight.
Alejandro has done tremendous work on Partisan over the last two years: from fixing bugs, feature enhancement to performance improvements.
Alejandro has also brought Partisan to places that, as a PhD student who works mostly in a lab, never imagined: LO/JACK LATAM, the lost vehicle recovery service, since 2019, has been using Partisan as part of its Magenta Platform, tracking 300k vehicles, 10k devices, receiving over 30M GPS transmissions each day!
At LO/JACK LATAM, Leapsight uses Partisan as a foundational component for:
You can learn more about how it’s used here:
Leapsight has used Partisan as the backbone of two of their products:
Alejandro has a lot in store for Partisan:
partisan_plumtree_broadcast
server per channel to increase throughputpartisan_plumtree_broadcast
server use ets
Since Alejandro is hard at work on getting 5.0.0 release of Partisan prepared, I include the incredibly long list of changes, bug fixes, and improvements planned for the next week that him and his team completed over the last two years.
Thanks Alejandro and LeapSight!
In general, the API was redesigned to concentrate all functions around two modules: partisan
and partisan_peer_service
.
partisan
module was repurposed as a replacement for the erlang
module for use cases related to distribution e.g. erlang:nodes/0
-> partisan:nodes/0
.
partisan_peer_service
, partisan_monitor
and partisan_util
are now in this module:
partisan:broadcast/2
partisan:cast_message/3
partisan:cast_message/4
partisan:cast_message/5
partisan:default_channel/0
partisan:demonitor/1
partisan:demonitor/2
partisan:forward_message/2
partisan:forward_message/3
partisan:forward_message/4
partisan:forward_message/5
partisan:is_connected/1
partisan:is_connected/2
partisan:is_fully_connected/1
partisan:is_local/1
partisan:is_pid/1
partisan:is_process_alive/1
partisan:is_reference/1
partisan:make_ref/0
partisan:monitor/1
partisan:monitor/2
partisan:monitor/3
partisan:monitor_node/2
partisan:monitor_nodes/1
partisan:monitor_nodes/2
partisan:node/0
partisan:nodestring/0
partisan:node/1
partisan:node_spec/0
partisan:node_spec/1
partisan:node_spec/2
partisan:nodes/0
partisan:nodes/1
partisan:self/0
partisan:send_message/2
partisan_peer_service:broadcast_members/0
partisan_peer_service:broadcast_members/1
partisan_peer_service:cancel_exchanges/1
partisan_peer_service:exchanges/0
partisan_peer_service:exchanges/1
partisan_peer_service:get_local_state/0
partisan_peer_service:inject_partition/2
partisan_peer_service:leave/1
partisan_peer_service:member/1
partisan_peer_service:members_for_orchestration/0
partisan_peer_service:on_down/2
partisan_peer_service:on_up/2
partisan_peer_service:partitions/0
partisan_peer_service:reserve/1
partisan_peer_service:resolve_partition/1
partisan_peer_service:update_members/1
partisan_peer_service:mynode/0
has been replaced by partisan:node/0
to follow Erlang conventionpartisan_peer_service:myself/0
has been replaced by partisan:node_spec/0
to disambiguate from partisan:node/0
.Node
variable name for node()
type (as opposed to Name
) and NodeSpec
for node_spec()
(as opposed to Node
) to disambiguate.partisan_rpc
that will provide and API that mirrors Erlangs rpc
and erpc
modulespartisan_remote_ref
to encapsulate the creation of reference and added an optional/alternative representation for encoded pids, references and registered names. The module offers all the functions to convert pids, references and names to/from Partisan encoded references.
Alternative representation: In cases where lots of references are stored in process state, ets and specially where those are uses as keys, a binary format is preferable to the tuple format in order to save memory usage and avoid copying the term every time a message is send between processes. partisan_remote_ref
represents an encoded reference as binary URI. This is controlled by the config option remote_ref_as_uri
and remote_ref_binary_padding
in case the resulting URIs are smaller than 65 bytes.
1> partisan_remote_ref:from_term(self()).
{partisan_remote_reference,nonode@nohost,{partisan_process_reference,"<0.1062.0>"}}
2> partisan_config:set(remote_ref_as_uri, true).
ok
3> partisan_remote_ref:from_term(self()).
<<"partisan:pid:nonode@nohost:0.1062.0">>
4> partisan_config:set(remote_ref_binary_padding, true).
ok
5> partisan_remote_ref:from_term(self()).
<<"partisan:pid:nonode@nohost:0.1062.0:"...>>
state_orset
CRDT with state_awmap
to avoid an issue where a node will crash and restart with a different IP address e.g. when deploying in K8s. As the membership set contains node_spec()
objects which contain the IP address we ended up with duplicate entries for the node. The state_awmap
tries to solve that by mapping a node() => state_mvregister(node_spec())
leave
operation in partisan_pluggable_peer_service_manager
:
partisan_plumtree_broadcast
where the all_members
set was not updated when a member is removed.partisan_plumtree_broadcast
was not removing the local node from the broadcast member set.channel
if defined.on_up
and on_down
callback functions in partisan_pluggable_peer_service_manager
partisan_peer_service_manager:member/1
plumtree_broadcast_backend
with an ets
table for outstanding messages keeping the gen_server stack lean and avoiding garbage collectiontls_options
tls_client_options
and tls_server_options
peer_service_connections
replaces the former process state data structure and the partisan_connection_cache
module. It offers an ets-based solution with use of counters for quick node connection status checkpartisan_peer_connections
has been re-implemented to use ets to increase perfomance and remove the need for an additional caching feature.
partisan_connection_cache
module has been was removed.ets
lookup operation and leverages ets:update_counter/4
, ets:lookup_element/3
and ets:select_count/2
to handle concurreny and minimise copying data into the caller’s process heap.partisan_monitor
.peer_service
on_up
and on_down
callback functions.
partisan_monitor
is restarted every time the configured partisan_peer_service_manager
is restarted.partisan
module following the same name, signature and semantics of their erlang
and net_kernel
modules counterparts:
partisan:monitor/1
partisan:monitor/2
partisan:monitor/3
partisan:monitor_node/2
partisan:monitor_nodes/1
partisan:monitor_nodes/2
partisan_gen
and partisan_gen_server
to match their OTP24 counterparts implementationpartisan_gen_statem
partisan_gen_fsm
deprecated as it was not complete and focus was given to the implementation of partisan_gen_statem
insteadpartisan_mochiglobal
has been removed and replaced by persistent_term
INFO
level logs have been reclassified as DEBUG
lager
dependency has been removed and all logging is done using the new Erlang logger
orddict
module have been replaced by maps for extra performance and better usabilityproplists
module have been replaced by maps for extra performance and better usabilitypartisan_pluggable_peer_servie_manager:forward_message
partisan_util
ex_doc
(Elixir documentation) rebar pluginuuid
types