slow read from spawned processes
Bernd Roscher
eedber@REDACTED
Fri Jul 23 17:06:29 CEST 1999
Hi,
I have a problem concerning spawned external processes ,
spawned by 'open_port({spawn, FileName}...)' and using the
2-byte-header-protocol on the STDIN, STDOUT file descriptors.
I've spawned two processes this way (C++ executables), one
is sending messages of length 54, the other receives the messages.
The Erlang program behind this, provides a routing mechanism
between several processes, thus connecting these two processes
in this example.
The final program, that uses this routing facility, shall
call a non-blocking read inside an execution loop.
But the blocking read (upto now the receiving process is able
to block because it does not do anything else besides receiving
the messages) appears to be 7-10 times faster then the nonblocking
version.
I also tried to simulate a non-blocking by first checking the number
bytes on the file descriptor, but this turned out to behave like
the slow normal non-blocking.
Does anyone have an idea what makes the non-blocking so slow?
Another problem is the Erlang interpreter. In the case of a slow
receiver it allocates a mass of memory (with 100000 messages sent it
allocates about 50% of the whole systems memory which is 128MB Ram
and raises upto 75% in subsequent runs). But the whole amount of data
sent is just 5.6 MB.
Where is the rest of the memory spent?
/Bernd
More information about the erlang-questions
mailing list