Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need a TCP load-balancer in front of some servers. I need it to:

  1. Receive a request from client
  2. Open a connection to one of servers (based on load balancing, being alive and so on)
  3. Send the request as an event to the server
  4. Close the connection to the server
  5. Receive an answer from a server
  6. Answer the client's request
  7. Close the connection from client

So I need to be connected to client and receive request and send answer in one connection, but on the other hand send the request to a server and receive the answer from (maybe another) server in two connections.

Can HAProxy fulfil this requirement? If yes, do you know a good guide for that? If no, is there any other load-balancer for this need?

share|improve this question
    
Are you asking for a load balancer that persists the connected clients outside of the connection? –  dtryon Feb 6 '13 at 9:47
    
I do not know the meaning of persisting a client, but I exactly need the load-balancer to connect to the back-end servers asynchronously. I need it to send the request,close the connection, give an answer, recognize which client to send the answer to, and send the answer to client. In all of this time, the client connection will be opened. –  saeed Feb 6 '13 at 11:41
    
In this scenario, how does the server understand who to send the response to? Is it tracked by some sort of message correlation id? –  dtryon Feb 6 '13 at 12:50
    
Yes, all responses has an ID which shows their requests. and a LookUpTable or something will memorize the relation. –  saeed Feb 6 '13 at 13:20
    
Nothing that I have read about HAProxy would suggest that this is possible. It sounds like you need some time of integration pattern (like messaging), not a load balancer. –  dtryon Feb 6 '13 at 14:12
show 1 more comment

2 Answers

up vote 3 down vote accepted

Nothing that I have read about HAProxy would suggest that this is possible. It sounds like you need some kind of integration pattern (like messaging), not a load balancer.

A few good messaging tools to look into are RabbitMQ, ZeroMQ and Redis (which can do pub/sub).

share|improve this answer
    
Mongrel2 is a web-server based on ZeroMQ; not sure how production-ready it is, but the architecture's nice. –  nickgrim Feb 7 '13 at 16:50
add comment

Look at mongrel2. It's based on 0MQ and abstracts the connection from TCP. (I.e. the response can come from anywhere.) http://mongrel2.org/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.