graphql-engine/server/graphql-engine.cabal
Brandon Simmons f9b5b8382c Lower stack chunk size in RTS to reduce thread STACK memory (closes #5190)
This reduces memory consumption for new idle subscriptions significantly
(see linked ticket).

The hypothesis is: we fork a lot of threads per websocket, and some of
these use slightly more than the initial 1K stack size, so the first
overflow balloons to 32K, when significantly less is required.

However: running with `+RTS -K1K -xc` did not seem to show evidence of
any overflows! So it's a mystery why this improves things.

GHC should probably also be doubling the stack buffer at each overflow
or doing something even smarter; the knobs we have aren't so helpful.
2020-06-25 14:42:51 -04:00

499 lines
18 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

cabal-version: 2.2
name: graphql-engine
version: 1.0.0
synopsis: GraphQL API over Postgres
homepage: https://www.hasura.io
license: Apache-2.0
author: Vamshi Surabhi
maintainer: vamshi@hasura.io
copyright: Hasura Inc.
category: Database
build-type: Simple
source-repository head
type: git
location: https://github.com/hasura/graphql-engine
flag developer
description: Enable support for development-only APIs
default: False
manual: True
common common-all
ghc-options:
-fmax-simplifier-iterations=20 -foptimal-applicative-do
-Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints
if flag(developer)
cpp-options: -DDeveloperAPIs
default-language: Haskell2010
default-extensions:
ApplicativeDo BangPatterns BlockArguments ConstraintKinds DataKinds DefaultSignatures DeriveDataTypeable
DeriveFoldable DeriveFunctor DeriveGeneric DeriveLift DeriveTraversable DerivingVia EmptyCase
FlexibleContexts FlexibleInstances FunctionalDependencies GeneralizedNewtypeDeriving
InstanceSigs LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns NoImplicitPrelude
OverloadedStrings QuantifiedConstraints QuasiQuotes RankNTypes RecordWildCards ScopedTypeVariables
StandaloneDeriving TemplateHaskell TupleSections TypeApplications TypeFamilies TypeOperators
RecordWildCards
common common-exe
ghc-options:
-threaded -rtsopts
-- Re. `-I2` see #2565
--
-- `-qn2` limits the parallel GC to at most 2 capabilities. This came up in #3354/#3394, as the
-- parallel GC was causing significant performance overhead. Folks in #ghc on freenode advised
-- limiting the parallel GC to 2 or 3 capabilities as a very conservative choice, since more
-- than that is highly unlikely to ever be helpful. More benchmarking would be useful to know if
-- this is the right decision. Its possible it would better to just turn it off completely.
--
-- `-kc8K` helps limit memory consumption in websockets (perhaps elsewhere) by making the
-- cost of a thread's first (and probably only) stack overflow less severe.
-- See:https://github.com/hasura/graphql-engine/issues/5190
"-with-rtsopts=-N -I2 -qn2 -kc8K"
library
import: common-all
hs-source-dirs: src-lib
build-depends: base
, bifunctors
, witherable
, validation
, lifted-base
, pg-client
, text
, text-builder >= 0.6
, vector-builder
, bytestring
, postgresql-libpq
, mtl
, aeson
, aeson-casing
, unordered-containers
, template-haskell
, hashable
, transformers
, transformers-base
, http-types
, attoparsec
, attoparsec-iso8601 >= 1.0
, time >= 1.9
, scientific
, Spock-core
, split
, optparse-applicative
, containers
, monad-control
, monad-time
, monad-validate
, fast-logger
, wai
, postgresql-binary
, process
, http-client-tls
, profunctors
, deepseq
, dependent-map >=0.2.4 && <0.4
, dependent-sum >=0.4 && <0.5
, exceptions
, these
, semialign
-- Encoder related
, uuid
, vector
, vector-builder
-- Logging related
, network
, byteorder
-- for parsing RSA keys
, cryptonite
-- for jwt verification
, jose
, pem
, x509
, asn1-encoding
, asn1-types
-- Server related
, warp
, th-lift-instances
, lens
-- GraphQL related
, graphql-parser
-- URL parser related
, network-uri
, uri-encode
-- String related
, case-insensitive
, text-conversions
-- Http client
, wreq
, http-client
-- ordered map
, insert-ordered-containers
-- Parsing SemVer
, semver
-- Templating
, mustache
, file-embed
, shakespeare >= 2.0.22
--
, data-has
-- for src-exec
, yaml
, template-haskell >= 2.11
-- websockets interface related
, websockets
, wai-websockets
, stm
, stm-containers
, list-t
, async
, lifted-async
, immortal < 0.3
-- logging related
, base64-bytestring >= 1.0
, auto-update
-- regex related
, regex-tdfa >=1.3.1 && <1.4
-- pretty printer
, ansi-wl-pprint
-- for capturing various metrics
, ekg-core
, ekg-json
-- metrics for CI integration
, ci-info
-- serve static files
, filepath >= 1.4
, mime-types >= 0.1
-- for handling posix signals for graceful shutdown
, unix
-- HTTP compression
, zlib
-- caching
, psqueues >= 0.2
-- testing
, QuickCheck
, generic-arbitrary
, quickcheck-instances
-- 0.6.1 is supposedly not okay for ghc 8.6:
-- https://github.com/nomeata/ghc-heap-view/issues/27
, ghc-heap-view
, directory
, semigroups >= 0.19.1
-- scheduled triggers
, cron >= 0.6.2
exposed-modules: Control.Arrow.Extended
, Control.Arrow.Trans
, Control.Monad.Stateless
, Control.Monad.Unique
, Data.Time.Clock.Units
-- exposed for tests
, Data.Parser.CacheControl
, Data.URL.Template
, Hasura.Prelude
, Hasura.App
, Hasura.Db
-- Exposed for benchmark:
, Hasura.Cache.Types
, Hasura.Cache.Bounded
, Hasura.Cache.Unbounded
, Hasura.Cache
, Hasura.Logging
, Hasura.HTTP
, Hasura.Incremental
, Hasura.Server.App
, Hasura.Server.Auth
, Hasura.Server.Cors
, Hasura.Server.Init
, Hasura.Server.Init.Config
, Hasura.Server.API.Query
, Hasura.Server.Utils
, Hasura.Server.Version
, Hasura.Server.Logging
, Hasura.Server.Migrate
, Hasura.Server.Compression
, Hasura.Server.API.PGDump
-- exposed for Pro
, Hasura.Server.API.Config
, Hasura.Server.Telemetry
-- Exposed for testing:
, Hasura.Server.Telemetry.Counters
, Data.Parser.JSONPath
, Hasura.Server.Auth.JWT
-- exposed for Pro
, Hasura.GraphQL.Execute
, Hasura.GraphQL.Execute.Query
, Hasura.GraphQL.Execute.LiveQuery
, Hasura.GraphQL.Validate
, Hasura.GraphQL.Transport.HTTP
, Hasura.GraphQL.Transport.WebSocket.Protocol
, Hasura.GraphQL.Transport.WebSocket.Server
, Hasura.GraphQL.Logging
, Hasura.RQL.Types
, Hasura.RQL.Types.Run
, Hasura.RQL.DDL.Metadata
, Hasura.RQL.DDL.Metadata.Types
, Hasura.RQL.DDL.Metadata.Generator
, Hasura.RQL.DDL.Schema
-- required for buildRebuildableSchemaCache and runCacheRWT to be exposed
, Hasura.RQL.DDL.Schema.Cache
, Hasura.EncJSON
, Hasura.Session
, Data.Aeson.Ordered
, Data.TByteString
, Network.Wai.Extended
, Control.Concurrent.Extended
other-modules: Hasura.Incremental.Select
, Hasura.Incremental.Internal.Cache
, Hasura.Incremental.Internal.Dependency
, Hasura.Incremental.Internal.Rule
, Hasura.Server.Auth.WebHook
, Hasura.Server.Middleware
, Hasura.Server.CheckUpdates
, Hasura.Server.SchemaUpdate
, Hasura.Server.Migrate.Version
, Hasura.Server.Auth.JWT.Internal
, Hasura.Server.Auth.JWT.Logging
, Hasura.RQL.Instances
, Hasura.RQL.Types.SchemaCache
, Hasura.RQL.Types.Table
, Hasura.RQL.Types.SchemaCache.Build
, Hasura.RQL.Types.SchemaCacheTypes
, Hasura.RQL.Types.BoolExp
, Hasura.RQL.Types.Function
, Hasura.RQL.Types.Catalog
, Hasura.RQL.Types.Column
, Hasura.RQL.Types.Common
, Hasura.RQL.Types.ComputedField
, Hasura.RQL.Types.DML
, Hasura.RQL.Types.Error
, Hasura.RQL.Types.EventTrigger
, Hasura.RQL.Types.Metadata
, Hasura.RQL.Types.Permission
, Hasura.RQL.Types.QueryCollection
, Hasura.RQL.Types.Action
, Hasura.RQL.Types.RemoteSchema
, Hasura.RQL.Types.ScheduledTrigger
, Hasura.RQL.DDL.ComputedField
, Hasura.RQL.DDL.Relationship
, Hasura.RQL.Types.CustomTypes
, Hasura.RQL.Types.RemoteRelationship
, Hasura.RQL.DDL.Deps
, Hasura.RQL.DDL.Permission.Internal
, Hasura.RQL.DDL.Permission
, Hasura.RQL.DDL.Relationship.Rename
, Hasura.RQL.DDL.Relationship.Types
, Hasura.RQL.DDL.Schema.Cache.Common
, Hasura.RQL.DDL.Schema.Cache.Dependencies
, Hasura.RQL.DDL.Schema.Cache.Fields
, Hasura.RQL.DDL.Schema.Cache.Permission
, Hasura.RQL.DDL.Schema.Catalog
, Hasura.RQL.DDL.Schema.Diff
, Hasura.RQL.DDL.Schema.Enum
, Hasura.RQL.DDL.Schema.Function
, Hasura.RQL.DDL.Schema.Rename
, Hasura.RQL.DDL.Schema.Table
, Hasura.RQL.DDL.Utils
, Hasura.RQL.DDL.EventTrigger
, Hasura.RQL.DDL.ScheduledTrigger
, Hasura.RQL.DDL.Headers
, Hasura.RQL.DDL.RemoteSchema
, Hasura.RQL.DDL.QueryCollection
, Hasura.RQL.DDL.Action
, Hasura.RQL.DDL.CustomTypes
, Hasura.RQL.DDL.RemoteRelationship
, Hasura.RQL.DDL.RemoteRelationship.Validate
, Hasura.RQL.DML.Delete
, Hasura.RQL.DML.Internal
, Hasura.RQL.DML.Insert
, Hasura.RQL.DML.Mutation
, Hasura.RQL.DML.Returning
, Hasura.RQL.DML.Select.Internal
, Hasura.RQL.DML.Select.Types
, Hasura.RQL.DML.Select
, Hasura.RQL.DML.Update
, Hasura.RQL.DML.Count
, Hasura.RQL.DML.RemoteJoin
, Hasura.RQL.GBoolExp
, Hasura.GraphQL.Transport.HTTP.Protocol
, Hasura.GraphQL.Transport.WebSocket
, Hasura.GraphQL.Schema.BoolExp
, Hasura.GraphQL.Schema.Common
, Hasura.GraphQL.Schema.CustomTypes
, Hasura.GraphQL.Schema.Builder
, Hasura.GraphQL.Schema.Action
, Hasura.GraphQL.Schema.Function
, Hasura.GraphQL.Schema.OrderBy
, Hasura.GraphQL.Schema.Select
, Hasura.GraphQL.Schema.Merge
, Hasura.GraphQL.Schema.Mutation.Common
, Hasura.GraphQL.Schema.Mutation.Insert
, Hasura.GraphQL.Schema.Mutation.Update
, Hasura.GraphQL.Schema.Mutation.Delete
, Hasura.GraphQL.Schema
, Hasura.GraphQL.RelaySchema
, Hasura.GraphQL.Utils
, Hasura.GraphQL.NormalForm
, Hasura.GraphQL.Validate.Types
, Hasura.GraphQL.Validate.Context
, Hasura.GraphQL.Validate.SelectionSet
, Hasura.GraphQL.Validate.InputValue
, Hasura.GraphQL.Explain
, Hasura.GraphQL.Execute.Plan
, Hasura.GraphQL.Execute.LiveQuery.Options
, Hasura.GraphQL.Execute.LiveQuery.Plan
, Hasura.GraphQL.Execute.LiveQuery.Poll
, Hasura.GraphQL.Execute.LiveQuery.State
, Hasura.GraphQL.Execute.LiveQuery.TMap
, Hasura.GraphQL.Resolve
, Hasura.GraphQL.Resolve.Action
, Hasura.GraphQL.Resolve.Types
, Hasura.GraphQL.Resolve.Context
, Hasura.GraphQL.Resolve.BoolExp
, Hasura.GraphQL.Resolve.InputValue
, Hasura.GraphQL.Resolve.Introspect
, Hasura.GraphQL.Resolve.Insert
, Hasura.GraphQL.Resolve.Mutation
, Hasura.GraphQL.Resolve.Select
, Hasura.GraphQL.RemoteServer
, Hasura.GraphQL.Context
, Hasura.Eventing.HTTP
, Hasura.Eventing.EventTrigger
, Hasura.Eventing.ScheduledTrigger
, Control.Lens.Extended
, Data.Aeson.Extended
, Data.List.Extended
, Data.HashMap.Strict.Extended
, Data.HashMap.Strict.InsOrd.Extended
, Data.Sequence.NonEmpty
, Data.Text.Extended
, Data.Parser.Expires
, Hasura.SQL.DML
, Hasura.SQL.Error
, Hasura.SQL.GeoJSON
, Hasura.SQL.Rewrite
, Hasura.SQL.Time
, Hasura.SQL.Types
, Hasura.SQL.Value
, Network.URI.Extended
, Network.Wai.Handler.WebSockets.Custom
executable graphql-engine
import: common-all, common-exe
hs-source-dirs: src-exec
main-is: Main.hs
build-depends: base
, graphql-engine
, bytestring
, pg-client
, text
, text-conversions
, unix
test-suite graphql-engine-tests
import: common-all, common-exe
type: exitcode-stdio-1.0
build-depends:
, aeson
, base
, bytestring
, graphql-engine
, hspec >=2.6.1 && <3
, hspec-core >=2.6.1 && <3
, hspec-expectations-lifted
, http-client
, http-types
, http-client-tls
, jose
, lifted-base
, monad-control
, mtl
, natural-transformation >=0.4 && <0.5
, optparse-applicative
, pg-client
, process
, QuickCheck
, safe
, split
, time
, transformers-base
, unordered-containers
, text
hs-source-dirs: src-test
main-is: Main.hs
other-modules:
Data.Parser.CacheControlSpec
Data.Parser.URLTemplate
Data.Parser.JSONPathSpec
Data.TimeSpec
Hasura.IncrementalSpec
Hasura.RQL.MetadataSpec
Hasura.Server.MigrateSpec
Hasura.Server.TelemetrySpec
Hasura.Server.AuthSpec
-- Benchmarks related to caching (e.g. the plan cache).
--
-- NOTE: Some of these are very slow and can only be reasonably run with `cache -n 1` for now.
benchmark cache
import: common-all, common-exe
type: exitcode-stdio-1.0
main-is: Main.hs
hs-source-dirs: src-bench-cache
build-depends: base
, criterion
, mwc-random
, mwc-probability
, vector
, deepseq
, graphql-engine
, split
, async
, text
, bytestring