-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Very slow POST of product with media (base64) #9280
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
Comments
@vlahakis how is your install setup to store the media? How big is the base64 encoded block (on average)? How many images are you sending in the call? |
Hi,
Media storage is on disk (versus db).
One base media image with each call and on average a few Kbytes, nothing massive.
It clearly however shows a considerable slowdown when adding the media to the call.
… On 18 Apr 2017, at 18:08, Chuck Choukalos ***@***.***> wrote:
@vlahakis how is your install setup to store the media? How big is the base64 encoded block (on average)? How many images are you sending in the call?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I suspect the majority of the slow down is the image resize being fired, but given the size of the image that seems like a lot. What happens to the time if you try it with 3-5 images, does it increase linearly? What about the 2nd API call (with different image)? |
Hello,
All calls have an increase regardless. I have had no time to debug backend but I suspect it's somewhere in the pipeline of processing the base64 string.
Multiple images in same I have not tried as it does not apply in my scenario. Have tried with and without the image media and saw the increase, hence the report here.
… On 18 Apr 2017, at 21:35, Chuck Choukalos ***@***.***> wrote:
I suspect the majority of the slow down is the image resize being fired, but given the size of the image that seems like a lot. What happens to the time if you try it with 3-5 images, does it increase linearly? What about the 2nd API call (with different image)?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Hi @vlahakis , Thanks for the info. I suspect this is to be expected because the API is triggering an image re-size which is causing the image to be saved along with multiple image resize operations (based on what's needed by your selected theme). I have backlog for a future improvement where we'd make this asynchronous to defer the image resize processing. Would that address your needs here? Thanks, |
Hi,
Yes I think anything that could assist in speed improvements over the API usage would be great. If you do put the operation in async mode would it somehow prevent the product from being viewed in the store? I suspect/hope not.
Best,
… On 24 Apr 2017, at 22:11, Chuck Choukalos ***@***.***> wrote:
Hi @vlahakis <https://github.com/vlahakis> ,
Thanks for the info. I suspect this is to be expected because the API is triggering an image re-size which is causing the image to be saved along with multiple image resize operations (based on what's needed by your selected theme). I have backlog for a future improvement where we'd make this asynchronous to defer the image resize processing. Would that address your needs here?
Thanks,
Chuck
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#9280 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AMnNUXEbek_80P0FFCNRm1ufhED1iRxlks5rzPPzgaJpZM4M_cHS>.
|
Ideally it would also be great (feature request) to be able to temporarily disable \Magento\Catalog\Model\Product\Image\Cache::processImageData This takes approximately 48% of the POST call (after profiling). I believe it would be an option in Cache Management to disable (or set on schedule and so on) the Catalog Images Cache. It would allow for a considerable boost in performance during these operations and then you can re-enabled it or force an images resize on the console to update it. (just my thoughts) |
I changed a few things in catalog:images:resize to get some stats on the resizing algorithm and it turns out has a rather poor performance (using ImageMagick in hope of performance boost)... http://undefined.gr/site/2017/05/18/magento-catalogimagesresize-stats-and-memory/ Current state of affairs on this says that with ~16000 and an average time per product over 4-5 secs I am looking at days for this to finish! |
@vlahakis: you can find some hints about improving performance of Also: take a look at your theme's view.xml file, and configure all the image dimensions of image types you don't use in the frontend, to the exact same dimension (we put it at 16x16), this makes the |
Thank you @hostep, did read that post but wasn't keen on changing core Magento sources. Will review the image sizes on the theme as well (using luma for now). |
Tried applying the Image.php suggestion from your last comment but it appears that it completely bumped the resizing benchmarks. Rolled back to as it was (2.1.6) |
Ok, that's really strange, there is nothing in that code which makes the process slower, it should at least be as "fast" as a stock 2.1.6 installation and normally a lot faster. |
Hi @georgios-2317 |
Hello, I have since upgraded to 2.2 and no longer use REST API due to the slow down. The ticket here should have enough information for you to replicate behavior. In essence calling REST API to add media to existing product is a simple and direct call. |
Hi @georgios-2317 |
Dont get me wrong @magento-engcom-team I want to help with the process but finding it a bit difficult to understand your feedback here. The response times for multiple images is not being reported here, so your comment on "count of images" does not apply. The original ticket was for one image to be posted on an existing product via REST POST API. So, a typical call may be to either
Where the base64 content is an image of lets say 132K. Here's one for your convenience (taken from Google Search - not mine): https://www.organicfacts.net/wp-content/uploads/aromatherapy.jpg The rest of the information is within this ticket I believe but to recap, POSTing an image to media or product causes a considerable increase in processing time which could translate to either Magento re-processing the image or something wrong in the base64 decoding process (or I/O). As I mentioned, I no longer use the REST API due to speed delays and have now moved to direct DB calls (knowingly accepting the risk behind this). Hope I gave some sort of assistance here. PS: I cannot confirm if the ticket still applies in Magento 2.2 |
@georgios-2317, thank you for your report. |
Hi, is there any update on this issue? I did not post a separate issue, because I think we have the same issue here. |
Hi, Error 503 first byte timeout |
I also analysed the API call. One idea would be to move the image processing to an asynchronously process. Maybe we can process all images by a worker. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions! |
Was this resolved on 2.4+ ? |
I don't think so, I am currently experiencing the same issue. I can just upload images less than ~30kB, but anything over that takes a considerably long time. To be fair, I tried uploading a 2MB image many times but I never saw it finishing successfully. |
When adding a new product via REST API (POST/PUT) and the product contains media image with base64 encoding the performance increases by 300% (from .60 sec to over 2 sec depending on base64 image size.
Preconditions
Steps to reproduce
Expected result
Actual result
Any other way of achieving the import without the massive slow-down? Calling the media URL to add the image yields the same slow-down.
The text was updated successfully, but these errors were encountered: