OWIN 자체 호스트 응용 프로그램에서 MVC 작업을 사용하여 클라이언트에 파일을 대량으로 제공합니다. 데이터가 메모리 내에서 생성되고 캐시되며 MVC 작업은 StreamContent
을 MemoryStream
으로 반환하여 캐시 된 byte[]
을 가리 킵니다.출력 스트림에 직접 OWIN 자체 호스트 MVC 쓰기를 만드는 방법
데이터가 내 캐시에서 직접 읽히고 OutputStream
에 복사 될 것으로 예상됩니다. 대신 데이터는 내 MemoryStream
에서 인프라 스트럭처에 의해 생성 된 다른 데이터로 복사됩니다.
return new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StreamContent(new MemoryStream(content), content.Length)
{
Headers =
{
ContentDisposition = new ContentDispositionHeaderValue("attachment")
{
FileNameStar = fileName,
Size = content.Length,
},
ContentType = MediaTypeHeaderValue.Parse(mediaType),
ContentLength = content.Length,
}
}
};
어떻게 내가 돌려 확인 할 수 있습니다 내가 더 많은 메모리를 차지하는 복사 직접하지 않고 MemoryStream
캐시 : 병렬로 많은 요청을 할 때 나는 프로세스 메모리가 증가 볼 수 있습니까?