gen_udp:recv()
Andreas Schultz
andreas.schultz@REDACTED
Wed Apr 7 14:24:51 CEST 2021
On Linux and BSD, the recvmmsg would can read multiple packets at once.
Adding it to gen_udp might be impractical, but the new socket module would
be a good place for a function that uses that system call.
Am Mi., 7. Apr. 2021 um 13:19 Uhr schrieb Avinash Dhumane <
trigunatit@REDACTED>:
> Our case is similar. The stock exchange disseminates the market movements
> (called, ticks) as stream of variable length messages (datagrams or
> packets), each less than 50 bytes, and each stamped with sequence number,
> over multicast (udp) streams, each stream replicated so that if a packet is
> missed (dropped) – due to the nature of underlying udp – it may be received
> on the replicated stream (before fallback on a tcp-based recovery server).
>
>
>
> The message rate (without replication) exceeds 100K per second. Issuing as
> many calls, at Erlang-application level, viz. gen_udp:recv, is impractical,
> though I suppose, at underlying OS system-call level, each datagram must be
> received using a separate call. Therefore, I believed, that Erlang might
> provide an abstraction, which packs a number of datagrams (packets /
> messages) arrived so far and deliver to the application, for further
> handling. One-to-one call from app to Erlang, and further from Erlang to
> OS, for each datagram, would seem too much taxing.
>
>
>
>
>
> *From: *Max Lapshin <max.lapshin@REDACTED>
> *Sent: *06 April 2021 10:20 PM
> *To: *Łukasz Niemier <lukasz@REDACTED>
> *Cc: *Erlang Questions <erlang-questions@REDACTED>
> *Subject: *Re: gen_udp:recv()
>
>
>
> Exactly.
>
>
>
> We receive MPEG-TS _stream_ in multicast messages and it is very
>
> painful to receive so many messages (it can be around 90K per second
>
> totally or 300-900 per one stream per second) one by one. Reducing
>
> this about by 10 decreases CPU usage a lot.
>
>
>
>
>
>
>
>
>
> On Tue, Apr 6, 2021 at 6:31 PM Łukasz Niemier <lukasz@REDACTED> wrote:
>
> >
>
> > > Well, I like the idea to receive 20-200 UDP messages in a single
>
> > > binary with separate structure holding mapping of this data.
>
> >
>
> > Then it sounds like you want stream protocol instead of packet protocol.
>
> > The whole idea of packet protocol is to receive messages in packets.
>
> >
>
> > --
>
> >
>
> > Łukasz Niemier
>
> > lukasz@REDACTED
>
> >
>
>
>
--
Andreas Schultz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20210407/87ac9647/attachment.htm>
More information about the erlang-questions
mailing list