Actions
Task #2954
closedBug #2865: Reduce Keep server memory use
Rewrite Get and Put to minimize unnecessary allocation
Description
Both volume.Get and main.ReadAtMost use ioutil.ReadAll to read all available data. As Peter observed, ReadAll grows a buffer exponentially to read all available data, so in order to read a 64MB block it allocates a 128MB buffer.
Some things we can do to relax memory usage:
- Eliminate ioutil.ReadAll. Since we know the anticipated amount of data for both PUT (from the Content-Length header) and GET (from the file size on disk) we can allocate exactly the amount of space we need and use that buffer.
- Possibly: remove the requirement that Keep return a 402 Corruption error on a corrupt block. If Keep is allowed to return the block anyway and simply log an alert if the block is found to be corrupt, GET can allocate a relatively small buffer (e.g. 1MB) for reads.
Updated by Tim Pierce about 10 years ago
- Status changed from In Progress to Resolved
- Remaining (hours) changed from 8.0 to 0.0
Actions