diff options
| author | chrislu <chris.lu@gmail.com> | 2022-03-02 20:15:28 -0800 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-03-02 20:15:28 -0800 |
| commit | a96d4254e9481596e7d719ec87fc4c92231aa73d (patch) | |
| tree | 44d02ebd56b85a194d956be98e3e5ad9360fe49f /weed/s3api/s3api_object_handlers.go | |
| parent | 6fbbc785745af3427028dfa78a26466bdfaed41f (diff) | |
| download | seaweedfs-a96d4254e9481596e7d719ec87fc4c92231aa73d.tar.xz seaweedfs-a96d4254e9481596e7d719ec87fc4c92231aa73d.zip | |
filer, s3, volume server: a bit memory optimization
Diffstat (limited to 'weed/s3api/s3api_object_handlers.go')
| -rw-r--r-- | weed/s3api/s3api_object_handlers.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.go index f454bfad2..16aab2847 100644 --- a/weed/s3api/s3api_object_handlers.go +++ b/weed/s3api/s3api_object_handlers.go @@ -7,6 +7,7 @@ import ( "encoding/xml" "fmt" "github.com/chrislusf/seaweedfs/weed/security" + "github.com/chrislusf/seaweedfs/weed/util/mem" "io" "net/http" "net/url" @@ -368,7 +369,9 @@ func passThroughResponse(proxyResponse *http.Response, w http.ResponseWriter) (s statusCode = proxyResponse.StatusCode } w.WriteHeader(statusCode) - if n, err := io.Copy(w, proxyResponse.Body); err != nil { + buf := mem.Allocate(128 * 1024) + defer mem.Free(buf) + if n, err := io.CopyBuffer(w, proxyResponse.Body, buf); err != nil { glog.V(1).Infof("passthrough response read %d bytes: %v", n, err) } return statusCode |
