I investigated which framework, Node.js or Python, is better for the thumbnail creation process using AWS Lambda.
TL;DR
--If you want to create thumbnails, Python seems to have much better performance than Node.js. --Sample code is here
--Memory 256M
Results of running 5 times each on the AWS console
Node.js | Python | |
---|---|---|
processing time(ms) | 10500 - 12375 | 3214 - 3727 |
The result is that Python has an overwhelmingly shorter processing time. The maximum memory size used was also smaller in Python.
So, if you want to generate thumbnails with AWS Lambda, it seems better to use Python than to use Node.js.
ImageMagick (GraphicMagicks) is available in Node.js from the beginning, and there are many sample programs and articles, but Python does not have much information. When I built the image processing library Pillow in Python on EC2 with reference to the following, surprisingly smooth thumbnail creation worked using Lambda.
-Try using the image processing library "Pillow" with AWS Lambda
The code used in this experiment is located here. The pre-built Pillow is also included in the repository, which can be useful if you want to quickly create thumbnails with AWS Lambda x Python.
Recommended Posts