Hi Ben,

First, thanks for your quick response.

On Mon, Jan 21, 2019 at 03:05:08PM +0000, Ben Shillito wrote:
> Hi Willy,
> 
> I'd like to point out that the 51Degrees API does in fact support
> multi-threaded operation by default. The HAProxy makefile however, explicitly
> uses the FIFTYONEDEGREES_NO_THREADING compile option to disable this when
> building (https://github.com/haproxy/haproxy/blob/master/Makefile#L740).

OK!

> Multi-threaded operation in the API is tested under maximum load before every
> release as can be seen here:
> https://github.com/51Degrees/Device-Detection/blob/master/VisualStudio/UnitTests/Performance/Base.cs#L89
> 
> Mutli-threaded operation is also stress tested in conjunction with many
> threads detecting User-Agents, and another reloading the data file repeatedly
> as seen here:
> https://github.com/51Degrees/Device-Detection/blob/master/examples/ReloadFromFile.c

Oh, rest assured that I have no doubt about the API's support itself,
what I mean is that 51d.c in haproxy is not thread-compatible right now
(at least due to the makefile entry above and to the test in 51d.c) while
haproxy is built with threading on by default, and I find it suspicious
that nobody noticed after more than one year. But it's very possible that
for now nobody is interested in deploying it with threads.

At the moment I'm concerned by the fact that in the whole project there
remains exactly two files which are incompatible with thread support and
as you can imagine it's always a pain to have to deal with exceptions
like this.

> If multi-threaded support is an issue, then it is a trivial change to the
> makefile to align the HAProxy build to the 51Degrees default, and give the
> option to disable threading for those who require that.

Excellent! What I can suggest then is to set this define only when
USE_THREAD is not set. This way you can make sure that 51d.c and the
rest of haproxy are always aligned regarding thread support.

Feel free to send a patch, I'll happily merge it and even backport
it so that we don't have to worry anymore about the compatbility
between threads and various options.

Thanks!
Willy

Reply via email to