ImageResizer.Plugins.Watermark Bug
High concurrent request image with a watermark arise blocking。I guess it's a bug.
ImageResizer.Plugins.Watermark.ImageLayer.cs code:
public override void RenderTo(Resizing.ImageState s) {
...
lock (img) { //Only one reader from the cached bitmap at a time.
...
why used lock? Replace it with below code, are you ok?
using (img = img.Clone<Bitmap>()) { // Clone it's watermark image replace lock method.
...
}
-
wangyunpeng commented
Image.DrawImage() use system process,but lock code use w3wp process.Yes?
-
wangyunpeng commented
uses a process-wide lock,I know. My site in windows, I/O 4M/sec with System process and lock code ,without lock code I/O 14M/sec.I think lock code with w3wp's user execute ,not process's user execute. How solve the problem , delete lock(img) are you ok?
-
System.Drawing uses a process-wide lock. Duplicating the bitmap doesn't fix that. Profiling tools may show the lock differently. Do you measure an overall increase in throughput when applying large watermarks? What about peak RAM utilization?