Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How portable are Erlang beam files?

Tags:

erlang

beam

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?

like image 705
DanM Avatar asked Feb 12 '10 22:02

DanM


2 Answers

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.

like image 150
Tor Valamo Avatar answered Sep 27 '22 02:09

Tor Valamo


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.

like image 43
cbo Avatar answered Sep 23 '22 02:09

cbo