Skip to content
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

Performance Bottlecheck when Auditing to File #7014

Closed
bradbl opened this issue Jun 28, 2019 · 0 comments · Fixed by #7024
Closed

Performance Bottlecheck when Auditing to File #7014

bradbl opened this issue Jun 28, 2019 · 0 comments · Fixed by #7024

Comments

@bradbl
Copy link
Contributor

bradbl commented Jun 28, 2019

Describe the bug
When Vault is configured to audit to a file, the throughput of every Vault instance is severely impacted.

To Reproduce
Steps to reproduce the behavior:

  1. Enable file auditing. Run vault audit enable file file_path=/dev/null.
  2. Add a k/v secret. Run vault kv put secret/foo bar=test.
  3. Read the secret at a high RPS. Run vault kv get secret/foo.

Expected behavior
When reading a single k/v secret and auditing to the /dev/null device, I expect to see relatively high CPU utilization and high throughput of requests served. Under this configuration however, it is not possible to exceed around 30% CPU utilization on our hardware.

Environment:

  • Vault Server Version (retrieve with vault status): Vault Enterprise 1.1.2
  • Vault CLI Version (retrieve with vault version): N/A
  • Server Operating System/Architecture:
Distributor ID:	Debian
Description:	Debian GNU/Linux 8.11 (jessie)
Release:	8.11
Codename:	jessie

Vault server configuration file(s):

storage "consul" {}

listener "tcp" {
  address       = "0.0.0.0:8200"
  tls_cert_file = "/etc/vault.d/cert.pem"
  tls_key_file  = <scrubbed>
}

seal "transit" {
  // The Vault token to use for unseal is injected by the entrypoint script.
  // The key_name and address are set as environment variables.
  disable_renewal    = "true"
  mount_path         = "transit/"
}

disable_sealwrap = "true"
plugin_directory = "/vault/plugins/"
jefferai added a commit that referenced this issue Jun 30, 2019
This was inspired by #7022 but has the advantage of avoiding
double-locking and needing to perform lock upgrades while also
simplifying the logic and being faster.

Original, #7022, this:

goos: linux
goarch: amd64
pkg: github.com/hashicorp/vault/builtin/audit/file
BenchmarkAuditFile_request-4       30000             60734 ns/op
PASS
ok      github.com/hashicorp/vault/builtin/audit/file   2.428s

goos: linux
goarch: amd64
pkg: github.com/hashicorp/vault/builtin/audit/file
BenchmarkAuditFile_request-4       50000             34772 ns/op
PASS
ok      github.com/hashicorp/vault/builtin/audit/file   2.086s

goos: linux
goarch: amd64
pkg: github.com/hashicorp/vault/builtin/audit/file
BenchmarkAuditFile_request-4       50000             25302 ns/op
PASS
ok      github.com/hashicorp/vault/builtin/audit/file   1.542s

Fixes #7014
Closes #7022
jefferai added a commit that referenced this issue Jul 1, 2019
This was inspired by #7022 but has the advantage of avoiding
double-locking and needing to perform lock upgrades while also
simplifying the logic and being faster.

Original, #7022, this:

goos: linux
goarch: amd64
pkg: github.com/hashicorp/vault/builtin/audit/file
BenchmarkAuditFile_request-4       30000             60734 ns/op
PASS
ok      github.com/hashicorp/vault/builtin/audit/file   2.428s

goos: linux
goarch: amd64
pkg: github.com/hashicorp/vault/builtin/audit/file
BenchmarkAuditFile_request-4       50000             34772 ns/op
PASS
ok      github.com/hashicorp/vault/builtin/audit/file   2.086s

goos: linux
goarch: amd64
pkg: github.com/hashicorp/vault/builtin/audit/file
BenchmarkAuditFile_request-4       50000             25302 ns/op
PASS
ok      github.com/hashicorp/vault/builtin/audit/file   1.542s

Fixes #7014
Closes #7022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant