Skip to content

Commit

Permalink
Expose more juicefs options (#251)
Browse files Browse the repository at this point in the history
- expose buffer size
- expose prefetch worker counter
  • Loading branch information
luke-lombardi authored May 23, 2024
1 parent 6ececc8 commit 406c174
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg/common/config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ storage:
awsSecretKey: test
blockSize: 4096
cacheSize: 0
prefetch: 1
bufferSize: 300
gateway:
host: beta9-gateway.beta9
externalURL: http://localhost:1994
Expand Down
15 changes: 13 additions & 2 deletions pkg/storage/juicefs.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,26 @@ func (s *JuiceFsStorage) Mount(localPath string) error {

cacheSize := strconv.FormatInt(s.config.CacheSize, 10)

prefetch := strconv.FormatInt(s.config.Prefetch, 10)
if s.config.Prefetch <= 0 {
prefetch = "1"
}

bufferSize := strconv.FormatInt(s.config.BufferSize, 10)
if s.config.BufferSize <= 0 {
prefetch = "300"
}

s.mountCmd = exec.Command(
"juicefs",
"mount",
s.config.RedisURI,
localPath,
"-d",
"--bucket", s.config.AWSS3Bucket,
"--cache-size",
cacheSize,
"--cache-size", cacheSize,
"--prefetch", prefetch,
"--buffer-size", bufferSize,
"--no-bgjob",
"--no-usage-report",
)
Expand Down
2 changes: 2 additions & 0 deletions pkg/types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ type JuiceFSConfig struct {
AWSSecretKey string `key:"awsSecretKey" json:"aws_secret_key"`
CacheSize int64 `key:"cacheSize" json:"cache_size"`
BlockSize int64 `key:"blockSize" json:"block_size"`
Prefetch int64 `key:"prefetch" json:"prefetch"`
BufferSize int64 `key:"bufferSize" json:"buffer_size"`
}

type MountPointConfig struct {
Expand Down

0 comments on commit 406c174

Please sign in to comment.