[英]Image Upload and manipulation API taking more time for higher resolution images
My Current flow that I am following for image upload
and its manipulation
on the S3 bucket is as follows: 我遵循的用于图像
upload
及其在S3存储桶上的manipulation
我的当前流程”如下:
As the image size
increases so those the API response
time.It takes 3 secs for the API to give a response while following above workflow for a 300 KB image and 30 secs for a 15 MB or more image. 随着
image size
增加,API的response
时间也随之增加。对于300 KB的图像,遵循上述工作流程需要3秒钟的API响应;对于15 MB或更多的图像,则需要30秒。
I don't know if my flow is correct or not. 我不知道我的流程是否正确。 My requirement is that I need to reduce my API response time while uploading a 15 or more MB image.
我的要求是,在上传15或更多MB图像时,我需要减少API响应时间。 Can somebody suggest me how to achieve this?
有人可以建议我如何实现这一目标吗?
EDIT 编辑
To make it clear I am uploading a single 15 MB file which I am sending it from Advanced Rest Client
(a chrome plugin) to my API. 为了清楚起见,我上传了一个15 MB的文件,并将其从
Advanced Rest Client
(chrome插件)发送到我的API。 The image file is currently present in my local system. 该图像文件当前在我的本地系统中。 I am currently working on
jpg
and png
images. 我目前正在处理
jpg
和png
图像。 I want to resize the image to both bigger and smaller sizes by reducing the width to height ratio . 我想通过减小宽高比来将图像调整为更大或更小的尺寸。 The API that I Have written is in Node JS which follows the above workflow.
我编写的API在Node JS中,它遵循上述工作流程。
Seems like upload and download big image from S3 takes a lot of time. 似乎从S3上传和下载大图像需要花费大量时间。
You can do some optimizations: 您可以进行一些优化:
graphicsmagick
package, in common cases it's faster that imagemagick (latest versions) graphicsmagick
软件包,在通常情况下,它比imagemagick(最新版本)要快 Make resize / optimize operations before uploading to S3 and upload at last step 在上载到S3并最后一步上传之前进行调整大小/优化操作
If it's not possible - try to use Streams for downloading - resizing - uploading to S3. 如果不可能-尝试使用Streams进行下载-调整大小-上载到S3。 just pipe request stream to gm module and write pipe to AWS S3
只是将请求流通过管道传输到gm模块并将管道写入AWS S3
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.