During troubleshooting and research the forum for different topics, I found out the last days that my knowledge in regards to streaming and the way the API Gateway handles requests and responses by default or depending on different settings or used assertions is not optimal. Also the existing information on docops as well as here in the forum is not perfect. Therefor I'd like to summarize my current understanding and verify if this is correct and I also have some open questions, which can hopefully be answered.
- Requests will be loaded into memory by default
- Responses will be streamed by default
- For both requests and responses, in case the payload needs to be analyzed, adjusted or whatever, it will/must be loaded into memory
- In regards to message size limit, this is only affective if the request or response will be loaded into memory
- Streamed requests or responses will not be affected by any size limits
- Assuming I don't need to touch the payload, how can I guarantee that also the request will be streamed? I made some local tests with the following result:
- Using just a "Return Template Response"-assertion (so NO route assertion in use at all), the request seems to be streamed, because I don't get any message size limit error with a request-size of 3MB.
- Using the "Copy Request Message to Response"-assertion will fail with a request-size of 3MB, but it is successful when adding the "Configure Message Streaming (enable Streaming)"-assertion.
- Using the "Route via HTTP(S)"-assertion will always fail, doesn't matter if I use the "Configure Message Streaming"-assertion or not.
- Based on these tests:
- Is it important where the "Configure Message Streaming"-assertion is placed in the policy?
- Is it depending how the backend in the "Route via HTTP(S)"-assertion handles the transfer of the large payload?
- I found the CWP "attachment.diskThreshold" (default 1MB), but when is this affective?
- Also in streaming mode or only when the request/response will be loaded into memory?
- Only for real attachments?
- Or for the size of the full request/response (even without attachments)?
- Am I right that the main difference between SOAP and REST policies is the verification of the request against the configured WSDL-file and therefor always need to be loaded into memory? So assuming I don't need to offload these checks from the backend, I can handle a SOAP API via a "REST"-policy without being buffered, right?
Ok, should be enough for the moment. I think there are maybe still some questions left, especially based on your answers, but these can be discussed later.
So first I would be happy to get most of my above mentioned points being confirmed and answered.