有一个页面里有100个图片的地址,图片都是转为2进制文件存到数据库中的, 每个图片大小都为30K左右,代码为:<img src="@Url.Action("Details", "File", new { identity = pictureId })" /> 100个这样的链接
那么这个页面发布后, 每次打开这个页面, CPU吃到%50, IIS应用程序池, 内存吃到2个G. 这是程序的问题吗?sqlserver的进程CPU也是吃到%50左右.基本上%占%98左右了, 8核的CPU
Controller: File
Action代码为: public ActionResult Details(Guid identity)
{
var context = factory.Create<BinaryFileContext>();
var file = context.GetBinaryFile(identity);
if (file != null)
{
return new FileContentResult(file.Data.ToArray(), file.Mime)
{
FileDownloadName = file.Name
};
}
else
{
return this.View();
}
}
那么这个页面发布后, 每次打开这个页面, CPU吃到%50, IIS应用程序池, 内存吃到2个G. 这是程序的问题吗?sqlserver的进程CPU也是吃到%50左右.基本上%占%98左右了, 8核的CPU
Controller: File
Action代码为: public ActionResult Details(Guid identity)
{
var context = factory.Create<BinaryFileContext>();
var file = context.GetBinaryFile(identity);
if (file != null)
{
return new FileContentResult(file.Data.ToArray(), file.Mime)
{
FileDownloadName = file.Name
};
}
else
{
return this.View();
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货