How does Squid does not block on eCap adapter to finish processing

Asked by Jatin

Hello,

My eCap adapter performs various checks on the request and response which may take some time to process. Usually less than a second.

1) I would like to understand that does Squid blocks until eCap adapter finishes processing the transaction.
    (If Squid does not block on eCap to return then how does eCap notify Squid of completion of a transaction)

2) If Squid does not block on eCap would it mean that eCap along with Squid should be able to process thousands of requests per second.

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
eCAP Edit question
Assignee:
No assignee Edit question
Solved by:
Alex Rousskov
Solved:
Last query:
Last reply:
Revision history for this message
Alex Rousskov (rousskov) said :
#1

All eCAP calls are blocking. For example, the host transaction will wait for the host::Xaction::noteVbContentAvailable() method call to return.

Some host applications may be threaded or use multiple processes to avoid blocking the entire host application while waiting for a single eCAP transaction.

It is also possible to implement so called "asynchronous" adapters that work in parallel with the host application even if the host application does not use multiple threads or processes. For documentation, please see doc/async.txt. Asynchronous adapters are supported since libecap v1.0.0. Writing correct asynchronous code is very difficult so use this approach only if necessary and only after you got the basic blocking functionality working well.

Revision history for this message
Jatin (jbhasin83) said :
#2

Production squid version does not support libecap v1.0.0. So does the trunk version which supports libecap v1.0 would support "asynchronous" calls with my adapter ?

Revision history for this message
Best Alex Rousskov (rousskov) said :
#3

Please direct Squid-specific questions to Squid forums, but yes, Squid trunk supports libecap v1.0.0, including its async APIs.

Revision history for this message
Jatin (jbhasin83) said :
#4

Thanks Alex Rousskov, that solved my question.