SO_FLOW_SLA socket option in Solaris 11.2

We have added a new socket option, SO_FLOW_SLA, in Solaris 11.2 to allow an application to create socket level flows and set resource control properties on them using setsockopt(). This socket option requires PRIV_SYS_FLOW_CONFIG privilege.

The setsockopt(3C) man page has all the details of the programming API. It is simple to use as shown below -

sock_flow_props_t sprop;

sock = socket(AF_INET, SOCK_STREAM, 0);
sprop.sfp_version = SOCK_FLOW_PROP_VERSION1;
sprop.sfp_mask = SFP_MAXBW;
sprop.sfp_maxbw = 500000000; /* 500 Mbps */
setsockopt(sock, SOL_SOCKET, SO_FLOW_SLA, &sprop, sizeof (sprop));

The flows created using setsockopt(3C) can be observed using flowadm(1M), flowstat(1M) as well as from pfiles(1).

Consider the example of the nc(1)/netcat tool which uses this socket option to implement the -M option.

a. Assume nc -l 80 is running on 10.2.3.118 and run
# nc -M maxbw=100M 10.2.3.118 80
...

And in another window we observe -

# flowadm
FLOW LINK PROTO LADDR LPORT RADDR RPORT DSFLD
24.sys.sock net1 tcp 10.2.3.117 38769 10.2.3.118 80 --

# flowadm show-flowprop
FLOW PROPERTY PERM VALUE DEFAULT POSSIBLE
24.sys.sock maxbw rw 100 -- --
24.sys.sock priority rw -- medium low,medium,high

# pfiles `pgrep nc`
18827: nc -M maxbw=100M 10.2.3.118 80
...
3: S_IFSOCK mode:0666 dev:556,0 ino:5341 uid:0 gid:0 size:0
O_RDWR
SOCK_STREAM
SO_SNDBUF(49152),SO_RCVBUF(128872),
SO_FLOW_SLA(maxbw: 100.000 mbits/sec)
sockname: AF_INET 10.2.3.117 port: 38769
peername: AF_INET 10.2.3.118 port: 80
congestion control: newreno
...

Comments:

Cool thing. Will it survive tens of thousands different socket flows?

Posted by sscdvp on May 08, 2014 at 11:36 AM PDT #

Yes. There is no limit on the number of socket flows that can be created.
The flow lookup uses a hash table and the lookup cost is minimal.

Posted by krishna on May 08, 2014 at 02:43 PM PDT #

Post a Comment:
Comments are closed for this entry.
About

I am an engineer in the Solaris kernel networking group.

Search

Categories
Archives
« March 2015
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    
       
Today
Blogroll