-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Package Eviction #225
base: main
Are you sure you want to change the base?
Package Eviction #225
Conversation
size of packages
Merge branch 'main' of https://github.com/pt-07/open-lambda
…ried an uninstall, which worked successfully, but then gave an error as the code still tried to create a root FS
…d to fix some hardcoding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great progress!
@@ -175,6 +179,29 @@ func (pp *PackagePuller) sandboxInstall(p *Package) (err error) { | |||
return err | |||
} | |||
} | |||
//gets the size of the current package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's have a separate function for computing the directory size recursively
@@ -175,6 +179,29 @@ func (pp *PackagePuller) sandboxInstall(p *Package) (err error) { | |||
return err | |||
} | |||
} | |||
//gets the size of the current package | |||
cmd := exec.Command("du", "-sb", scratchDir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's compute the size without running an external program
cmd.Stdout = &out | ||
err = cmd.Run() | ||
if err != nil { | ||
log.Fatal(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fatal will kill the server. I don't think that's a proportionate response to an error. Better to return it back.
@@ -12,7 +12,9 @@ import ( | |||
"strings" | |||
"sync" | |||
"sync/atomic" | |||
|
|||
"regexp" | |||
"strconv" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spacing
@@ -36,8 +38,10 @@ type Package struct { | |||
Meta PackageMeta | |||
installMutex sync.Mutex | |||
installed uint32 | |||
Size int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will need to be protected by some lock. Perhaps with installMutex? Which would then need to be renamed to reflect the broader usage
} | ||
|
||
var totalPackageSize = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have a total size variable like this, it will need to be lock protected. Perhaps we can keep this PR simple, and figure out those details in a future PR that actually implements eviction?
@@ -175,6 +179,29 @@ func (pp *PackagePuller) sandboxInstall(p *Package) (err error) { | |||
return err | |||
} | |||
} | |||
//gets the size of the current package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's have a config option so we don't compute/log size unless doing so is enabled
Added code to correctly output package sizes