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
This commit is contained in:
1 file changed
+14
-2
@@ -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 {
|
switch dialect {
|
||||||
case "postgres", "pgx":
|
case "postgres", "pgx":
|
||||||
switch {
|
switch {
|
||||||
@@ -48,13 +58,15 @@ func startDbInDockerSupported(dialect string, opt ...Option) (cleanup func() err
|
|||||||
url = os.Getenv("BOUNDARY_TESTING_PG_URL")
|
url = os.Getenv("BOUNDARY_TESTING_PG_URL")
|
||||||
return func() error { return nil }, url, "", nil
|
return func() error { return nil }, url, "", nil
|
||||||
case repository != "":
|
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"
|
url = "postgres://postgres:password@localhost:%s?sslmode=disable"
|
||||||
if err == nil {
|
if err == nil {
|
||||||
url = fmt.Sprintf("postgres://postgres:password@%s/boundary?sslmode=disable", resource.GetHostPort("5432/tcp"))
|
url = fmt.Sprintf("postgres://postgres:password@%s/boundary?sslmode=disable", resource.GetHostPort("5432/tcp"))
|
||||||
}
|
}
|
||||||
default:
|
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"
|
url = "postgres://postgres:password@localhost:%s?sslmode=disable"
|
||||||
if err == nil {
|
if err == nil {
|
||||||
url = fmt.Sprintf("postgres://postgres:password@%s/boundary?sslmode=disable", resource.GetHostPort("5432/tcp"))
|
url = fmt.Sprintf("postgres://postgres:password@%s/boundary?sslmode=disable", resource.GetHostPort("5432/tcp"))
|
||||||
|
|||||||
Reference in new issue
Block a user