Skip to content

Commit

Permalink
added memory limit setting (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevensJourney authored Sep 26, 2024
1 parent 0b45602 commit 8b8fd42
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# PowerSync Self Hosted Example

## v0.5.2

- Added note for PowerSync service memory limits using the `NODE_OPTIONS` environment variable.

## v0.5.1

- Use Next (development) PowerSync service image for testing.
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Populate the `replication->connections` entry with your database connection deta

- **Postgres:** A simple Postgres server is provided in the `ps-postgres.yaml` Docker Compose file. Be sure to keep the credentials in `powersync.yaml` in sync with the config in `ps-postgres.yaml` if using this server.

- **MongoDB:** See the [`nodejs-mongodb` demo](./demos/nodejs-mongodb/) for MongoDB connection configuration.
- **MongoDB:** See the [`nodejs-mongodb` demo](./demos/nodejs-mongodb/) for MongoDB connection configuration.

### Storage

Expand All @@ -56,6 +56,12 @@ The `key-generator` project demonstrates generating RSA key pairs for token sign

[Sync Rules](https://docs.powersync.com/usage/sync-rules) are currently defined by placing them in `./config/sync_rules.yaml`.

### Memory Limits

It's recommended to set the `NODE_OPTIONS="--max-old-space-size=<size>"` environment variable to increase the default Node.js memory limit.

Service memory limits should be adjusted to roughly 80 percent of the system memory capacity.

# Cleanup

If you want to start from a fresh start:
Expand Down
3 changes: 3 additions & 0 deletions services/powersync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ services:
# command: ['start', '-r', 'unified', '-c64', '[base64 encoded content]']
POWERSYNC_CONFIG_PATH: /config/powersync.yaml

# Service memory limits should be adjusted to roughly 80 percent of the system memory capacity
NODE_OPTIONS: --max-old-space-size=1000

# Sync rules can be specified as base 64 encoded YAML
# e.g: Via an environment variable
# POWERSYNC_SYNC_RULES_B64: "[base64 encoded sync rules]"
Expand Down

0 comments on commit 8b8fd42

Please sign in to comment.