Direct Server Return (DSR) is a network configuration used in load balancing to forward incoming requests to a backend server, and then send server responses directly back to the client.
Normally, a load balancer would receive this server response before sending it to the client. This traditional server > balancer > client response loop is the easiest (and often default) configuration while better isolating servers from end users.
How does direct server return work?
Request and response traffic use a different network path in a direct server return setup. This approach uses fewer network hops to transmit information, reduces overall latency, and therefore increases overall application performance. Application users will notice faster response times. Plus, a decrease in network hops equates to better performance at scale, since the load balancer isn't a potential bottleneck. Few if any infrastructure changes are needed to implement direct server return.
Benefits aside, DSR does come with some drawbacks:
A loss of cookie persistence in favor of source IP or destination IP
Loss of SSL/TLS offloading, since the load balancer can no longer inspect both inbound and outbound traffic
Potential Address Resolution Protocol (ARP) problems with the underlying OS
While it's not a perfect solution, direct server return is perfect for organizations that value raw performance. It's ideal for applications or functions with high bandwidth requirements—such as video games, multimedia streaming, and others. Direct server return also preserves the client's IP address at the server level. This lets you gather IP statistics and apply IP address-based filters to control your traffic.
Does HAProxy offer direct server return?
Yes! HAProxy ALOHA supports direct server return. To learn more about implementation options and configurations, check out our direct server return documentation.