hasura / hasura/graphql-engine

[v2.0.0-alpha.3] graphql-engine consumes large amounts of memory/CPU

Open
#6,641 4 comments 3 reactions 1 assignee Claimed by @jberryman View on GitHub
a/performance c/server t/server
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

We're using docker-compose on a fresh ubuntu server and after applying migrations/metadata, graphql-engine shows 50% memory usage (2GB/4GB) when idle. There are frequent CPU spikes of 100% when browsing the console, too. We have around 600 tables and 25,000+ lines of metadata. Could it be that the memory usage of graphql-engine is proportional to the amount of tables/metadata? I'd be willing to give access to the schema, metadata and server privately in order to diagnose the issue further, if needed. Thanks.

### System info
Hasura v2.0.0-alpha.3 (server and CLI)
PostgreSQL 12.6
Ubuntu 20.04.1 LTS
Docker 19.03.13
Docker Compose 1.27.4

Screen Shot 2021-03-08 at 21 49 50

### Startup logs
```
graphql-engine_1 | {"type":"startup","timestamp":"2021-03-08T22:08:30.339+0000","level":"info","detail":{"kind":"server_configuration","info":{"live_query_options":{"batch_size":100,"refetch_delay":1},"transaction_isolation":"ISOLATION LEVEL READ COMMITTED","plan_cache_options":{"plan_cache_size":4000},"enable_maintenance_mode":false,"enabled_log_types":["http-log","websocket-log","startup","webhook-log","query-log"],"server_host":"HostAny","enable_allowlist":false,"remote_schema_permissions":"false","log_level":"info","auth_hook_mode":null,"use_prepared_statements":true,"unauth_role":"anonymous","stringify_numeric_types":false,"enabled_apis":["metadata","graphql"],"enable_telemetry":false,"enable_console":false,"auth_hook":null,"infer_function_permissions":true,"jwt_secret":{"audience":"...","claims_format":"json","claims_namespace":"https://hasura.io/jwt/claims","key":"","header":null,"type":"","issuer":"..."},"cors_config":{"allowed_origins":"*","disabled":false,"ws_read_cookie":null},"websocket_compression_options":"NoCompression","console_assets_dir":null,"admin_secret_set":true,"port":8080,"websocket_keep_alive":"KeepAliveDelay {unKeepAliveDelay = Seconds {seconds = 5s}}"}}}
graphql-engine_1 | {"type":"startup","timestamp":"2021-03-08T22:08:30.339+0000","level":"info","detail":{"kind":"postgres_connection","info":{"retries":1,"database_url":"postgres://postgres:...@postgres:5432/postgres"}}}
graphql-engine_1 | {"type":"startup","timestamp":"2021-03-08T22:08:30.339+0000","level":"info","detail":{"kind":"schema-sync","info":{"thread_id":"ThreadId 15","instance_id":"22ae1715-6cf8-4278-8e0a-4fdb62996f4b","message":"listener thread started"}}}
graphql-engine_1 | {"type":"unstructured","timestamp":"2021-03-08T22:08:30.339+0000","level":"info","detail":"Thread SchemeUpdate.listener (re)started"}
graphql-engine_1 | {"type":"startup","timestamp":"2021-03-08T22:08:51.013+0000","level":"info","detail":{"kind":"catalog_migrate","info":"Already at the latest catalog version (44); nothing to do."}}
graphql-engine_1 | {"type":"unstructured","timestamp":"2021-03-08T22:08:51.013+0000","level":"info","detail":"Thread ourIdleGC (re)started"}
graphql-engine_1 | {"type":"unstructured","timestamp":"2021-03-08T22:08:51.013+0000","level":"info","detail":"Thread SchemeUpdate.processor (re)started"}
graphql-engine_1 | {"type":"schema-sync-thread","timestamp":"2021-03-08T22:08:51.013+0000","level":"info","detail":{"thread_type":"processor","info":{"processed_event":"event listening started at 2021-03-08 22:08:30.385390157 UTC"}}}
graphql-engine_1 | {"type":"unstructured","timestamp":"2021-03-08T22:08:51.013+0000","level":"info","detail":"Thread runCronEventsGenerator (re)started"}
graphql-engine_1 | {"type":"startup","timestamp":"2021-03-08T22:08:51.013+0000","level":"info","detail":{"kind":"schema-sync","info":{"thread_id":"ThreadId 26","instance_id":"22ae1715-6cf8-4278-8e0a-4fdb62996f4b","message":"processor thread started"}}}
graphql-engine_1 | {"type":"startup","timestamp":"2021-03-08T22:08:51.013+0000","level":"info","detail":{"kind":"event_triggers","info":"starting workers"}}
graphql-engine_1 | {"type":"unstructured","timestamp":"2021-03-08T22:08:51.013+0000","level":"info","detail":"Thread processEventQueue (re)started"}
graphql-engine_1 | {"type":"unstructured","timestamp":"2021-03-08T22:08:51.013+0000","level":"info","detail":"Thread asyncActionsProcessor (re)started"}
graphql-engine_1 | {"type":"startup","timestamp":"2021-03-08T22:08:51.013+0000","level":"info","detail":{"kind":"scheduled_triggers","info":"preparing data"}}
graphql-engine_1 | {"type":"unstructured","timestamp":"2021-03-08T22:08:51.013+0000","level":"info","detail":"Thread processScheduledTriggers (re)started"}
graphql-engine_1 | {"type":"unstructured","timestamp":"2021-03-08T22:08:51.013+0000","level":"info","detail":"Thread checkForUpdates (re)started"}
graphql-engine_1 | {"type":"startup","timestamp":"2021-03-08T22:08:51.013+0000","level":"info","detail":{"kind":"server","info":{"time_taken":20.801053803,"message":"starting API server"}}}
graphql-engine_1 | {"type":"schema-sync-thread","timestamp":"2021-03-08T22:09:08.839+0000","level":"info","detail":{"thread_type":"processor","info":{"message":"schema cache reloaded"}}}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.