Do responses from server have to go through load balancer or directly to client?
I am trying to build my own load balancer on C++. But not sure whether all packets(both requests and responses) between client and server have to go through load balancer.
- Should it just help finding the server for a client and then leave them communicating between each other directly?
- Or should it be "full-duplex" where not only requests but also responses are going through it?
networking ip routing load-balancer
add a comment |
I am trying to build my own load balancer on C++. But not sure whether all packets(both requests and responses) between client and server have to go through load balancer.
- Should it just help finding the server for a client and then leave them communicating between each other directly?
- Or should it be "full-duplex" where not only requests but also responses are going through it?
networking ip routing load-balancer
add a comment |
I am trying to build my own load balancer on C++. But not sure whether all packets(both requests and responses) between client and server have to go through load balancer.
- Should it just help finding the server for a client and then leave them communicating between each other directly?
- Or should it be "full-duplex" where not only requests but also responses are going through it?
networking ip routing load-balancer
I am trying to build my own load balancer on C++. But not sure whether all packets(both requests and responses) between client and server have to go through load balancer.
- Should it just help finding the server for a client and then leave them communicating between each other directly?
- Or should it be "full-duplex" where not only requests but also responses are going through it?
networking ip routing load-balancer
networking ip routing load-balancer
asked Dec 24 '18 at 6:19
TeamBeamTeamBeam
32
32
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
This depends on the setup in most cases all traffic would go through the load balancer in both directions as this is the "safest" and easiest configuration. There are also advantages from a network security POV as you can better isolate servers from end users.
For a tcp session to work the source and Target IP addresses and ports need to be consistent per tcp stream. While it is possible to have multiple systems respond on the same IP, you are asking for pain and difficulty when things go wrong.
If you want to do this without having the load balancer in the critical path you may want to do this at a DNS level rather then a load balancer level.
Casting my mind back to the distant past I recall LVS (http://www.linuxvirtualserver.org/how.html) which has 3 different mechanisms for load balancing and would be useful reading. I have not used this for a very long time, and I am not convinced it's better then Apache or equivalent load balancing solutions though. [The Internet has moved on and this document is 30 years old. Egress filtering and security in depth we're not really a thing then, and computers were much, much slower. Also, you can't use it to strip https -> http, very useful today]
Thank you for your answer, if all traffic to be passed through load balancer, should I store ip-address of requester or put it in header, is there a specific header-field for such purposes to ensure that server will reply with this header as well?
– TeamBeam
Dec 24 '18 at 6:51
Not sure what your goal is. In general you would terminate the incoming web request (I assume it's a web request because you mentioned header) and then initiate a request from the load balancer, adding an X-FORWARDED-FOR header with the appropriate client address that can then be used by the software in place of the originating IP. This is a standard header (and may exist more then once)
– davidgo
Dec 24 '18 at 6:55
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1387289%2fdo-responses-from-server-have-to-go-through-load-balancer-or-directly-to-client%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This depends on the setup in most cases all traffic would go through the load balancer in both directions as this is the "safest" and easiest configuration. There are also advantages from a network security POV as you can better isolate servers from end users.
For a tcp session to work the source and Target IP addresses and ports need to be consistent per tcp stream. While it is possible to have multiple systems respond on the same IP, you are asking for pain and difficulty when things go wrong.
If you want to do this without having the load balancer in the critical path you may want to do this at a DNS level rather then a load balancer level.
Casting my mind back to the distant past I recall LVS (http://www.linuxvirtualserver.org/how.html) which has 3 different mechanisms for load balancing and would be useful reading. I have not used this for a very long time, and I am not convinced it's better then Apache or equivalent load balancing solutions though. [The Internet has moved on and this document is 30 years old. Egress filtering and security in depth we're not really a thing then, and computers were much, much slower. Also, you can't use it to strip https -> http, very useful today]
Thank you for your answer, if all traffic to be passed through load balancer, should I store ip-address of requester or put it in header, is there a specific header-field for such purposes to ensure that server will reply with this header as well?
– TeamBeam
Dec 24 '18 at 6:51
Not sure what your goal is. In general you would terminate the incoming web request (I assume it's a web request because you mentioned header) and then initiate a request from the load balancer, adding an X-FORWARDED-FOR header with the appropriate client address that can then be used by the software in place of the originating IP. This is a standard header (and may exist more then once)
– davidgo
Dec 24 '18 at 6:55
add a comment |
This depends on the setup in most cases all traffic would go through the load balancer in both directions as this is the "safest" and easiest configuration. There are also advantages from a network security POV as you can better isolate servers from end users.
For a tcp session to work the source and Target IP addresses and ports need to be consistent per tcp stream. While it is possible to have multiple systems respond on the same IP, you are asking for pain and difficulty when things go wrong.
If you want to do this without having the load balancer in the critical path you may want to do this at a DNS level rather then a load balancer level.
Casting my mind back to the distant past I recall LVS (http://www.linuxvirtualserver.org/how.html) which has 3 different mechanisms for load balancing and would be useful reading. I have not used this for a very long time, and I am not convinced it's better then Apache or equivalent load balancing solutions though. [The Internet has moved on and this document is 30 years old. Egress filtering and security in depth we're not really a thing then, and computers were much, much slower. Also, you can't use it to strip https -> http, very useful today]
Thank you for your answer, if all traffic to be passed through load balancer, should I store ip-address of requester or put it in header, is there a specific header-field for such purposes to ensure that server will reply with this header as well?
– TeamBeam
Dec 24 '18 at 6:51
Not sure what your goal is. In general you would terminate the incoming web request (I assume it's a web request because you mentioned header) and then initiate a request from the load balancer, adding an X-FORWARDED-FOR header with the appropriate client address that can then be used by the software in place of the originating IP. This is a standard header (and may exist more then once)
– davidgo
Dec 24 '18 at 6:55
add a comment |
This depends on the setup in most cases all traffic would go through the load balancer in both directions as this is the "safest" and easiest configuration. There are also advantages from a network security POV as you can better isolate servers from end users.
For a tcp session to work the source and Target IP addresses and ports need to be consistent per tcp stream. While it is possible to have multiple systems respond on the same IP, you are asking for pain and difficulty when things go wrong.
If you want to do this without having the load balancer in the critical path you may want to do this at a DNS level rather then a load balancer level.
Casting my mind back to the distant past I recall LVS (http://www.linuxvirtualserver.org/how.html) which has 3 different mechanisms for load balancing and would be useful reading. I have not used this for a very long time, and I am not convinced it's better then Apache or equivalent load balancing solutions though. [The Internet has moved on and this document is 30 years old. Egress filtering and security in depth we're not really a thing then, and computers were much, much slower. Also, you can't use it to strip https -> http, very useful today]
This depends on the setup in most cases all traffic would go through the load balancer in both directions as this is the "safest" and easiest configuration. There are also advantages from a network security POV as you can better isolate servers from end users.
For a tcp session to work the source and Target IP addresses and ports need to be consistent per tcp stream. While it is possible to have multiple systems respond on the same IP, you are asking for pain and difficulty when things go wrong.
If you want to do this without having the load balancer in the critical path you may want to do this at a DNS level rather then a load balancer level.
Casting my mind back to the distant past I recall LVS (http://www.linuxvirtualserver.org/how.html) which has 3 different mechanisms for load balancing and would be useful reading. I have not used this for a very long time, and I am not convinced it's better then Apache or equivalent load balancing solutions though. [The Internet has moved on and this document is 30 years old. Egress filtering and security in depth we're not really a thing then, and computers were much, much slower. Also, you can't use it to strip https -> http, very useful today]
answered Dec 24 '18 at 6:37
davidgodavidgo
43.4k75291
43.4k75291
Thank you for your answer, if all traffic to be passed through load balancer, should I store ip-address of requester or put it in header, is there a specific header-field for such purposes to ensure that server will reply with this header as well?
– TeamBeam
Dec 24 '18 at 6:51
Not sure what your goal is. In general you would terminate the incoming web request (I assume it's a web request because you mentioned header) and then initiate a request from the load balancer, adding an X-FORWARDED-FOR header with the appropriate client address that can then be used by the software in place of the originating IP. This is a standard header (and may exist more then once)
– davidgo
Dec 24 '18 at 6:55
add a comment |
Thank you for your answer, if all traffic to be passed through load balancer, should I store ip-address of requester or put it in header, is there a specific header-field for such purposes to ensure that server will reply with this header as well?
– TeamBeam
Dec 24 '18 at 6:51
Not sure what your goal is. In general you would terminate the incoming web request (I assume it's a web request because you mentioned header) and then initiate a request from the load balancer, adding an X-FORWARDED-FOR header with the appropriate client address that can then be used by the software in place of the originating IP. This is a standard header (and may exist more then once)
– davidgo
Dec 24 '18 at 6:55
Thank you for your answer, if all traffic to be passed through load balancer, should I store ip-address of requester or put it in header, is there a specific header-field for such purposes to ensure that server will reply with this header as well?
– TeamBeam
Dec 24 '18 at 6:51
Thank you for your answer, if all traffic to be passed through load balancer, should I store ip-address of requester or put it in header, is there a specific header-field for such purposes to ensure that server will reply with this header as well?
– TeamBeam
Dec 24 '18 at 6:51
Not sure what your goal is. In general you would terminate the incoming web request (I assume it's a web request because you mentioned header) and then initiate a request from the load balancer, adding an X-FORWARDED-FOR header with the appropriate client address that can then be used by the software in place of the originating IP. This is a standard header (and may exist more then once)
– davidgo
Dec 24 '18 at 6:55
Not sure what your goal is. In general you would terminate the incoming web request (I assume it's a web request because you mentioned header) and then initiate a request from the load balancer, adding an X-FORWARDED-FOR header with the appropriate client address that can then be used by the software in place of the originating IP. This is a standard header (and may exist more then once)
– davidgo
Dec 24 '18 at 6:55
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1387289%2fdo-responses-from-server-have-to-go-through-load-balancer-or-directly-to-client%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown