[wp-trac] [WordPress Trac] #40441: High server resource usage and timeouts during image uploads
WordPress Trac
noreply at wordpress.org
Thu Apr 13 19:50:27 UTC 2017
#40441: High server resource usage and timeouts during image uploads
-------------------------+------------------------------
Reporter: enshrined | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
-------------------------+------------------------------
Comment (by blobfolio):
A common bottleneck comes from source files that are inappropriately
large, which subsequently require extra processing power and memory for
every downsize pass.
One workaround would be to generate a more reasonable pseudo-source if the
original is excessive (e.g. 2000px cap if the source is > 5000px) and use
that for any thumbnails of equal or lesser size. This will have some
quality loss due to recompression so would need to be user-controlled,
probably defaulting to DON'T. But it would definitely help with timeout
issues on budget shared hosting.
There is also optimization potential within the `class-wp-image*` files
themselves: they could maintain a static copy of the last source image
resource to have been generated rather than destroying all traces of it at
the end of the run. `protected static $_last = array( $filepath =>
$resource );` Since this is so often called in a loop using the same file
over and over again, it would allow the class to refer to the cached
source rather than starting from scratch at each iteration. In cases where
an application initiates the image editor against multiple sources (like a
bulk thumbnail regeneration plugin), the usual cleanup can be run at the
''beginning'' of each new cycle to free up memory held for the last one
(rather than the end of every cycle).
While this does mean there will be an uncleared resource at the end of the
process, it should still translate to a decent performance win,
particularly in cases where the source files are gratuitously large.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40441#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list