[erlang-questions] Matching IP address in socket module
Micael Karlberg
micael.karlberg@REDACTED
Fri Oct 25 12:39:07 CEST 2019
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
>
More information about the erlang-questions
mailing list