[squid-users] concurrency with ecap

Alex Rousskov rousskov at measurement-factory.com
Fri Apr 28 00:03:00 UTC 2017


On 04/27/2017 03:33 PM, Yuri Voinov wrote:

> is it possible to get comprehensive example?

FYI: This is an eCAP question, not a Squid-specific question; you also
start discussing development. Such questions are better asked via eCAP
support channels[1] rather than on squid-users:

  [1] http://www.e-cap.org/Support

Virtually any eCAP adapter supports concurrent transactions. Concurrency
is built into the API. Many adapters do not make costly/lengthy
decisions so they do not need "threads" (just like many Squids do not
need threads to process thousands of transactions concurrently). Some
adapters that do make those lengthy decisions block the application
process while others use multiple threads (or multiple processes) to
minimize blocking.

IIRC, the eCAP ClamAV adapter[2] uses threads to minimize blocking. You
may use it as a comprehensive example.

  [2] http://www.e-cap.org/Downloads


> Adapter sample is non-obvious, not complete (non-obvious where to put
> mutex locking) and contains C-style rudiments (like external call,
> pthread.h etc.).
> 
> I think, this will be actual in 2017, with CMT world around.

I doubt there are high-quality public adapters that use C++11 threading
interfaces (if that is what you are looking for). Several aspects
contribute to that, including:

* There were no stable host applications that supported C++11 until
recently and few are going to rewrite older working adapters just to add
C++11 bells and whistles.

* IIRC, initial attempts to use C++11 thread-related atomic APIs in
Squid have failed due to poor compiler support (this is not related to
eCAP but illustrates that you are talking about state-of-the-art
features rather than something that is widely supported, used, and
understood like pthreads).

* The official libecap library itself is still using a couple of
pre-C++11 components (and changing that is difficult[3,4]!).

  [3] https://bugs.launchpad.net/ecap/+bug/1595488
  [4] https://bugs.launchpad.net/ecap/+bug/1595562

In summary, it may take some time for that C++11 threading technology to
surface in eCAP adapters.


HTH,

Alex.



More information about the squid-users mailing list