<p>Stratum is not HTTP, it's a protocol designed directly on top of TCP.</p>

<p>You could use an existing load balancer that works on the TCP level, directing new TCP connection attempts to backend servers. After a client is connected it keeps talking to the same backend.</p>

<p>All Stratum work is related to one connection. Proofs of work from clients must be sent over the same connection where the work data was previously received. There can be no confusion about jobs, and there is no need to open more than one connection.</p>

<p>There's no need for the load balancer to look at individual stratum requests, or even to understand the stratum protocol. It might be an advantage for the load balancer to be able to tell a client to reconnect to get it over on a different backend, if the backend it is on is overloaded. In this case you'd need to create your own stratum load balancing software - you couldn't use a generic load balancer for this. I'm not sure if such a feature is really important though. Disconnecting a client is probably just as effective if you want it to reconnect to the same IP address anyway (the IP address of the load balancer).</p>

<p>Note that, assuming your mining server software is somewhat efficient, a single server would be able to run even the biggest mining pool today. So a setup like this is probably only useful for failover, not so much for balancing load.</p>

CC BY-SA 3.0
2015-01-04T19:09:57.930Z
[HAProxy](http://www.haproxy.org/) is one such TCP load balancer.
Nick ODell
CC BY-SA 3.0
2014-07-08T14:30:44.340Z
2014-07-08T14:30:44.340Z
Dr.Haribo
<p>Does the Stratum protocol works well with the stratum servers behind a load balancer?</p>

<p>My impression is that each request from the client may hit a different stratum server and eventaully ends up subscribing to both stratum servers. Does this mean both stratum server will be sending jobs to the client at the same time, confusing the client?</p>

<mining-pools><stratum><bandwidth>
Stratum and Load Balancer
Athena Wisdom
# Stratum and Load Balancer

(Asked by: username_0 on 2014-07-07)

Does the Stratum protocol works well with the stratum servers behind a load balancer?

My impression is that each request from the client may hit a different stratum server and eventaully ends up subscribing to both stratum servers. Does this mean both stratum server will be sending jobs to the client at the same time, confusing the client?

**Tags:** mining-pools, stratum, bandwidth


---

## 1 answers

### Answer by username_1 on 2014-07-08. Score: 1

Stratum is not HTTP, it's a protocol designed directly on top of TCP.

You could use an existing load balancer that works on the TCP level, directing new TCP connection attempts to backend servers. After a client is connected it keeps talking to the same backend.

All Stratum work is related to one connection. Proofs of work from clients must be sent over the same connection where the work data was previously received. There can be no confusion about jobs, and there is no need to open more than one connection.

There's no need for the load balancer to look at individual stratum requests, or even to understand the stratum protocol. It might be an advantage for the load balancer to be able to tell a client to reconnect to get it over on a different backend, if the backend it is on is overloaded. In this case you'd need to create your own stratum load balancing software - you couldn't use a generic load balancer for this. I'm not sure if such a feature is really important though. Disconnecting a client is probably just as effective if you want it to reconnect to the same IP address anyway (the IP address of the load balancer).

Note that, assuming your mining server software is somewhat efficient, a single server would be able to run even the biggest mining pool today. So a setup like this is probably only useful for failover, not so much for balancing load.

> **Comments:**
> **username_2**: [HAProxy](http://www.haproxy.org/) is one such TCP load balancer.  

---

