Question

I have a temporary situation where beam files compiled on one node are executed on another node. Are the beam files portable?

How close do the versions of the Erlang distributions need to be?

Was it helpful?

Solution

Beam files are portable across nodes, as they are bytecode that is interpreted by the Erlang VM, in the same way that Java works. The exception is if they're compiled for native optimization (+native), in which case they're obviously not very portable, other than possibly between windows machines. (edit two years later: also machines that have identical hardware and software setups, as you would possibly find in telecom uses of erlang)

Version wise, it's obvious that you shouldn't use features that the oldest version doesn't support. As long as the features are supported, it should work even if the version gap is big.

Note also that some modules may have been experimental in earlier versions, and so their functions may have had slightly different results.

OTHER TIPS

Beam files should be fairly portable across nodes. If nodes are running different versions of the Erlang VM, then you might have troubles. Features to be especially wary of include the use of parameterized modules and the -extends() module attribute. If one of the machines is running a VM that was installed via a package manager (i.e. apt), it's probably old. One module that I've had difficulty with in the past is the regular expression module re.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top