[erlang-questions] Max open files and erlang memory

Vincent de Phily vincent.dephily@REDACTED
Tue Aug 25 13:57:54 CEST 2009


On Monday 24 August 2009 23:09:25 Per Hedeland wrote:
> The runtime creates an array of port structures (100+ bytes IIRC) sized
> as the next power of two at or above your "max-open-files" (a.k.a.
> sysconf(_SC_OPEN_MAX)) - this has been true since at least R10, probably
> much earlier. I.e. the following from erlang(3) is only correct
> regarding the default if you have a "max-open-files" of 1024 (or less) -
> which happens to be the default on Linux I believe.
>
>       The maximum number of ports that can be open at the  same  time
>       is  1024  by  default,  but can be configured by the environment
>       variable ERL_MAX_PORTS.
>
> The ERL_MAX_PORTS part *is* correct though - and you can use this to
> *reduce* the size of that port array. Oh, there is actually an upper
> limit - 2^28 as far as I can see. And 1024 is the *lower* limit. See
> init_io() in erts/emulator/beam/io.c.

Thanks a lot for the pointers. I'll use ERL_MAX_PORTS to tweak memory usage on 
a per-instance basis.

I still wish the memory wasn't allocated untill needed, but I won't try to 
argue against beam developpers regarding performance-related design 
decisions :)


-- 
Vincent de Phily
Mobile Devices
+33 (0) 666 301 306
+33 (0) 142 119 325

Warning
This message (and any associated files) is intended only for the use of its
intended recipient and may contain information that is confidential, subject
to copyright or constitutes a trade secret. If you are not the intended
recipient you are hereby notified that any dissemination, copying or
distribution of this message, or files associated with this message, is
strictly prohibited. If you have received this message in error, please
notify us immediately by replying to the message and deleting it from your
computer. Any views or opinions presented are solely those of the author
vincent.dephily@REDACTED and do not necessarily represent those of 
the
company. Although the company has taken reasonable precautions to ensure no
viruses are present in this email, the company cannot accept responsibility
for any loss or damage arising from the use of this email or attachments.


More information about the erlang-questions mailing list