… | |
… | |
738 | convenience functionality. |
738 | convenience functionality. |
739 | |
739 | |
740 | This means that AEMP requires a less tightly controlled environment at the |
740 | This means that AEMP requires a less tightly controlled environment at the |
741 | cost of longer node references and a slightly higher management overhead. |
741 | cost of longer node references and a slightly higher management overhead. |
742 | |
742 | |
|
|
743 | =item Erlang has a "remote ports are like local ports" philosophy, AEMP |
|
|
744 | uses "local ports are like remote ports". |
|
|
745 | |
|
|
746 | The failure modes for local ports are quite different (runtime errors |
|
|
747 | only) then for remote ports - when a local port dies, you I<know> it dies, |
|
|
748 | when a connection to another node dies, you know nothing about the other |
|
|
749 | port. |
|
|
750 | |
|
|
751 | Erlang pretends remote ports are as reliable as local ports, even when |
|
|
752 | they are not. |
|
|
753 | |
|
|
754 | AEMP encourages a "treat remote ports differently" philosophy, with local |
|
|
755 | ports being the special case/exception, where transport errors cannot |
|
|
756 | occur. |
|
|
757 | |
743 | =item * Erlang uses processes and a mailbox, AEMP does not queue. |
758 | =item * Erlang uses processes and a mailbox, AEMP does not queue. |
744 | |
759 | |
745 | Erlang uses processes that selctively receive messages, and therefore |
760 | Erlang uses processes that selectively receive messages, and therefore |
746 | needs a queue. AEMP is event based, queuing messages would serve no useful |
761 | needs a queue. AEMP is event based, queuing messages would serve no |
747 | purpose. |
762 | useful purpose. For the same reason the pattern-matching abilities of |
|
|
763 | AnyEvent::MP are more limited, as there is little need to be able to |
|
|
764 | filter messages without dequeing them. |
748 | |
765 | |
749 | (But see L<Coro::MP> for a more Erlang-like process model on top of AEMP). |
766 | (But see L<Coro::MP> for a more Erlang-like process model on top of AEMP). |
750 | |
767 | |
751 | =item * Erlang sends are synchronous, AEMP sends are asynchronous. |
768 | =item * Erlang sends are synchronous, AEMP sends are asynchronous. |
752 | |
769 | |
753 | Sending messages in Erlang is synchronous and blocks the process. AEMP |
770 | Sending messages in Erlang is synchronous and blocks the process (and |
754 | sends are immediate, connection establishment is handled in the |
771 | so does not need a queue that can overflow). AEMP sends are immediate, |
755 | background. |
772 | connection establishment is handled in the background. |
756 | |
773 | |
757 | =item * Erlang can silently lose messages, AEMP cannot. |
774 | =item * Erlang suffers from silent message loss, AEMP does not. |
758 | |
775 | |
759 | Erlang makes few guarantees on messages delivery - messages can get lost |
776 | Erlang makes few guarantees on messages delivery - messages can get lost |
760 | without any of the processes realising it (i.e. you send messages a, b, |
777 | without any of the processes realising it (i.e. you send messages a, b, |
761 | and c, and the other side only receives messages a and c). |
778 | and c, and the other side only receives messages a and c). |
762 | |
779 | |
… | |
… | |
774 | eventually be killed - it cannot happen that a node detects a port as dead |
791 | eventually be killed - it cannot happen that a node detects a port as dead |
775 | and then later sends messages to it, finding it is still alive. |
792 | and then later sends messages to it, finding it is still alive. |
776 | |
793 | |
777 | =item * Erlang can send messages to the wrong port, AEMP does not. |
794 | =item * Erlang can send messages to the wrong port, AEMP does not. |
778 | |
795 | |
779 | In Erlang it is quite possible that a node that restarts reuses a process |
796 | In Erlang it is quite likely that a node that restarts reuses a process ID |
780 | ID known to other nodes for a completely different process, causing |
797 | known to other nodes for a completely different process, causing messages |
781 | messages destined for that process to end up in an unrelated process. |
798 | destined for that process to end up in an unrelated process. |
782 | |
799 | |
783 | AEMP never reuses port IDs, so old messages or old port IDs floating |
800 | AEMP never reuses port IDs, so old messages or old port IDs floating |
784 | around in the network will not be sent to an unrelated port. |
801 | around in the network will not be sent to an unrelated port. |
785 | |
802 | |
786 | =item * Erlang uses unprotected connections, AEMP uses secure |
803 | =item * Erlang uses unprotected connections, AEMP uses secure |