How does APIGEE Edge Streaming work?

Hi All,

I am not new to APIGEE, but I have not used streaming in a proxy. We have a requirement where we are getting a pdf in the response. The content-type will be application/pdf. Could you please help me understand the below :

1) How does streaming in APIGEE Edge work? From the apigee docs, I came to know that we need to enable the streaming property in proxy and target endpoint in order for it to work. Will the API proxy provider and consumer needs to make any changes in order to support it ?

2) In the link, it is mentioned that the streaming is required when payload is more than 3MB for private cloud. Will the streaming work if we are getting 1 MB data and it is enabled?

3) Will it create any performance impact if we enable streaming ?

Any help will be appreciated.

Thanks,

Neetu

Solved Solved
3 4 7,841
1 ACCEPTED SOLUTION

Dear @Neetu Garg ,

Please find answers below to your query,

1) How does streaming in APIGEE Edge works ? From the apigee docs, I came to know that we need to enable the streaming property in proxy and target endpoint in order for it to work. Will the API proxy provider and consumer needs to make any changes in order to support it ?

I believe you mean, target API & client. Target side you don't need to change anything. Client side you need to make sure retrieve payloads in chunks using range headers, see an excellent blog article here that explains same.

Regarding, Enabling streaming, It's pretty straight forward. Add properties that enable streaming. See an example proxy attached below that demonstrates same.

pdfstreaming-rev1-2016-08-07.zip

2) In the link, it is mentioned that the streaming is required when payload is more than 3MB for private cloud. Will the streaming work if we are getting 1 MB data and it is enabled.

Good Question, Yes it does work even if it's less than limited size. Chunks of data will be streamed. I am not sure what's the chunk size.

3) Will it create any performance impact if we enable streaming ?

It should be better because since response is not written to Apigee buffer. I have tested same and results are better. When streaming is enabled, policies that require access to the request or response payload, such as XSLT transformations and XML to JSON policies cannot be run and are bypassed.

Hope it helps.

View solution in original post

4 REPLIES 4

Dear @Neetu Garg ,

Please find answers below to your query,

1) How does streaming in APIGEE Edge works ? From the apigee docs, I came to know that we need to enable the streaming property in proxy and target endpoint in order for it to work. Will the API proxy provider and consumer needs to make any changes in order to support it ?

I believe you mean, target API & client. Target side you don't need to change anything. Client side you need to make sure retrieve payloads in chunks using range headers, see an excellent blog article here that explains same.

Regarding, Enabling streaming, It's pretty straight forward. Add properties that enable streaming. See an example proxy attached below that demonstrates same.

pdfstreaming-rev1-2016-08-07.zip

2) In the link, it is mentioned that the streaming is required when payload is more than 3MB for private cloud. Will the streaming work if we are getting 1 MB data and it is enabled.

Good Question, Yes it does work even if it's less than limited size. Chunks of data will be streamed. I am not sure what's the chunk size.

3) Will it create any performance impact if we enable streaming ?

It should be better because since response is not written to Apigee buffer. I have tested same and results are better. When streaming is enabled, policies that require access to the request or response payload, such as XSLT transformations and XML to JSON policies cannot be run and are bypassed.

Hope it helps.

Thanks alot for the guidance.

Hi @Anil Sagar and team,

I have few more queries regarding streaming, Can you please help :

1) I tried using extract variable on the xml payload with streaming enabled. However, I am getting a IO Exception and the policy is not getting bypassed. Please let us know if this the expected behavior or am I missing something.
{"fault":{"detail":{"errorcode":"Internal Server Error"},"faultstring":"IOException"}}

2) Can we limit the max size to be allowed to streamed from apigee at the api proxy level.

Suppose for one particular api proxy, I want to limit the max size to 7MB. Can we do it by enabling some property.

3) Regarding the accept-range header, Is it mandatory for the api proxy client to send the accept-range header ? From the link shared, it seems its a good way to get payload in parts. Could you please let me know if any there is any other point.

Thanks,

Neetu

@Neetu Garg ,

Great Questions, Can you please post as a new Question for better context ? Thank you.