Skip to content
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

Stream the generated image from the GenerateDerivedImage lambda #14

Open
deanmoses opened this issue Nov 29, 2023 · 0 comments
Open

Stream the generated image from the GenerateDerivedImage lambda #14

deanmoses opened this issue Nov 29, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@deanmoses
Copy link
Owner

Consider streaming the generated image from the lambda that generates it.

Where I got to

  • Streaming from Lambdas sucks because there's no TypeScript bindings
  • I managed to stream an image from S3 just fine, but getting a stream from Sharp was not obvious, so I'm backing away from this for now, at least until I get the non-streamed version working.

Why do it

  • It'd be faster
  • It'd work for my scenario
    • You can progressively stream response payloads through Lambda function URLs, including as an Amazon CloudFront origin, along with using the AWS SDK or using Lambda’s invoke API.
  • It'd return bigger images
    • Lambda has a size limit of 6MB on request and response payloads for synchronous invocations, and streaming gets around that
    • There’s a default streaming limit of 20MB. This is a soft limit and can be raised via the Service Quota console or you can raise a support ticket.

Why NOT do it

  • Every subsequent request for the image is streamed b/c 1) CloudFront caches the image and even if that fails, 2) CloudFront retrieves the derived image that's now stored in a S3 bucket
  • So I won't get a ton of benefit, but it might be nice for Lucie and I who have to hit that generation endpoint
  • Why not wait until we have the front end client implemented, and see how much the slowness is noticeable
@deanmoses deanmoses added the enhancement New feature or request label Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant