add []byte caching and pooling

fixes https://github.com/chrislusf/seaweedfs/issues/211
This commit is contained in:
chrislusf
2016-04-15 11:56:53 -07:00
parent 3fb98a904b
commit b03e7b26b5
4 changed files with 82 additions and 34 deletions

View File

@@ -50,8 +50,8 @@ func (vs *VolumeServer) getVolumeDataContentHandler(w http.ResponseWriter, r *ht
}
offset := uint32(util.ParseUint64(r.FormValue("offset"), 0))
size := uint32(util.ParseUint64(r.FormValue("size"), 0))
content, rawBytes, err := storage.ReadNeedleBlob(v.DataFile(), int64(offset)*storage.NeedlePaddingSize, size)
defer storage.ReleaseBytes(rawBytes)
content, block, err := storage.ReadNeedleBlob(v.DataFile(), int64(offset)*storage.NeedlePaddingSize, size)
defer storage.ReleaseBytes(block.Bytes)
if err != nil {
writeJsonError(w, r, http.StatusInternalServerError, err)
return