[erlang-questions] Matching IP address in socket module
pablo platt
pablo.platt@REDACTED
Tue Oct 29 11:33:28 CET 2019
Micael, are there similar tests for udp?
On Tue, Oct 29, 2019 at 12:12 PM Micael Karlberg <
micael.karlberg@REDACTED> wrote:
> Hi,
>
> Its not a secret :) You will find it in the emulator test catalog.
> The only problem is that it was never intended for public "consumption"
> and is therefor not documented:
>
> socket_test_ttest_tcp_socket.erl (uses socket.erl)
> socket_test_ttest_tcp_gen.erl (uses gen_tcp.erl)
>
> The idea here is that they should have an "identical" interface (so
> the users should work with both transports).
> Obviously the "socket" is different (a gen_tcp socket is a port and
> a socket socket is a term()).
>
> The other socket_test_ttest_tcp* modules "can" be used to see how to
> use these...
>
> Also, there is work on making gen_tcp work with the new socket module.
> This is ongoing. There is a lot of special options that gen_tcp/inet
> manages (packaging for instance).
>
> Regards,
> /BMK
>
> On 2019-10-29 10:54, Loïc Hoguin wrote:
> > Hello,
> >
> > I would like to do a similar experiment with RabbitMQ. Would you mind
> sharing the code that makes
> > 'socket' work similar to 'gen_tcp'? That may give me a head start, even
> if the code is not complete.
> >
> > Thanks,
> >
> > On 25/10/2019 12:39, Micael Karlberg wrote:
> >> Hi,
> >>
> >> Its early days still, but the goal is definitely that it should
> >> be faster.
> >>
> >> Here is some figures from a (time) test tool which is part of the
> >> test suite (its basically a ping-pong case), both server and client
> >> running on the same host (but in different VMs):
> >>
> >> Two transports:
> >> gen: gen_tcp
> >> sock: socket (tcp)
> >>
> >> The socket active mode is a simulation of gen_tcp active mode
> >> (no active = N).
> >>
> >> The tables are the exchange from the client side.
> >>
> >> With server side using gen (active = false):
> >>
> >> Transport Active Data
> >> gen false 10192 byte/ms, 154 msgs/ms
> >> gen true 10383 byte/ms, 157 msgs/ms
> >> gen once 6003 byte/ms, 90 msgs/ms
> >> sock false 14050 byte/ms, 212 msgs/ms
> >> sock true 14772 byte/ms, 223 msgs/ms
> >> sock once 14050 byte/ms, 210 msgs/ms
> >>
> >>
> >> With server side using gen (active = true):
> >>
> >> Transport Active Data
> >> gen false 9447 byte/ms, 143 msgs/ms
> >> gen true 22345 byte/ms, 338 msgs/ms
> >> gen once 5532 byte/ms, 83 msgs/ms
> >> sock false 15316 byte/ms, 232 msgs/ms
> >> sock true 23693 byte/ms, 358 msgs/ms
> >> sock once 22068 byte/ms, 334 msgs/ms
> >>
> >>
> >> With server side using sock (active = false, async = true):
> >>
> >> Transport Active Data
> >> gen false 11260 byte/ms, 170 msgs/ms
> >> gen true 22273 byte/ms, 337 msgs/ms
> >> gen once 7703 byte/ms, 116 msgs/ms
> >> sock false 15211 byte/ms, 230 msgs/ms
> >> sock true 24778 byte/ms, 375 msgs/ms
> >> sock once 23086 byte/ms, 349 msgs/ms
> >>
> >>
> >> With server side using sock (active = true, async = true):
> >>
> >> Transport Active Data
> >> gen false 11351 byte/ms, 171 msgs/ms
> >> gen true 22469 byte/ms, 340 msgs/ms
> >> gen once 7407 byte/ms, 112 msgs/ms
> >> sock false 15484 byte/ms, 234 msgs/ms
> >> sock true 24885 byte/ms, 377 msgs/ms
> >> sock once 23570 byte/ms, 357 msgs/ms
> >>
> >>
> >> There is of course a bit of overhead since the socket transport
> >> is trying to emulate (part of) gen_tcp.
> >>
> >> This is run on a Dell Precision T1700 running SLES 12 SP2 (not that
> >> that effects the relative performance).
> >> Run with a snapshot from the maint branch.
> >>
> >> This is obviously not a real use case, but it can be a guideline.
> >> Also no UDP test (at the moment).
> >>
> >> /BMK
> >>
> >> On 2019-10-24 18:48, Frank Muller wrote:
> >>> Hi Thomas
> >>>
> >>> Is the socket module faster than gen_tcp/gen_udp in your case? If yes,
> can you please share some
> >>> numbers.
> >>>
> >>> /Frank
> >>>
> >>> > case socket:recvfrom(Sock, 0, nowait) of
> >>> > {ok, {#{family := Domain,
> >>> > port := Port,
> >>> > addr := Addr}, Data}} ->
> >>> > .
> >>>
> >>> Hi Micael, Mark,
> >>>
> >>> thanks for your replies. The snippet above helped me getting the
> record
> >>> matched.
> >>>
> >>> I'm quite impressed with the socket module, it seems to be pretty
> >>> complete, at least for my application.
> >>>
> >>> Thanks,
> >>> Thomas
> >>>
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20191029/0eeec593/attachment.htm>
More information about the erlang-questions
mailing list