-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TT-13139] Request times out in some cases when sending input via http inputs #6592
[TT-13139] Request times out in some cases when sending input via http inputs #6592
Conversation
…HTTPServer and TestStreamingAPIMultipleClients_Input_HTTPServer
PR Reviewer Guide 🔍
|
API Changes --- prev.txt 2024-10-01 14:03:30.211762176 +0000
+++ current.txt 2024-10-01 14:03:24.067722220 +0000
@@ -7563,6 +7563,11 @@
ErrOAuthClientDeleted = "oauth.client_deleted"
)
const (
+
+ // ExtensionTykStreaming is the oas extension for tyk streaming
+ ExtensionTykStreaming = "x-tyk-streaming"
+)
+const (
ResetQuota string = "resetQuota"
CertificateRemoved string = "CertificateRemoved"
CertificateAdded string = "CertificateAdded"
@@ -7614,10 +7619,6 @@
The name for event handlers as defined in the API Definition JSON/BSON
format
-const (
- // ExtensionTykStreaming is the oas extension for tyk streaming
- ExtensionTykStreaming = "x-tyk-streaming"
-)
const ListDetailed = "detailed"
const LoopScheme = "tyk"
const OIDPREFIX = "openid" |
PR Code Suggestions ✨Explore these optional code suggestions:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@buraksezer if there is no defaultStreamManager how it would support background jobs? You have to create default streamManager if theare no http_server entries in any case. E.g. you have a input as kafka, and output as webhook.
Also you can't depend on findHTTPServerInputPath, you should use GetHTTPPaths, because findHTTPServerInputPath does not consider broker. Also it check only for input but it should work with output too.
… manager for background jobs.
I tried to fix this by calling
I understood the issue but I'm not sure how to extract Here it is: https://warpstreamlabs.github.io/bento/docs/components/inputs/http_server/#path |
…es-when-sending-input-via-http-inputs
I would like to extend the previous comment. |
Quality Gate failedFailed conditions See analysis details on SonarCloud Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
…p inputs (#6601) ### **User description** <details open> <summary><a href="https://tyktech.atlassian.net/browse/TT-13139" title="TT-13139" target="_blank">TT-13139</a></summary> <br /> <table> <tr> <th>Summary</th> <td>Request times out in some cases when sending input via http inputs</td> </tr> <tr> <th>Type</th> <td> <img alt="Bug" src="https://tyktech.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10303?size=medium" /> Bug </td> </tr> <tr> <th>Status</th> <td>In Dev</td> </tr> <tr> <th>Points</th> <td>N/A</td> </tr> <tr> <th>Labels</th> <td>-</td> </tr> </table> </details> <!-- do not remove this marker as it will break jira-lint's functionality. added_by_jira_lint --> --- Cherry-picked stream caching feature from this branch: #6538 Two new integration tests have been added to test `input http -> output http` scenario. See this issue for the details: https://tyktech.atlassian.net/browse/TT-13139 Closing the previous one: #6592 ___ ### **PR Type** Enhancement, Tests ___ ### **Description** - Implemented stream caching and garbage collection in the `StreamingMiddleware` to manage inactive streams and improve performance. - Added new fields and methods to handle stream activity and caching efficiently. - Introduced a garbage collection routine to periodically clean up inactive stream managers. - Added integration tests for single and multiple client scenarios, focusing on HTTP server input and WebSocket output. - Verified message distribution and handling in the new tests to ensure correct functionality. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>mw_streaming.go</strong><dd><code>Implement stream caching and garbage collection in StreamingMiddleware</code></dd></summary> <hr> gateway/mw_streaming.go <li>Introduced stream caching and garbage collection for inactive streams.<br> <li> Added new fields to manage stream activity and cache.<br> <li> Implemented a garbage collection routine for stream managers.<br> <li> Updated stream manager creation to utilize caching. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6601/files#diff-6f565750150d990575c808f1ca8f38483160dc6edf05f1534cd0bedb27c2e6c8">+98/-20</a> </td> </tr> </table></td></tr><tr><td><strong>Tests</strong></td><td><table> <tr> <td> <details> <summary><strong>mw_streaming_test.go</strong><dd><code>Add integration tests for HTTP server streaming scenarios</code></dd></summary> <hr> gateway/mw_streaming_test.go <li>Added tests for single and multiple client streaming scenarios.<br> <li> Implemented test for HTTP server input and WebSocket output.<br> <li> Verified message distribution and handling in tests. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6601/files#diff-a0d1bd0196a741537a3c850e340225c8993e49d709c838af0f1b48b9893af1da">+137/-0</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: Comment `/help "your question"` on any pull request to receive relevant information --------- Co-authored-by: Leonid Bugaev <[email protected]>
…p inputs (#6601) ### **User description** <details open> <summary><a href="https://tyktech.atlassian.net/browse/TT-13139" title="TT-13139" target="_blank">TT-13139</a></summary> <br /> <table> <tr> <th>Summary</th> <td>Request times out in some cases when sending input via http inputs</td> </tr> <tr> <th>Type</th> <td> <img alt="Bug" src="https://tyktech.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10303?size=medium" /> Bug </td> </tr> <tr> <th>Status</th> <td>In Dev</td> </tr> <tr> <th>Points</th> <td>N/A</td> </tr> <tr> <th>Labels</th> <td>-</td> </tr> </table> </details> <!-- do not remove this marker as it will break jira-lint's functionality. added_by_jira_lint --> --- Cherry-picked stream caching feature from this branch: #6538 Two new integration tests have been added to test `input http -> output http` scenario. See this issue for the details: https://tyktech.atlassian.net/browse/TT-13139 Closing the previous one: #6592 ___ ### **PR Type** Enhancement, Tests ___ ### **Description** - Implemented stream caching and garbage collection in the `StreamingMiddleware` to manage inactive streams and improve performance. - Added new fields and methods to handle stream activity and caching efficiently. - Introduced a garbage collection routine to periodically clean up inactive stream managers. - Added integration tests for single and multiple client scenarios, focusing on HTTP server input and WebSocket output. - Verified message distribution and handling in the new tests to ensure correct functionality. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>mw_streaming.go</strong><dd><code>Implement stream caching and garbage collection in StreamingMiddleware</code></dd></summary> <hr> gateway/mw_streaming.go <li>Introduced stream caching and garbage collection for inactive streams.<br> <li> Added new fields to manage stream activity and cache.<br> <li> Implemented a garbage collection routine for stream managers.<br> <li> Updated stream manager creation to utilize caching. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6601/files#diff-6f565750150d990575c808f1ca8f38483160dc6edf05f1534cd0bedb27c2e6c8">+98/-20</a> </td> </tr> </table></td></tr><tr><td><strong>Tests</strong></td><td><table> <tr> <td> <details> <summary><strong>mw_streaming_test.go</strong><dd><code>Add integration tests for HTTP server streaming scenarios</code></dd></summary> <hr> gateway/mw_streaming_test.go <li>Added tests for single and multiple client streaming scenarios.<br> <li> Implemented test for HTTP server input and WebSocket output.<br> <li> Verified message distribution and handling in tests. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6601/files#diff-a0d1bd0196a741537a3c850e340225c8993e49d709c838af0f1b48b9893af1da">+137/-0</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: Comment `/help "your question"` on any pull request to receive relevant information --------- Co-authored-by: Leonid Bugaev <[email protected]>
User description
PR for https://tyktech.atlassian.net/browse/TT-13139
defaultStreamManager
has removed, I used Gorilla's muxer directly instead of creating a default stream manager at the beginningdefaultStreamManager
is gone.ProcessRequest
method has simplified and split into different methods for readability.PR Type
Enhancement, Tests
Description
defaultStreamManager
and refactored the streaming middleware to use Gorilla's muxer directly, simplifying the codebase.ProcessRequest
method by splitting it into smaller, more manageable functions for better readability and maintainability.registerHandlers
,inputHttpServerPublishHandler
, andsubscriptionHandler
to improve HTTP request handling.Changes walkthrough 📝
mw_streaming.go
Refactor streaming middleware and enhance HTTP handling
gateway/mw_streaming.go
defaultStreamManager
and used Gorilla's muxer directly.ProcessRequest
method.registerHandlers
,inputHttpServerPublishHandler
, andsubscriptionHandler
.dummyResponseWriter
for handling HTTP responses.mw_streaming_test.go
Add integration tests for HTTP server input handling
gateway/mw_streaming_test.go