feat(cmd): Disable postgres JIT for boundary dev

After updating `boundary dev` to use postgres:12 by default, it was
noticed that the responsiveness of boundary was noticeably slower. This
is due to the introduction of JIT being enabled by default in
postgres:12. JIT seems to incur noticeable overhead without providing
benefits, at least for the instance used for `boundary dev`.

It is also worth noting that for postgres:14 and newer, JIT does not get
triggered for the same queries since they seem to result in a cheaper
query plan that does not exceed the default threshold for JIT.

See:
    https://www.postgresql.org/docs/current/jit.html
    ICU-12283
pull/4254/head
Timothy Messier 2 years ago
parent 884a0cb1fc
commit 9c5c17a3ee
No known key found for this signature in database
GPG Key ID: EFD2F184F7600572

@ -41,6 +41,16 @@ func startDbInDockerSupported(dialect string, opt ...Option) (cleanup func() err
}
}
runOpts := &dockertest.RunOptions{
Tag: tag,
Env: []string{"POSTGRES_PASSWORD=password", "POSTGRES_DB=boundary"},
Cmd: []string{
// JIT seems to cause noticeable overhead without providing noticeable benefit.
// See: ICU-12283
"-c", "jit=off",
},
}
switch dialect {
case "postgres", "pgx":
switch {
@ -48,13 +58,15 @@ func startDbInDockerSupported(dialect string, opt ...Option) (cleanup func() err
url = os.Getenv("BOUNDARY_TESTING_PG_URL")
return func() error { return nil }, url, "", nil
case repository != "":
resource, err = pool.Run(repository, tag, []string{"POSTGRES_PASSWORD=password", "POSTGRES_DB=boundary"})
runOpts.Repository = repository
resource, err = pool.RunWithOptions(runOpts)
url = "postgres://postgres:password@localhost:%s?sslmode=disable"
if err == nil {
url = fmt.Sprintf("postgres://postgres:password@%s/boundary?sslmode=disable", resource.GetHostPort("5432/tcp"))
}
default:
resource, err = pool.Run(dialect, tag, []string{"POSTGRES_PASSWORD=password", "POSTGRES_DB=boundary"})
runOpts.Repository = dialect
resource, err = pool.RunWithOptions(runOpts)
url = "postgres://postgres:password@localhost:%s?sslmode=disable"
if err == nil {
url = fmt.Sprintf("postgres://postgres:password@%s/boundary?sslmode=disable", resource.GetHostPort("5432/tcp"))

Loading…
Cancel
Save