Re: Haproxy stats socket with nbproc>1

2012-07-30 Thread Willy Tarreau
On Wed, Jul 25, 2012 at 05:14:38PM +0200, Stojan Rancic (Iprom) wrote:
> On 25.7.2012 15:12, Vincent Bernat wrote:
> >  ??? 25 juillet 2012 12:00 CEST, "Stojan Rancic (Iprom)" 
> >   :
> >
> >>is it possible to create a stats socket (or per-process stats socket)
> >>when haproxy is configured with 'nbproc=2' or higher ?
> >
> >Hi!
> >
> >I am unsure if this is possible with a socket. However, you can do it
> >for the web interface.
> 
> It looks like it's only possible to configure the socket in the global 
> configuration section. Thanks for the hint anyway :)

Indeed we can't do this with the global stats sock. I remember having
been thinking about doing something as simple as auto-numbering to have
multiple sockets (one per process) but in the process of doing so, I
faced some issues related to the reloading process, so in the end I
gave up.

Instead I would rather implement cross-process bounces, eg you connect
to a socket on any process, then type "enter XX" where "XX" is the ID
of another process, then haproxy will simply proxy the request to the
other process via an internal socket. Just needs a bit of time to be
done, as usual :-)

Regards,
Willy




Re: haproxy content switching on url parameters?

2012-07-30 Thread Willy Tarreau
Hi,

I wanted to add that since v1.5-dev11, there are the urlp_* matches
which significantly help for matching URL params. I just added urlp_val
to match an integer value this morning when reading this thread, however
as with all other ACL integer values, it only supports unsigned values.

A few points below.

On Mon, Jul 30, 2012 at 09:59:50AM +0200, Holger Just wrote:
> On 2012-07-29 12:56, Reve wrote:
> > How about parsing the same thing but if those have been posted as post, not 
> > get.
> 
> When POSTing data, it will be transmitted in the request body. As the
> body size can be of an arbitrary size and caching and potentially
> parsing it would be a really complex, slow and potentially massively
> resource intensive process, HAProxy doesn't do that at all.

In fact haproxy is already able to perform some limited processing on POST
data right now (eg: balance url_param check-post). We did not want to go
further before reworking the ACL engine. Now that it's been done, I think
it would be great if someone would engage in this, I mean, duplicate the
urlp_* work into postp_* to perform post parameter extraction. And it would
even allow us to stick on such parameters at no extra cost. It should really
be easy to do, I can provide some help if someone wants to do it.

Of course this would be limited by the request size, but that's already the
case for the check-post.

So any volunteers ?

Willy




Re: haproxy content switching on url parameters?

2012-07-30 Thread Holger Just
On 2012-07-29 12:56, Reve wrote:
> How about parsing the same thing but if those have been posted as post, not 
> get.

When POSTing data, it will be transmitted in the request body. As the
body size can be of an arbitrary size and caching and potentially
parsing it would be a really complex, slow and potentially massively
resource intensive process, HAProxy doesn't do that at all.

That means, you can only use the HTTP headers for making a routing
decision. Once all headers are read, the request will be dispatched and
non of the following content will be prsed anymore but will be directly
forwarded (with very restricted exceptions of allowing the check of
binary data at fixed predefined byte offsets in the body).

That said, you will not be able to use ACLs for matching structured data
in the body right now. There are some areas that can optionally read
part of the body in 1.5-dev t least (e.g. some balance algorithms) but
it is not generically available right now.

That might change until the final 1.5 release but is at the discretion
of Willy who is currently rebuilding much of the ACL matching engine.

--Holger