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

VipsJpeg: Insufficient memory #12

Closed
leomeneguzzi opened this issue Jan 27, 2022 · 5 comments
Closed

VipsJpeg: Insufficient memory #12

leomeneguzzi opened this issue Jan 27, 2022 · 5 comments

Comments

@leomeneguzzi
Copy link

leomeneguzzi commented Jan 27, 2022

Hi, I'm facing the following error with some images that are a little bit heavy, around 5MB. Did you face this error too? Or do you know a workaround for this? Unfortunately, the memory limit to lambda@edge is 256MB :(

{
    "errorType": "Error",
    "errorMessage": "VipsJpeg: Insufficient memory (case 4)\n",
    "stack": [
        "Error: VipsJpeg: Insufficient memory (case 4)",
        ""
    ]
}
@leomeneguzzi
Copy link
Author

Actually, I'm looking here, and to the origin-response lambda@edge, the memory limit seems to be the same to the lambda functions 🤔

@leomeneguzzi
Copy link
Author

I solve the problem increasing the memory to 1024MB. But to some images I'm getting timeout... And I think that it's using a huge amount of memory considering that each lambda do just one resize.

Do you have some tip to improve it? I tried do the download of the image, the resize and the write process using streaming, but I think that lambda don't support give the response to client as a stream, just as json... Then I don't have another choice than process and get the Base64.

Another possibility that I think is use Golang with govips, but probably will have almost the same performance and memory usage result because the program is simple, the huge process is made by libvips, that will be the same anyway. But I didn't the tests, it's just my feeling.

Anyway, anyway has some tip to performance or memory improvement? Or some crazy idea to improve it?

Anyway, thanks very much for the repository, was great to me, save me probably more - than 5 days of hardworking

@HoraceShmorace
Copy link
Owner

Hmm. I've resized some fairly large JPEGs with this. I'll do some performance testing (probably this weekend) and get back to you.

@HoraceShmorace
Copy link
Owner

I finally got around to this. I was able to resize up to 100mb jpegs without any real issues (it's obviously slower as the file sizes grow, but nothing unexpected). I haven't tested any higher than that yet.

@HoraceShmorace
Copy link
Owner

These links seem to provide some clarity:
lovell/sharp#177 (comment)
lovell/sharp#955

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants