mirror of
https://github.com/restic/rest-server.git
synced 2025-10-19 07:33:21 +00:00
Remove fs package and dirty tricks it does
The Linux kernel page cache ALWAYS knows better. Fighting it brings only worse performance. Usage of fadvise() is wrong 9 out of 10 times. Removing the whole fs package brings a nice 100% speedup when running costly prune command. And that is measured on localhost, the improvement could be much bigger when using network with higher latency.
This commit is contained in:
parent
bbcbca2d4e
commit
267ae63276
6 changed files with 4 additions and 205 deletions
|
@ -10,8 +10,6 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/zcalusic/restic-server/fs"
|
||||
)
|
||||
|
||||
// Context contains repository metadata.
|
||||
|
@ -152,7 +150,7 @@ func GetBlob(c *Context) http.HandlerFunc {
|
|||
}
|
||||
path := filepath.Join(c.path, dir, name)
|
||||
|
||||
file, err := fs.Open(path)
|
||||
file, err := os.Open(path)
|
||||
if err != nil {
|
||||
http.Error(w, "404 not found", 404)
|
||||
return
|
||||
|
@ -172,7 +170,7 @@ func SaveBlob(c *Context) http.HandlerFunc {
|
|||
|
||||
tmp := filepath.Join(c.path, "tmp", name)
|
||||
|
||||
tf, err := fs.OpenFile(tmp, os.O_CREATE|os.O_WRONLY, 0600)
|
||||
tf, err := os.OpenFile(tmp, os.O_CREATE|os.O_WRONLY, 0600)
|
||||
if err != nil {
|
||||
http.Error(w, "500 internal server error", 500)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue