Increase the maximum file handler from 1K to 1M (#16)
The default file handler limitation on Linux for each process is 1K, which could be too few. Increase this number to 1M for hdfs-mount process only. This option requires sudo privilege, or no change happens with an error msg.
This commit is contained in:
Родитель
e4218b854f
Коммит
b85f319dc3
9
main.go
9
main.go
|
@ -81,6 +81,15 @@ func main() {
|
|||
}
|
||||
log.Print("Mounted successfully")
|
||||
|
||||
// Increase the maximum number of file descriptor from 1K to 1M in Linux
|
||||
rLimit := syscall.Rlimit {
|
||||
Cur: 1024*1024,
|
||||
Max: 1024*1024}
|
||||
err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit)
|
||||
if err != nil {
|
||||
Error.Printf("Failed to update the maximum number of file descriptors from 1K to 1M, %v", err)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
fileSystem.Unmount()
|
||||
log.Print("Closing...")
|
||||
|
|
Загрузка…
Ссылка в новой задаче