-
Notifications
You must be signed in to change notification settings - Fork 205
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
ResponseTime is almost doubled with RecyclableMemoryStream. #294
Comments
Without more information, it's hard to say what the problem is. RMS is made for repeated use. Are you deserializing that file once or repeatedly? Are you creating a single manager object and re-using it? Your block size is very, very small--you would be using so many chained buffers, your efficiency could go down from that alone. I'd probably use something like 128KB or bigger, depending on your typical data sizes. |
The file is deserialized multiple times. There are many files in the range of 500MB to 2GB. At a time, 5-6 files will be deserialized. Here is the code. public static class RecyclableMemoryStream /// The object used for lock. /// private static readonly object LockObject = new object();
|
There should be no inherent reason why using RMS is slower than using MS. If using a larger block size doesn't work, you will need to do some profiling to see where the slowdown is coming. |
@anilgupta29Dev Do you have any updates on your end to this issue? |
We can close the issue. I was able to get similar response time with changed settings. |
I am using RecyclableMemoryStream for deserializing a 1.5 GB json file. Even though I was able to reduce the memory usage by almost 40% but the method response time was almost doubled from ~40s to ~80s. Is this expected?
I am using the configuration below.
private static RecyclableMemoryStreamManager GetRecyclableMemoryStreamManager()
{
int blockSize = 1024;
int largeBufferMultiple = 1024 * 1024;
int maxBufferSize = 16 * largeBufferMultiple;
int maximumFreeLargePoolBytes = 3 * maxBufferSize;
int maximumFreeSmallPoolBytes = 100 * blockSize;
RecyclableMemoryStreamManager manager = new RecyclableMemoryStreamManager(
blockSize: blockSize,
largeBufferMultiple: largeBufferMultiple,
maximumBufferSize: maxBufferSize,
maximumSmallPoolFreeBytes: maximumFreeSmallPoolBytes,
maximumLargePoolFreeBytes: maximumFreeLargePoolBytes);
The text was updated successfully, but these errors were encountered: