If you want to update this page or add new content, please submit a pull request to the Homepage.
Resources
Yorkie provides project-level resource settings to control document limits, lifecycle behavior, and performance characteristics. These settings help you manage resources and optimize Yorkie for your specific use case.
Configuration Methods
Resource settings can be configured through:
- CLI: Using
yorkie project updatecommand - Dashboard: Through the project settings page
- Admin API: Using the UpdateProject endpoint
Document Limits
Control the size and scale of documents in your project. These limits help you prevent resource exhaustion, ensure predictable performance, and protect your infrastructure from unexpected load.
| Setting | Default | Description |
|---|---|---|
max-size-per-document | 10 MiB | Maximum size of a document in bytes |
max-subscribers-per-document | 0 (unlimited) | Maximum number of clients that can subscribe to a document |
max-attachments-per-document | 0 (unlimited) | Maximum number of clients that can attach to a document |
MaxSizePerDocument
Limits the maximum size of a single document. When a document exceeds this limit, further modifications that would increase its size are rejected.
# Configure via Admin API (not available via CLI)# Use the Dashboard or Admin API to set this value
When to use:
- Rich content editors: Limit document size to prevent performance degradation when editing large documents with images or complex formatting
- Memory management: Ensure documents fit within your server's available memory
- Client performance: Prevent clients from downloading excessively large documents that could freeze their applications
- Cost control: Limit storage and bandwidth costs for document synchronization
Example scenarios:
- Text editor applications: Set to 1-10 MiB depending on expected content richness
- Code collaboration tools: Set to 1-5 MiB as code files are typically smaller
- Drawing/whiteboard apps: Set to 1-20 MiB to accommodate shapes
MaxAttachmentsPerDocument
Limits how many clients can attach to a single document simultaneously. Set to 0 for unlimited attachments.
yorkie project update [project-name] \--max-attachments-per-document 50
When to use:
- Concurrent editing control: Limit the number of clients actively editing a document
- Conflict prevention: Reduce merge complexity by limiting concurrent editors
- Resource protection: Prevent excessive server load from too many active connections
- License enforcement: Enforce concurrent user limits based on your pricing model
Example scenarios:
- Real-time document editing: Set to 5-20 for optimal collaboration experience
- Code pair programming: Set to 2-4 for focused collaboration
- Whiteboard sessions: Set to 10-30 depending on session size
- View-only scenarios: Use MaxSubscribersPerDocument instead, as viewing doesn't require attachment
MaxSubscribersPerDocument
Limits how many clients can subscribe (watch for changes) to a single document simultaneously. Set to 0 for unlimited subscribers.
Unlike attachment limits, this setting controls event streaming clients that receive updates without actively editing the document.
yorkie project update [project-name] \--max-subscribers-per-document 100
Snapshot Configuration
Snapshots improve performance by sending complete document state instead of individual changes when clients are significantly behind.
| Setting | Default | Description |
|---|---|---|
snapshot-threshold | 500 | Number of changes that triggers snapshot delivery |
snapshot-interval | 500 | Interval of changes to create a snapshot |
SnapshotThreshold
When a client needs to fetch more changes than this threshold, the server sends a snapshot instead of individual changes. This is more efficient for clients that have been offline for extended periods.
yorkie project update [project-name] \--snapshot-threshold 1000
When a client receives a snapshot instead of incremental changes, a snapshot event is triggered. Your application should handle this event to update its state. See Document Events for more details.
SnapshotInterval
The interval at which snapshots are created and stored. Lower values create snapshots more frequently, which uses more storage but improves performance for clients that reconnect after being offline.
yorkie project update [project-name] \--snapshot-interval 1000
Lifecycle Settings
Control how documents and clients are managed over time.
| Setting | Default | Description |
|---|---|---|
client-deactivate-threshold | 24h | Time after which inactive clients are deactivated |
remove-on-detach | false | Automatically remove documents when all clients detach |
auto-revision-enabled | true | Automatically create revisions during snapshot creation |
ClientDeactivateThreshold
Clients that haven't communicated with the server for longer than this threshold are automatically deactivated during housekeeping. This helps clean up stale client connections.
yorkie project update [project-name] \--client-deactivate-threshold 48h
RemoveOnDetach
When enabled, documents are automatically removed from the server when the last client detaches. This is useful for temporary collaborative sessions where you don't need to persist the document after collaboration ends.
yorkie project update [project-name] \--remove-on-detach true
Use this setting carefully. Once enabled, documents will be permanently deleted when all clients detach. This cannot be undone.
See Architecture Patterns - Pattern B for a use case of this setting.
AutoRevisionEnabled
When enabled, revisions are automatically created during snapshot creation. Revisions allow you to restore documents to previous states.
# Configure via Admin API (not available via CLI)# Use the Dashboard or Admin API to set this value
Configuration Reference
| Setting | CLI Flag | Default | Type |
|---|---|---|---|
| MaxSizePerDocument | Admin API only | 10 MiB | int (bytes) |
| MaxSubscribersPerDocument | --max-subscribers-per-document | 0 | int |
| MaxAttachmentsPerDocument | --max-attachments-per-document | 0 | int |
| SnapshotThreshold | --snapshot-threshold | 500 | int |
| SnapshotInterval | --snapshot-interval | 500 | int |
| ClientDeactivateThreshold | --client-deactivate-threshold | 24h | duration |
| RemoveOnDetach | --remove-on-detach | false | bool |
| AutoRevisionEnabled | Admin API only | true | bool |
Example: High-Traffic Configuration
For projects with many concurrent users:
yorkie project update my-project \--max-subscribers-per-document 500 \--max-attachments-per-document 500 \--snapshot-threshold 200 \--snapshot-interval 200 \--client-deactivate-threshold 12h
Example: Temporary Sessions
For temporary collaborative sessions that don't need persistence:
yorkie project update my-project \--remove-on-detach true \--client-deactivate-threshold 1h
Related Documentation
- CLI Reference - Complete CLI command reference
- Admin API - API for project management
- Architecture Patterns - Document lifecycle patterns
- JS SDK - Document Events - Handling snapshot events