Re: Debugging tool for HAProxy

From: Willy Tarreau <w#1wt.eu>
Date: Thu, 17 Apr 2008 06:32:29 +0200


Hi Christoph,

On Wed, Apr 16, 2008 at 12:30:08PM -0700, Christoph Dorn wrote:
> I am the developer of FirePHP (http://www.firephp.org/) which is a
> debugging tool for PHP. It allows you to print debug messages from PHP
> on the server to the Firebug (http://www.getfirebug.com/) Console. It
> sends the debug data in the response headers instead of the response
> body so that page rendering in the browse is not affected.
>
> I was wondering if this could be a useful tool to help in
> troubleshooting HAProxy configurations. HAProxy could insert some debug
> messages into the response headers which will then be picked up by the
> FirePHP extension. For each request, the user could then see what
> HAProxy did to service it right in the browser instead of having to go
> to the log files.
>
> There could be a new configuration directive for HAProxy that enables
> the debug messages for specific IP's for instance.
>
> The data in the header looks something like this:
>
> X-FirePHP-Data-100000000001 {
> X-FirePHP-Data-300000000001 "FirePHP.Firebug.Console":[
> X-FirePHP-Data-399999999999 ["__SKIP__"]],
> X-FirePHP-Data-999999999999 "__SKIP__":"__SKIP__"}
> X-FirePHP-Data-200000000001 "FirePHP.Dump":{
> X-FirePHP-Data-299999999999 "__SKIP__":"__SKIP__"},
> X-FirePHP-Data-355892512100 ["LOG","Hello World"],
> X-FirePHP-Data-355892528800 ["LOG","Log message"],
> X-FirePHP-Data-355892542900 ["INFO","Info message"],
> X-FirePHP-Data-355892557000 ["WARN","Warn message"],
> X-FirePHP-Data-355892571600 ["ERROR","Error message"],
> X-FirePHP-Data-355892599600 ["LOG",["Label","Message with label"]],
>
> It is simply a JSON (http://www.json.org) string that is broken up into
> different sections which are sorted by their numeric index. HAProxy
> could thus insert its debug messages into an existing structure or
> create its own if it did not already detect one from the application server.
>
> You can see how this looks in the Firebug Console at:
> http://www.firephp.org/
>
> Is this something that would be useful to have for HAProxy users?

Well, I don't know, I've never used such a tool, so I don't really know if it can provide any help. Also, I think that it could cause a major performance hit, so I don't know if a lot of people would use it.

Also, I'm wondering about something. While I understand what it can bring to an application, I have more doubts in the case of a proxy, because if you use the response headers to add your data, you are limited to statistics you know before getting the data. An application would know everything at this stage, but a proxy's useful statistics are not limited to what is known at this stage. Maybe I'm missing something ?

> On another note, Firefox accepts headers that are up to 10,000
> characters long. Is there any limits in the standard HTTP protocol that
> restricts the length of headers?

Unfortunately, no. That's a major problem since each implementation choses a different limit :-(

> Is there a maximum length that is
> supported by all main-stream proxy server implementations?

Apache supports at most 8192 characters per header and at most 100 headers.

But from what I see in your example, there are several headers (X-FirePHP-Data-XXXXXX), or is it instead just one header (X-FirePHP-Data) which starts with the numeric index ?

Regards,
Willy Received on 2008/04/17 06:32

This archive was generated by hypermail 2.2.0 : 2008/04/17 06:46 CEST