
Handing this over to background workers would allow them to tackle it at their own pace, while auto scaling could bring up more resources as needed.Īlthough this solves the problem of over-provisioning to some extent, the eventual consistency has real-life implications. One could argue this is solvable by queuing the image processing. Working on this solution opened an opportunity to take the AWS Lambda route once LEVELS committed to using the AWS Cloud for their infrastructure needs. This was not the best way to approach the problem or spend the money. LEVELS ended up heavily over-provisioning the Amazon EC2 instances size just to handle occasional spikes. When adding multiple concurrent user uploads into the equation, the problem gets worse. Such processing times and RAM usage called for the use of bigger Amazon EC2 instances than what the application itself needs.

ImageMagick used 1.5 GB of RAM-the maximum on AWS Lambda.Processing time exceeded two seconds per uploaded image.Setting up PoC (proof-of-concept) image processing, running on AWS Lambda, yielded the following results for the largest images: The LEVELS team’s initial idea was to simply resize images into the desired size variations on the API server, or as a background job on Amazon Elastic Compute Cloud (Amazon EC2) instances. Let’s take a look at the three solutions we proposed to LEVELS for resizing the user uploaded images. The main goal was to reduce the bandwidth usage by the web and mobile apps, thereby speeding up image delivery within the app. Because of this, there was a clear need for LEVELS to optimize the delivery of such images by providing smaller sizes and thumbnails. LEVELS accepts users’ uploaded images, which can easily reach more than 8000 x 5000 pixels in size and a few megabytes in weight on modern smartphones. This type of serverless solution can reduce the strain on your application programming interface (API) servers, and eliminate the need for running separate servers to handle spikes without crashing. In this post, I will review a horizontally scalable solution applied to LEVELS for their image upload processing. They can share their experiences with other users on the LEVELS social network through verified testimonials, and get endorsed by one of the LEVELS partners. This allows users to focus more on enjoying unique experiences and less on managing them. Payments are processed through LEVELS’ built-in “Get Up and Go” payment method, available in more than 6,000 locations globally. With LEVELS, a guest can visit a luxury restaurant, be immediately recognized by the staff, taken to preferred seating, and pay for dinner without ever taking out a credit card or managing logistics. Toptal helped build and automate the cloud infrastructure for LEVELS, a social network with an integrated payment function that also finds and applies VIP benefits users can get for the credit card programs they are a member of, things they own, or places they live.

We provide application development and DevOps solutions for Amazon Web Services (AWS) customers. Toptalis an AWS Partner Network (APN) Advanced Consulting Partner with the AWS Lambda Service Delivery designation.

As you scale, this process simply doesn’t work. The more concurrent uploads you get, the more they wreak havoc on your servers. Each image needs to be processed into several variations for thumbnails, previews, and reasonably-sized images for web and mobile display.Īll of that processing eats up the computing power (CPU) and random access memory (RAM). Let’s say you’ve got thousands of users who love to upload big and heavy images from their 40+ megapixel smartphone cameras.
#Aws lambda imagemagick code#
I've done just the basic function I was basically doing in my core code in Node.js 8.10: gm(response.Body).setFormat("png").By Tomislav Capan, Principal Solution Architect at Toptal
#Aws lambda imagemagick pdf#
I've looked into doing the most basic conversion of pdf using ImageMagick with no luck so I think AWS has updated something and caused the pdf module to either be removed or stop working. I've had a AWS Lambda function running on S3 objects for the last 18 months and it died around a month ago after a minor update.
