-1

I have a simple web application, All requests to that application are HTTP based (RESTfull API and standard ajax)

I have an haproxy before my tomcat cluster.

So now i have clients that http request from my load balancer and the load balancer then forwards it to my web server (tomcat)

My question is:

Is it possible to make the communication protocol between the load balancer (haproxy) and my tomcat much more faster than http? maybe tcp? and still keep the http requests flow my clients direct towards my load balancer.

EDIT

If i'm not mistaken the protocol map looks somthing like this:

Client -(HTTP)----> Haproxy -(HTTP)---> tomcat

I would like to use tcp for faster performance like so:

Client -(HTTP)----> Haproxy -(TCP)---> tomcat

Isn't the 2nd map much faster than the 1st? but is it possible?

3
  • HTTP already uses TCP. I'm not following what you're trying to accomplish.
    – briantist
    Aug 10 '14 at 15:20
  • See my EDIT please
    – Urbanleg
    Aug 10 '14 at 15:28
  • This makes no sense. The transport is always TCP. How do you expect Tomcat to receive and send data if nothing is selected for Layer 7? Aug 11 '14 at 17:46
3

The data traveling through is (nearly) the same whether you set HAProxy to HTTP or TCP.

Do you think that it will be faster because HAProxy is not interpreting the HTTP traffic? I doubt that you will be able to perceive any difference in performance if you are not using ACLs or otherwise providing additional processing (which you would be giving up with TCP anyway), and even then I would be surprised.

I think the only differences will be that in TCP mode, HAProxy will not be adding the X-Forwarded-For header so you will be losing that information, and in HTTP mode it can block invalid or malformed requests, so you are adding some risk by passing those through.

The HAProxy web site provides detailed performance statistics

intel C2D E8200/2.66GHz
82702 HTTP requests per second with about 20% CPU remaining available

If you're having performance issues, I think you may need to look elsewhere in the setup or provide more detail about the problem you're seeing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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