Skip to content

Commit

Permalink
fix: slow hydra start up time
Browse files Browse the repository at this point in the history
Found a deeply nested dependency which was importing `https://github.com/markbates/pkger`, causing unreasonable CPU consumption and significant delay at start up time. With this patch, start up time was reduced from almost 2 seconds to 0.03s seconds for cold starts and ~0.02s for hot starts.

```
$ time hydra
hydra  1.87s user 1.90s system 620% cpu 0.607 total

$ time ./hydra-patch
./hydra-patch  0.03s user 0.01s system 8% cpu 0.450 total

$ time ./hydra-patch
./hydra-patch  0.02s user 0.01s system 104% cpu 0.032 total
```
  • Loading branch information
aeneasr committed Oct 25, 2021
1 parent c8f8996 commit ce1b378
Show file tree
Hide file tree
Showing 2 changed files with 810 additions and 150 deletions.
45 changes: 22 additions & 23 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,54 +15,53 @@ replace (

require (
github.com/cenkalti/backoff/v3 v3.0.0
github.com/evanphx/json-patch v0.5.2
github.com/go-bindata/go-bindata v3.1.1+incompatible
github.com/go-openapi/errors v0.20.0
github.com/go-openapi/runtime v0.19.26
github.com/go-openapi/strfmt v0.20.0
github.com/go-openapi/swag v0.19.13
github.com/evanphx/json-patch v4.9.0+incompatible
github.com/go-bindata/go-bindata v3.1.2+incompatible
github.com/go-openapi/errors v0.20.1
github.com/go-openapi/runtime v0.20.0
github.com/go-openapi/strfmt v0.20.3
github.com/go-openapi/swag v0.19.15
github.com/go-openapi/validate v0.20.1
github.com/go-swagger/go-swagger v0.26.1
github.com/gobuffalo/pop/v5 v5.3.4
github.com/gobuffalo/x v0.0.0-20181007152206-913e47c59ca7
github.com/gobwas/glob v0.2.3
github.com/golang/mock v1.6.0
github.com/google/uuid v1.2.0
github.com/google/uuid v1.3.0
github.com/gorilla/securecookie v1.1.1
github.com/gorilla/sessions v1.2.0
github.com/gtank/cryptopasta v0.0.0-20170601214702-1f550f6f2f69
github.com/hashicorp/go-cleanhttp v0.5.1
github.com/jackc/pgx/v4 v4.11.0
github.com/jmoiron/sqlx v1.3.3
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/jackc/pgx/v4 v4.13.0
github.com/jmoiron/sqlx v1.3.4
github.com/julienschmidt/httprouter v1.3.0
github.com/luna-duclos/instrumentedsql v1.1.3
github.com/luna-duclos/instrumentedsql/opentracing v0.0.0-20201103091713-40d03108b6f4
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
github.com/oleiade/reflections v1.0.1
github.com/olekukonko/tablewriter v0.0.1
github.com/ory/analytics-go/v4 v4.0.1
github.com/ory/analytics-go/v4 v4.0.2
github.com/ory/fosite v0.40.3-0.20210927193520-47901ddecc68
github.com/ory/go-acc v0.2.6
github.com/ory/graceful v0.1.1
github.com/ory/herodot v0.9.6
github.com/ory/x v0.0.278
github.com/ory/herodot v0.9.12
github.com/ory/x v0.0.300
github.com/pborman/uuid v1.2.1
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.9.0
github.com/rs/cors v1.6.0
github.com/prometheus/client_golang v1.11.0
github.com/rs/cors v1.8.0
github.com/sawadashota/encrypta v0.0.2
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.1.3
github.com/spf13/cobra v1.2.1
github.com/stretchr/testify v1.7.0
github.com/tidwall/gjson v1.7.1
github.com/tidwall/gjson v1.9.4
github.com/toqueteos/webbrowser v1.2.0
github.com/urfave/negroni v1.0.0
go.uber.org/automaxprocs v1.3.0
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5
golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c // indirect
golang.org/x/tools v0.1.1
gopkg.in/DataDog/dd-trace-go.v1 v1.27.1
gopkg.in/square/go-jose.v2 v2.5.2-0.20210529014059-a5c7eec3c614
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c
golang.org/x/tools v0.1.7
gopkg.in/DataDog/dd-trace-go.v1 v1.33.0
gopkg.in/square/go-jose.v2 v2.6.0
)
Loading

0 comments on commit ce1b378

Please sign in to comment.