envoyproxy / envoyproxy/envoy

Socket Statistics: Proposal for reading and displaying OS socket statistics for connections

Open
#8,357 5 comments 0 reactions 0 assignees View on GitHub
design proposal help wanted
Dominant language
C++
Stars
28.9k
Forks
5.6k
Avg merge
1d 20h
Merged PRs (30d)
437

Description

*Description*:
>Expose API for reading socket information for connections.

The intention is very similar to that of any tools like `ss` or `netstat` display. It would be useful to maintain this state as debugging becomes easier.

As an example,
`ss -4 state syn-recv` would display all the tcp ipv4 network connections that are in the syn-recv state. With respect to TCP there are several states that a connection moves through, like `listen`, `syn-sent`, `established`, `fin-wait1` etc. to name a few

Would it be useful to maintain the connection state?

This can also be extended to UDP sockets to see what state sockets are in `unconn` and `estab`

This could be information that envoy can render across all connections or for a specific connection.

***
A specific use-case is addressed below, please read ahead if interested:

Usually it is possible to maintain count of total connections after the TCP three-way handshake. In cases where users are accessing the servers from geographies that have poor internet; there could be several reasons as to why a TCP connection might not be complete.
* The SYN could be dropped as a result of which the server never recognizes the intent of the client to connect.
* The SYN received is responded by a SYN-ACK by Envoy on the server to start establishing a connection(or completing the three-way handshake); however the SYN-ACK never reaches the client. This could happen due to many reasons like having mistaken routing table entries in the peering ISPs, degraded underlying network infrastructure etc.
* The motivation is for envoy running on a node to capture all half open TCP connections and relay it to a BI tool for analytics and resolving this problem
* Having half open connections directly translates to loss in business as this indicates a potential client trying to make a transaction but was unsuccessful due to the infrastructure.
* Furthermore, this client is not recorded in making an attempt to transact; thus the server could be permanently blind to these clients unless monitored.
***

This could be a generic API that can be customized to specific OS (BSD/Linux, macOS, Windows etc) to provide other investigative statistics

[optional *Relevant Links*:]
>https://linux.die.net/man/8/ss
>https://linux.die.net/man/8/netstat

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.