# Loadbalancing TCP requests

**URL:** <https://discourse.haproxy.org/t/loadbalancing-tcp-requests/4243>\
**Category:** Help!\
**Created:** [August 27, 2019, 8:50pm UTC](https://discourse.haproxy.org/t/loadbalancing-tcp-requests/4243 "2019-08-27T20:50:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rw83](https://avatars.discourse-cdn.com/v4/letter/r/ebca7d/32.png) [@rw83](https://discourse.haproxy.org/u/rw83)\
**Post date:** [August 27, 2019, 8:50pm UTC](https://discourse.haproxy.org/t/loadbalancing-tcp-requests/4243/1 "2019-08-27T20:50:07Z")

</div>

My set up is with one client node and two back end nodes and a HAProxy server sitting between the client node and the back end nodes. The client node sends requests to the HAProxy and my expectation is the requests will be load balanced as per below configuration. Which is first request goes to server1 and the next one goes to server2 and so on.

backend tcp\_back  
mode tcp  
balance roundrobin  
option tcp-check  
tcp-check connect  
option tcpka  
timeout connect 500  
timeout client 50000  
timeout server 50000

server server1 10.10.10.1:3001 check  
server server2 10.10.10.2:3001 check

But the problem is if I send back to back requests from my client node, all of those requests will end up in one backend server. But if I wait for some time ( I believe if I let the session expire by waiting for the timeout server setting) and then make a request, it will go to the second server. Could some one explain what happens here?

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [August 28, 2019, 8:15am UTC](https://discourse.haproxy.org/t/loadbalancing-tcp-requests/4243/2 "2019-08-28T08:15:49Z")

</div>

There is no concept of requests or transactions when you are using tcp mode.

A TCP connection is established on the frontend and a corresponding TCP connection is established on the backend between haproxy and the backend server.

Whatever your application does within that TCP connection, stays within that TCP connection. Haproxy has no way to know.

Unless your application establishes a new TCP connection, load-balancing will not occur.

---

<div class="post-metadata">

**Author:** ![rw83](https://avatars.discourse-cdn.com/v4/letter/r/ebca7d/32.png) [@rw83](https://discourse.haproxy.org/u/rw83)\
**Post date:** [September 3, 2019, 4:06pm UTC](https://discourse.haproxy.org/t/loadbalancing-tcp-requests/4243/3 "2019-09-03T16:06:24Z")

</div>

Thank you @lukastribus for your reply.
