# Unexpected queue wait latency while inspecting req.ssl\_sni

**URL:** <https://discourse.haproxy.org/t/unexpected-queue-wait-latency-while-inspecting-req-ssl-sni/6693>\
**Category:** Help!\
**Created:** [July 2, 2021, 2:22am UTC](https://discourse.haproxy.org/t/unexpected-queue-wait-latency-while-inspecting-req-ssl-sni/6693 "2021-07-02T02:22:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shadyabhi](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@shadyabhi](https://discourse.haproxy.org/u/shadyabhi)\
**Post date:** [July 2, 2021, 2:22am UTC](https://discourse.haproxy.org/t/unexpected-queue-wait-latency-while-inspecting-req-ssl-sni/6693/1 "2021-07-02T02:22:26Z")

</div>

I’m using HAProxy in TCP mode and I’ve a requirement to log SNI in a HTTPS requesst. To get the SNI value, I’m reading the raw socket buffer.

```auto
   tcp-request inspect-delay 3s
   tcp-request content capture req.ssl_sni len 100

```

It works, but I’ve noticed considerably high `%Tw` time when doing this. For perspective, without using the `SNI extraction` block, I see value as just `1`, but with the SNI extraction block and logging, the `%Tw` value is as high as `~150`.

I’m unable to understand why this would happen. Why is tcp inspect causing increased latency for simply waiting for a connection slot? To add to that, why is it `150x`, too crazy.

Interesting piece of information that I don’t want to leave out, in my case, since this is TCP proxy, SSL termination is done by the backend.

Log without SNI extraction:-

```auto
{
  "date_time": "01/Jul/2021:14:40:41.665",
  "client": "127.0.0.1:36372",
  "frontend": "public_tcp_https/127.0.0.1:8443",
  "backend": "lx_https/ltx1-app1019.stg.domain.com/10.153.53.236:22272",
  "Tw_time_queue_wait": "1",
  "Tc_time_connect": "79",
  "Tt_time_total": "597",
  "bytes_read": "9699",
  "bytes_uploaded": "445",
  "ts_termination_state": "--",
  "actconn/feconn/beconn/srv_conn/retries": "1/1/0/0/0",
  "srv_queue/backend_queue": "0/0",
  "client_rtt/rttvar/unacked/sacked/retrans/fackets/lost/reordering": "0/0/1/0/0/0/0/3",
  "host/sni": "-"
}

```

Log with SNI extraction:-

```auto
{
  "date_time": "01/Jul/2021:14:34:44.014",
  "client": "127.0.0.1:59818",
  "frontend": "public_tcp_https/127.0.0.1:8443",
  "backend": "lx_https/ltx1-app1019.stg.domain.com/10.153.53.236:22272",
  "Tw_time_queue_wait": "170",
  "Tc_time_connect": "80",
  "Tt_time_total": "674",
  "bytes_read": "9699",
  "bytes_uploaded": "445",
  "ts_termination_state": "--",
  "actconn/feconn/beconn/srv_conn/retries": "1/1/0/0/0",
  "srv_queue/backend_queue": "0/0",
  "client_rtt/rttvar/unacked/sacked/retrans/fackets/lost/reordering": "0/0/1/0/0/0/0/3",
  "host/sni": "www.domain.com"
}

```

---

<div class="post-metadata">

**Author:** ![shadyabhi](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@shadyabhi](https://discourse.haproxy.org/u/shadyabhi)\
**Post date:** [July 7, 2021, 1:33am UTC](https://discourse.haproxy.org/t/unexpected-queue-wait-latency-while-inspecting-req-ssl-sni/6693/2 "2021-07-07T01:33:46Z")

</div>

Bump! Will truly appreciate a response
