mirror of
https://github.com/aljazceru/pear-docs.git
synced 2025-12-17 14:34:19 +01:00
Add Best practices article (#186)
* Add aside about using only one corestore instance per application A single corestore instance covers all needs and avoids pitfalls (such as file locks and named hypercores not being the same key) that come from multiple corestore instances. * Add note for best practice to create one hyperswarm instance per app * Create a best practices guide for Pear Application development * Add "Best Practices" article to SUMMARY.md & README.md * Include points added to the guides on using single swarm & store * Fix capitalization in Best Practices article
This commit is contained in:
@@ -66,3 +66,5 @@ pear run --dev .
|
||||
This will display the topic. Copy/paste that topic into as many additional terminals as desired with `pear run --dev . <SUPPLY TOPIC HERE>` (assuming that the current working directory of each terminal is the `peer-app` folder). Each peer will log information about the other connected peers.
|
||||
|
||||
Start typing into any terminal, and it will be broadcast to all connected peers.
|
||||
|
||||
> It is best practice to only have one Hyperswarm instance per application. This will speed up connections by reducing number of entries per topic and connections.
|
||||
|
||||
@@ -6,6 +6,11 @@ An append-only log is powerful on its own, but it's most useful as a building bl
|
||||
|
||||
In [How to replicate and persist with Hypercore](./replicate-and-persist-with-hypercore.md), only single Hypercore instance was replicated. But in this how-to, we will replicate a single Corestore instance, which will internally manage the replication of a collection of Hypercores. We will achieve this with two Pear Terminal Applications: `multicore-writer-app` and `multicore-reader-app`.
|
||||
|
||||
> Only one Corestore per application is needed. This is the recommended best practices to make managing Hypercores efficient and to avoid pitfalls from having multiple Corestores. A single Corestore will:
|
||||
> - Manage multiple sessions for the same Hypercore.
|
||||
> - Requires only one replication stream per peer connection.
|
||||
> - Simplifies referring to Hypercores by a name.
|
||||
|
||||
Create the `multicore-writer-app` project with these commands:
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user