-
Notifications
You must be signed in to change notification settings - Fork 348
perf(sandbox): reduce memory dirtying from journald and envd logging #2674
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
Changes from all commits
de6a6f1
585e9cc
3b78782
bfb34d9
f48305f
2d1a13c
203b9e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,16 +12,20 @@ import ( | |
| "github.com/e2b-dev/infra/packages/envd/internal/logs/exporter" | ||
| ) | ||
|
|
||
| func NewLogger(ctx context.Context, isNotFC bool, mmdsChan <-chan *host.MMDSOpts) *zerolog.Logger { | ||
| func NewLogger(ctx context.Context, isNotFC bool, verbose bool, mmdsChan <-chan *host.MMDSOpts) *zerolog.Logger { | ||
| zerolog.TimestampFieldName = "timestamp" | ||
| zerolog.TimeFieldFormat = time.RFC3339Nano | ||
|
|
||
| exporters := []io.Writer{} | ||
|
|
||
| if isNotFC { | ||
| if !isNotFC { | ||
| exporters = append(exporters, exporter.NewHTTPLogsExporter(ctx, isNotFC, verbose, mmdsChan)) | ||
| } | ||
|
Comment on lines
+21
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When envd runs with Useful? React with 👍 / 👎. |
||
| // Stdout is opt-in via -verbose. Inside FC stdout flows into journald and | ||
| // dirties guest pages on every snapshot, so we keep it off by default and | ||
| // rely on the HTTP exporter to ship debug logs to the orchestrator. | ||
| if verbose { | ||
|
cursor[bot] marked this conversation as resolved.
|
||
| exporters = append(exporters, os.Stdout) | ||
| } else { | ||
| exporters = append(exporters, exporter.NewHTTPLogsExporter(ctx, isNotFC, mmdsChan), os.Stdout) | ||
| } | ||
|
|
||
| l := zerolog. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| package pkg | ||
|
|
||
| const Version = "0.5.20" | ||
| const Version = "0.5.24" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| {{- /*gotype:github.com/e2b-dev/infra/packages/orchestrator/pkg/template/build/core/rootfs.templateModel*/ -}} | ||
| {{ .WriteFile "etc/systemd/journald.conf.d/e2b.conf" 0o644 }} | ||
|
|
||
| [Journal] | ||
| Storage=persistent | ||
| SystemMaxUse=8M | ||
| SystemMaxFileSize=2M | ||
| MaxLevelStore=warning | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The MaxLevelStore=warning setting causes journald to discard all logs with a priority higher than 4, including the default info (6) priority assigned by systemd to service stdout and stderr. Consequently, all envd logs—including the Warn and Error levels intended for preservation—will be dropped. Consider setting this to info and relying on envd's internal filtering to manage volume, or ensuring envd outputs syslog-compatible priority prefixes.
cursor[bot] marked this conversation as resolved.
|
||
| MaxLevelConsole=warning | ||
| MaxLevelKMsg=warning | ||
| MaxLevelWall=emerg | ||
| ForwardToSyslog=no | ||
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.
addLogsonly evicts existing entries whilelen(w.logs) > 0, so if a single incoming record is larger thanmaxBufferedBytesand the queue is empty, it is still appended andbufferedBytesjumps past the configured cap. That breaks the new bounded-memory guarantee and allows one unusually large log event to exceed the intended 4 MiB limit (with repeated large events causing repeated over-cap allocations).Useful? React with 👍 / 👎.