chibenwa opened a new pull request, #313:
URL: https://github.com/apache/apisix-java-plugin-runner/pull/313

   Please answer these questions before submitting a pull request
   
   - Why submit this pull request?
   - [ ] Bugfix
   - [X] New feature provided
   - [ X Improve performance
   
   - Related issues 
https://issues.apache.org/jira/projects/APISIX/issues/APISIX-38
   
   ___
   ### Bugfix
   
   CF https://github.com/apache/apisix-java-plugin-runner/issues/264
   
   The lack of asyn support in this plugin is a major showstopper for doing 
anything complex.
   
   Turns out I need to call a Redis DBs as part of an OIDC logout workflow cf 
   
   And I need to avoid blocking on the event loop. The current semantic do not 
allow for this!
   ___
   ### New feature or improvement
   
   It turns out that callback based APIs are trivial to adapt to asynchronous 
code.
   
   What we just need is wrap the "write to the client" stuff in the callback. 
We thus implement the write as a terminal filter. Which gives asynchrony 
capability for free.
   
   Possible drawbacks:
    - To be noted that the write is likely to happen outside of the event loop, 
if the user explicitly switched thread. This can have non trivial consequences 
on the ordering. If that's an issue writes can be forced back to the event loop 
and be wrapped as an event loop task. Impacts only users that opt-in the async 
calls though...
    - This means that if client calls the next plugin in an async way we might 
have an unbounded number of async calls in flight. (Classic async code 
drawback: your concurrency no longer is bounded by your threadpool...) Impacts 
only users that opt-in the async calls though... And user that oped in are 
likely to know what they are doing.
    - The extra plugin array copy. Likely neglictible, and likely movable upon 
A6Conf initialization but it would be slightly more invasive onto the existing 
code base...
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to