Thanks a lot! Will take a look!
On Fri, Dec 20, 2024 at 22:52 btell...@linagora.com <btell...@linagora.com> wrote: > Hello folks! > > First huge thanks for this amazing project. > > We actively rely on Apache APISIX at LINAGORA for our OIDC setup on top > of Apache James mail server. [1] > > As part of this set up we need to check for invalidated sid in upcoming > tokens onto a Redis database. > > We naturally wrote a Java plugin to do so. > > Recently we encountered a Redis outage and to our horror HTTP requests > were violently throttled by the API gateway, and bypassing the faulty > Redis was taking way more time than the configured 100ms timeout. > > Investigation showed that: > - Our Redis code inside our Apisix plugin was blocking > - That doing so was disastrous as the plugin code runs directly onto > the Netty event loop of the Unix socket linking the plugin to APisix > - That the Apisix Java programming API was async friendly with it's > PluginFilterChain abstraction > - But that very sadly the given PluginFilterChain was called > synchronously and expected to run synchronously > > While I do believe better overall design exists, being able to query > external data source from within a Java plugin seems to be a pretty > common expectation for at least Java users [2]. > > With that new knowledge I: > > - [3] Patched the LINAGORA back-channel logout plugin to be asynchronous > - [4] Proposed an evolution of the java plugin runner to call the > plugin chain in an async friendly way. This PR had been tested in our > dev environments (functionally logout still works, and timeouts are well > applied). We will further performance test this change and will roll it > over in production in the coming days. > - [5] Opened Github issue and [6] JIRA issue > > I also do believe the threading model need to be clearly documented, and > the use case of asynchronous Java plugins can be made explicit. I > propose myself to write this doc. > > Hope the Apisix community will like this special XMas gift. > > Best regards, > > Benoit TELLIER from the Apache James project. > > [1] > > https://github.com/linagora/tmail-backend/tree/master/demo/apisix/tmail-apisix-plugin-runner > > [2] https://github.com/apache/apisix-java-plugin-runner/issues/264 > https://github.com/apache/apisix-java-plugin-runner/issues/168 > [3] https://github.com/linagora/tmail-backend/pull/1412 > [4] https://github.com/apache/apisix-java-plugin-runner/pull/313 > [5] https://github.com/apache/apisix-java-plugin-runner/issues/312 > [6] https://issues.apache.org/jira/projects/APISIX/issues/APISIX-38 > > >