mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-04 11:55:50 +00:00
87
content/_img-sources/fetch_depth.uxf
Normal file
87
content/_img-sources/fetch_depth.uxf
Normal file
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<diagram program="umlet" version="14.2">
|
||||
<zoom_level>10</zoom_level>
|
||||
<element>
|
||||
<id>UMLClass</id>
|
||||
<coordinates>
|
||||
<x>30</x>
|
||||
<y>70</y>
|
||||
<w>210</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>Ledgers not stored
|
||||
bg=#e1e4e8
|
||||
fg=#23292f
|
||||
lt=..</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>20</x>
|
||||
<y>110</y>
|
||||
<w>740</w>
|
||||
<h>50</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=->>
|
||||
|
||||
Ledger versions
|
||||
m1=oldest
|
||||
m2=newest</panel_attributes>
|
||||
<additional_attributes>10.0;20.0;720.0;20.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLClass</id>
|
||||
<coordinates>
|
||||
<x>240</x>
|
||||
<y>70</y>
|
||||
<w>240</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>Ledgers available locally but not served to peers
|
||||
style=wordwrap
|
||||
bg=#999da2
|
||||
fg=#f5f7f9
|
||||
transparency=0</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLClass</id>
|
||||
<coordinates>
|
||||
<x>480</x>
|
||||
<y>70</y>
|
||||
<w>260</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>Ledgers served to peers
|
||||
when requested
|
||||
style=wordwrap
|
||||
bg=#1db4ff
|
||||
transparency=0
|
||||
fg=#f5f7f9</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Text</id>
|
||||
<coordinates>
|
||||
<x>270</x>
|
||||
<y>30</y>
|
||||
<w>170</w>
|
||||
<h>30</h>
|
||||
</coordinates>
|
||||
<panel_attributes>fetch_depth setting
|
||||
style=wordwrap</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>410</x>
|
||||
<y>30</y>
|
||||
<w>90</w>
|
||||
<h>60</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<<<-</panel_attributes>
|
||||
<additional_attributes>70.0;40.0;70.0;10.0;10.0;10.0</additional_attributes>
|
||||
</element>
|
||||
</diagram>
|
||||
2005
content/_img-sources/online-deletion-process.uxf
Normal file
2005
content/_img-sources/online-deletion-process.uxf
Normal file
File diff suppressed because it is too large
Load Diff
195
content/_img-sources/online_delete-vs-ledger_history.uxf
Normal file
195
content/_img-sources/online_delete-vs-ledger_history.uxf
Normal file
@@ -0,0 +1,195 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<diagram program="umlet" version="14.2">
|
||||
<zoom_level>10</zoom_level>
|
||||
<element>
|
||||
<id>UMLClass</id>
|
||||
<coordinates>
|
||||
<x>50</x>
|
||||
<y>140</y>
|
||||
<w>330</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>Delete automatically
|
||||
bg=#e1e4e8
|
||||
fg=#23292f
|
||||
lt=..</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>40</x>
|
||||
<y>180</y>
|
||||
<w>740</w>
|
||||
<h>50</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=->>
|
||||
|
||||
Ledger versions
|
||||
m1=oldest
|
||||
m2=newest</panel_attributes>
|
||||
<additional_attributes>10.0;20.0;720.0;20.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLClass</id>
|
||||
<coordinates>
|
||||
<x>380</x>
|
||||
<y>140</y>
|
||||
<w>170</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>Keep if available
|
||||
bg=#999da2
|
||||
fg=#f5f7f9
|
||||
transparency=0</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLClass</id>
|
||||
<coordinates>
|
||||
<x>550</x>
|
||||
<y>140</y>
|
||||
<w>210</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>Backfill if possible
|
||||
bg=#1db4ff
|
||||
transparency=0
|
||||
fg=#f5f7f9</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>540</x>
|
||||
<y>100</y>
|
||||
<w>70</w>
|
||||
<h>60</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<<<-</panel_attributes>
|
||||
<additional_attributes>10.0;40.0;10.0;10.0;50.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Text</id>
|
||||
<coordinates>
|
||||
<x>590</x>
|
||||
<y>100</y>
|
||||
<w>210</w>
|
||||
<h>30</h>
|
||||
</coordinates>
|
||||
<panel_attributes>ledger_history setting
|
||||
style=wordwrap</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Text</id>
|
||||
<coordinates>
|
||||
<x>170</x>
|
||||
<y>100</y>
|
||||
<w>170</w>
|
||||
<h>30</h>
|
||||
</coordinates>
|
||||
<panel_attributes>online_delete setting
|
||||
style=wordwrap</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>320</x>
|
||||
<y>100</y>
|
||||
<w>80</w>
|
||||
<h>60</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<<<-</panel_attributes>
|
||||
<additional_attributes>60.0;40.0;60.0;10.0;10.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>40</x>
|
||||
<y>430</y>
|
||||
<w>740</w>
|
||||
<h>50</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=->>
|
||||
|
||||
Ledger versions
|
||||
m1=oldest
|
||||
m2=newest</panel_attributes>
|
||||
<additional_attributes>10.0;20.0;720.0;20.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Text</id>
|
||||
<coordinates>
|
||||
<x>110</x>
|
||||
<y>320</y>
|
||||
<w>230</w>
|
||||
<h>60</h>
|
||||
</coordinates>
|
||||
<panel_attributes>online_delete setting, or most recent can_delete point, whichever is older
|
||||
style=wordwrap</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLClass</id>
|
||||
<coordinates>
|
||||
<x>50</x>
|
||||
<y>390</y>
|
||||
<w>330</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>Delete automatically
|
||||
bg=#e1e4e8
|
||||
fg=#23292f
|
||||
lt=..</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>310</x>
|
||||
<y>340</y>
|
||||
<w>90</w>
|
||||
<h>70</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<<<-</panel_attributes>
|
||||
<additional_attributes>70.0;50.0;70.0;10.0;10.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLClass</id>
|
||||
<coordinates>
|
||||
<x>380</x>
|
||||
<y>390</y>
|
||||
<w>380</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>Backfill if possible
|
||||
bg=#1db4ff
|
||||
transparency=0
|
||||
fg=#f5f7f9</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Text</id>
|
||||
<coordinates>
|
||||
<x>50</x>
|
||||
<y>60</y>
|
||||
<w>220</w>
|
||||
<h>30</h>
|
||||
</coordinates>
|
||||
<panel_attributes>*Without advisory deletion*</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Text</id>
|
||||
<coordinates>
|
||||
<x>40</x>
|
||||
<y>280</y>
|
||||
<w>220</w>
|
||||
<h>30</h>
|
||||
</coordinates>
|
||||
<panel_attributes>*With advisory deletion*</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
</diagram>
|
||||
@@ -0,0 +1,56 @@
|
||||
# Ledger History
|
||||
|
||||
The [consensus process](intro-to-consensus.html) creates a chain of [validated ledger versions](ledgers.html), each derived from the previous one by applying a set of transactions. Every `rippled` server stores ledger versions and transaction history locally. The amount of transaction history a server stores depends on how long that server has been online and how much history it is configured to fetch and keep.
|
||||
|
||||
Servers in the peer-to-peer XRP Ledger network share transactions and other data with each other as part of the consensus process. Each server independently builds each new ledger version and compares results with its trusted validators to ensure consistency. (If a consensus of trusted validators disagrees with a server's results, that server fetches the necessary data from its peers to achieve consistency.) Servers can download older data from their peers to fill gaps in their available history. The structure of the ledger uses cryptographic [hashes](basic-data-types.html#hashes) of the data so that any server can verify the integrity and consistency of the data.
|
||||
|
||||
## Databases
|
||||
|
||||
Servers keep ledger state data and transactions in a key-value store called the _ledger store_. Additionally, `rippled` maintains a few SQLite database files for more flexible access to things like transaction history, and to track certain settings changes.
|
||||
|
||||
It is generally safe to delete all of a `rippled` server's database files when that server is not running. (You may want to do this, for example, if you change the server's storage settings or if you are switching from a test net to the production network.)
|
||||
|
||||
## Available History
|
||||
|
||||
By design, all data and transactions in the XRP Ledger are public, and anyone can search or query anything. However, your server can only search data that it has available locally. If you try to query for a ledger version or transaction that your server does not have available, your server replies that it cannot find that data. Other servers that have the necessary history can respond successfully to the same query. If you have a business that uses XRP Ledger data, you should be mindful of how much history your server has available.
|
||||
|
||||
The [server_info method][] reports how many ledger versions your server has available in the `complete_ledgers` field.
|
||||
|
||||
## Fetching History
|
||||
|
||||
When it starts, a `rippled` server's first priority is to get a complete copy of the latest validated ledger. From there, it keeps up with advances in the ledger progress. If configured to do so, the server also backfills ledger history up to a configured amount, which must be equal to or less than the cutoff beyond which online deletion is configured to delete.
|
||||
|
||||
The server can backfill history from before it became synced, as well as filling in any gaps in the history it has collected after syncing. (Gaps in ledger history can occur if a server temporarily becomes too busy to keep up with the network, loses its network connection, or suffers other temporary issues.) To backfill history, the server requests data from its peer `rippled` servers. The amount the server tries to backfill is defined by the `[ledger_history]` setting.
|
||||
|
||||
The XRP Ledger identifies data (on several different levels) by a unique hash of its contents. The XRP Ledger's state data contains a short summary of the ledger's history, in the form of the [LedgerHashes object type](ledgerhashes.html). Servers use the LedgerHashes objects to know which ledger versions to fetch, and to confirm that the ledger data they receive is correct and complete.
|
||||
|
||||
Backfilling history is one of the server's lowest priorities, so it may take a long time to fill missing history, especially if the server is busy or has less than sufficient hardware and network specs. For recommendations on hardware specs, see [Capacity Planning](capacity-planning.html). Backfilling history also requires that at least one of the server's direct peers has the history in question. <!--{# TODO: link some info for managing your peer connections when that exists #}-->
|
||||
|
||||
### With Advisory Deletion
|
||||
|
||||
If [online deletion](online-deletion.html) and advisory deletion are both enabled, the server automatically backfills data up to the oldest ledger it has not been allowed to delete yet. This can fetch data beyond the number of ledger versions configured in the `[ledger_history]` and `online_delete` settings. The [can_delete method][] tells the server what ledger versions it is allowed to delete.
|
||||
|
||||
|
||||
## Full History
|
||||
|
||||
Some servers in the XRP Ledger network are configured as "full-history" servers. These servers, which require significantly more disk space than other tracking servers, collect all available XRP Ledger history and **do not use online deletion**.
|
||||
|
||||
Ripple provides a set of public full-history servers as a public service at `s2.ripple.com`. This service is provided for the benefit of the larger XRP community. Ripple reserves the right to block those who abuse the servers or use more than their fair share of the servers' resources.
|
||||
|
||||
**Tip:** Unlike some cryptocurrency networks, servers in the XRP Ledger do not need full history to know the current state and keep up with current transactions.
|
||||
|
||||
For instructions on setting up full history, see [Configure Full History](configure-full-history.html).
|
||||
|
||||
## History Sharding
|
||||
|
||||
An alternative to storing the full history of the XRP Ledger on a single expensive machine is to configure many servers to each store a portion of ledger history. The [History Sharding](history-sharding.html) feature makes this possible, storing ranges of ledger history in a separate storage area called the _shard store_. When a peer server asks for specific data (as described in [fetching history](#fetching-history) above), a server can answer using data from either its ledger store or shard store.
|
||||
|
||||
Online deletion **does not** delete from the shard store. However, if you configure online deletion to keep at least 32768 ledger versions in your server's ledger store, your server can copy full shards from the ledger store to the shard store before automatically deleting them from the ledger store.
|
||||
|
||||
For more information, see [Configure History Sharding](configure-history-sharding.html).
|
||||
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
@@ -0,0 +1,122 @@
|
||||
# Online Deletion
|
||||
[[Source]<br/>](https://github.com/ripple/rippled/blob/master/src/ripple/app/misc/SHAMapStoreImp.cpp "Source")
|
||||
|
||||
The online deletion feature lets the `rippled` server delete the server's local copy of old ledger versions to keep disk usage from rapidly growing over time. The default config file sets online deletion to run automatically, but online deletion can also be configured to run only when prompted. [New in: rippled 0.27.0][]
|
||||
|
||||
The server always keeps the complete _current_ state of the ledger, with all the balances and settings it contains. The deleted data includes older transactions and versions of the ledger state that are older than the stored history.
|
||||
|
||||
The default config file sets the `rippled` server to keep the most recent 2000 ledger versions and automatically delete older data.
|
||||
|
||||
**Tip:** Even with online deletion, the amount of disk space required to store the same time span's worth of ledger data increases over time, because the size of individual ledger versions tends to grow over time. This growth is very slow in comparison to the accumulation of data that occurs without deleting old ledgers. For more information on disk space needs, see [Capacity Planning](capacity-planning.html).
|
||||
|
||||
|
||||
## Background
|
||||
|
||||
The `rippled` server stores [ledger history](ledger-history.html) in its _ledger store_. This data accumulates over time.
|
||||
|
||||
Inside the ledger store, ledger data is "de-duplicated". In other words, data that doesn't change from version to version is only stored once. The records themselves in the ledger store do not indicate which ledger version(s) contain them; part of the work of online deletion is identifying which records are only used by outdated ledger versions. This process is time consuming and affects the disk I/O and application cache, so it is not feasible to delete old data on every ledger close.
|
||||
|
||||
|
||||
## Online Deletion Behavior
|
||||
|
||||
The online deletion settings configure how many ledger versions the `rippled` server should keep available in the ledger store at a time. However, the specified number is a guideline, not a hard rule:
|
||||
|
||||
- The server never deletes data more recent than the configured number of ledger versions, but it may have less than that amount available if it has not been running for long enough or if it lost sync with the network at any time. (The server attempts to backfill at least some history; see [fetching history](ledger-history.html#fetching-history) for details.)
|
||||
- The server may store up to just over twice the configured number of ledger versions if online deletion is set to run automatically. (Each time it runs, it reduces the number of stored ledger versions to approximately the configured number.)
|
||||
|
||||
If online deletion is delayed because the server is busy, ledger versions can continue to accumulate. When functioning normally, online deletion begins when the server has twice the configured number of ledger versions, but it may not complete until after several more ledger versions have accumulated.
|
||||
|
||||
- If advisory deletion is enabled, the server stores all the ledger versions that it has acquired and built until its administrator calls the [can_delete method][].
|
||||
|
||||
The amount of data the server stores depends on how often you call [can_delete][can_delete method] and how big an interval of time your `online_delete` setting represents:
|
||||
|
||||
- If you call `can_delete` _more often_ than your `online_delete` interval, the server stores at most a number of ledger versions approximately equal to **twice the `online_delete` value**. (After deletion, this is reduced to approximately the `online_delete` value.)
|
||||
|
||||
For example, if you call `can_delete` with a value of `now` once per day and an `online_delete` value of 50,000, the server typically stores up to 100,000 ledger versions before running deletion. After running deletion, the server keeps at least 50,000 ledger versions (about two days' worth). With this configuration, approximately every other `can_delete` call results in no change because the server does not have enough ledger versions to delete.
|
||||
|
||||
- If you call `can_delete` _less often_ than your `online_delete` interval, the server stores at most ledger versions spanning an amount of time that is approximately **twice the interval between `can_delete` calls**. (After deletion, this is reduced to approximately one interval's worth of data.)
|
||||
|
||||
For example, if you call `can_delete` with a value of `now` once per day and an `online_delete` value of 2000, the server typically stores up to two full days' worth of ledger versions before running deletion. After running deletion, the server keeps approximately one day's worth (about 25,000 ledger versions), but never fewer than 2000 ledger versions.
|
||||
|
||||
|
||||
With online deletion enabled and running automatically (that is, with advisory delete disabled), the total amount of ledger data stored should remain at minimum equal to the number of ledger versions the server is configured to keep, with the maximum being roughly twice that many.
|
||||
|
||||
When online deletion runs, it does not reduce the size of SQLite database files on disk; it only makes space within those files available to be reused for new data. Online deletion _does_ reduce the size of RocksDB or NuDB database files containing the ledger store.
|
||||
|
||||
The server only counts validated ledger versions when deciding how far back it can delete. In exceptional circumstances where the server is unable to validate new ledger versions (either because of an outage in its local network connection or because the global XRP Ledger network is unable to reach a consensus) `rippled` continues to close ledgers so that it can recover quickly when the network is restored. In this case, the server may accumulate many closed but not validated ledger versions. These unvalidated ledgers do not affect how many _validated_ ledger versions the server keeps before running online deletion.
|
||||
|
||||
### Interrupting Online Deletion
|
||||
|
||||
Online deletion automatically stops if the [server state](rippled-server-states.html) becomes less than `full`. If this happens, the server writes a log message with the prefix `SHAMapStore::WRN`. The server attempts to start online deletion again after the next validated ledger version after becoming fully synced.
|
||||
|
||||
If you stop the server or it crashes while online deletion is running, online deletion resumes after the server is restarted and the server becomes fully synced.
|
||||
|
||||
To temporarily disable online deletion, you can use the [can_delete method][] with an argument of `never`. This change persists until you re-enable online deletion by calling [can_delete][can_delete method] again. For more information on controlling when online deletion happens, see [Advisory Deletion](#advisory-deletion).
|
||||
|
||||
|
||||
## Configuration
|
||||
|
||||
The following settings relate to online deletion:
|
||||
|
||||
- **`online_delete`** - Specify a number of validated ledger versions to keep. The server periodically deletes any ledger versions that are older than this number. If not specified, no ledgers are deleted.
|
||||
|
||||
The default config file specifies 2000 for this value. This cannot be less than 256, because some events like [Fee Voting](fee-voting.html) and the [Amendment Process](amendments.html#amendment-process) update only every 256 ledgers.
|
||||
|
||||
**Caution:** If you run `rippled` with `online_delete` disabled, then later enable `online_delete` and restart the server, the server disregards but does not delete existing ledger history that your server already downloaded while `online_delete` was disabled. To save disk space, delete your existing history before re-starting the server after changing the `online_delete` setting.
|
||||
|
||||
- **`[ledger_history]`** - Specify a number of validated ledgers, equal to or less than `online_delete`. If the server does not have at least this many validated ledger versions, it attempts to backfill them by fetching the data from peers.
|
||||
|
||||
The default for this setting is 256 ledgers.
|
||||
|
||||
The following diagram shows the relationship between `online_delete` and `ledger_history` settings:
|
||||
|
||||

|
||||
|
||||
- **`advisory_delete`** - If enabled, online deletion is not scheduled automatically. Instead, an administrator must manually trigger online deletion. Use the value `0` for disabled or `1` for enabled.
|
||||
|
||||
This setting is disabled by default.
|
||||
|
||||
- **`[fetch_depth]`** - Specify a number of ledger versions. The server does not accept fetch requests from peers for historical data that is older than the specified number of ledger versions. Specify the value `full` to serve any available data to peers.
|
||||
|
||||
The default for `fetch_depth` is `full` (serve all available data).
|
||||
|
||||
The `fetch_depth` setting cannot be higher than `online_delete` if both are specified. If `fetch_depth` is set higher, the server treats it as equal to `online_delete` instead.
|
||||
|
||||
The following diagram shows how fetch_depth works:
|
||||
|
||||

|
||||
|
||||
For estimates of how much disk space is required to store different amounts of history, see [Capacity Planning](capacity-planning.html#disk-space).
|
||||
|
||||
### Advisory Deletion
|
||||
|
||||
The default config file schedules online deletion to happen automatically and periodically. If the config file does not specify an `online_delete` interval, online deletion does not occur. If config file enables the `advisory_delete` setting, online deletion only happens when an administrator triggers it using the [can_delete method][].
|
||||
|
||||
You can use advisory deletion with a scheduled job to trigger automatic deletion based on clock time instead of the number of ledger versions closed. If your server is heavily used, the extra load from online deletion can cause your server to fall behind and temporarily de-sync from the consensus network. If this is the case, you can use advisory deletion and schedule online deletion to happen only during off-peak times.
|
||||
|
||||
You can use advisory deletion for other reasons. For example, you may want to manually confirm that transaction data is backed up to a separate server before deleting it. Alternatively, you may want to manually confirm that a separate task has finished processing transaction data before you delete that data.
|
||||
|
||||
The `can_delete` API method can enable or disable automatic deletion, in general or up to a specific ledger version, as long as `advisory_delete` is enabled in the config file. These settings changes persist even if you restart the `rippled` server, unless you disable `advisory_delete` in the config file before restarting.
|
||||
|
||||
|
||||
## How It Works
|
||||
|
||||
Online deletion works by creating two databases: at any given time, there is an "old" database, which is read-only, and a "current" database, which is writable. The `rippled` server can read objects from either database, so current ledger versions may contain objects in either one. If an object in a ledger does not change from ledger version to ledger version, only one copy of that object remains in the database, so the server does not store redundant copies of that object. When a new ledger version modifies an object, the server stores the modified object in the "new" database, while the previous version of the object (which is still used by previous ledger versions) remains in the "old" database.
|
||||
|
||||
When it comes time for online deletion, the server first walks through the oldest ledger version to keep, and copies all objects in that ledger version from the read-only "old" database into the "current" database. This guarantees that the "current" database now contains all objects used in the chosen ledger version and all newer versions. Then, the server deletes the "old" database, and changes the existing "current" database to become "old" and read-only. The server starts a new "current" database to contain any newer changes after this point.
|
||||
|
||||

|
||||
|
||||
## See Also
|
||||
|
||||
- [Capacity Planning](capacity-planning.html)
|
||||
- [can_delete method][] - API reference documentation
|
||||
- [Configure Online Deletion](configure-online-deletion.html)
|
||||
- [Configure Advisory Deletion](configure-advisory-deletion.html)
|
||||
- [Configure Full History](configure-full-history.html)
|
||||
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
@@ -1,7 +1,7 @@
|
||||
# can_delete
|
||||
[[Source]<br>](https://github.com/ripple/rippled/blob/master/src/ripple/rpc/handlers/CanDelete.cpp "Source")
|
||||
|
||||
With `online_delete` and `advisory_delete` configuration options enabled, the `can_delete` method informs the rippled server of the latest ledger which may be deleted.
|
||||
The `can_delete` method informs the `rippled` server of the latest ledger version which may be deleted when using [online deletion with advisory deletion enabled](online-deletion.html#advisory-deletion). If advisory deletion is not enabled, this method does nothing.
|
||||
|
||||
_The `can_delete` method is an [admin method](admin-rippled-methods.html) that cannot be run by unprivileged users._
|
||||
|
||||
@@ -43,16 +43,15 @@ rippled can_delete 11320417
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
The request includes the following optional parameter:
|
||||
The request accepts the following parameter:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-------------|:------------------|:------------------------------------------|
|
||||
| `can_delete` | String or Integer | The maximum ledger to allow to be deleted. For `ledger_index` or `ledger_hash`, see [Specifying Ledgers][]. `never` sets the value to 0, and effectively disables online deletion until another `can_delete` is appropriately called. `always` sets the value to the maximum possible ledger (4294967295), and online deletion occurs as of each configured `online_delete` interval. `now` triggers online deletion at the next validated ledger that meets or exceeds the configured `online_delete` interval, but no further. |
|
||||
| `can_delete` | String or Integer | _(Optional)_ The [Ledger Index][] of the maximum ledger version to allow to be deleted. The special case `never` disables online deletion. The special case `always` enables automatic online deletion as if advisory deletion was disabled. The special case `now` allows online deletion one time at the next validated ledger that meets or exceeds the configured `online_delete` value. If omitted, the server makes no changes (but still replies with the current `can_delete` value). |
|
||||
|
||||
If no parameter is specified, no change is made.
|
||||
### Response Format
|
||||
|
||||
The response follows the [standard format][], with
|
||||
a successful result containing the following fields:
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:-------------|:--------|:----------------------------------------------------|
|
||||
@@ -62,11 +61,16 @@ Use this command with no parameter to query the existing `can_delete` setting.
|
||||
|
||||
### Possible Errors
|
||||
|
||||
* Any of the [universal error types][].
|
||||
* `notEnabled` - Not enabled in configuration.
|
||||
* `notReady` - Not ready to handle this request.
|
||||
* `lgrNotFound` - Ledger not found.
|
||||
* `invalidParams` - Invalid parameters.
|
||||
- Any of the [universal error types][].
|
||||
- `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
- `lgrNotFound` - The ledger specified by the `can_delete` field of the request does not exist, or it does exist but the server does not have it.
|
||||
- `notEnabled` - If either online deletion or advisory deletion are not enabled in the server's configuration.
|
||||
- `notReady` - The server is not ready to run online deletion at the moment. This usually means the server has just started up and has not yet acquired a validated ledger.
|
||||
|
||||
## See Also
|
||||
|
||||
- [Online Deletion](online-deletion.html)
|
||||
- [Configure Advisory Deletion](configure-advisory-deletion.html)
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
|
||||
@@ -283,7 +283,7 @@ The `info` object may have some arrangement of the following fields:
|
||||
| `amendment_blocked` | Boolean | _(May be omitted)_ If `true`, this server is [amendment blocked](amendments.html#amendment-blocked). If the server is not amendment blocked, the response omits this field. [New in: rippled 0.80.0][] |
|
||||
| `build_version` | String | The version number of the running `rippled` version. |
|
||||
| `closed_ledger` | Object | (May be omitted) Information on the most recently closed ledger that has not been validated by consensus. If the most recently validated ledger is available, the response omits this field and includes `validated_ledger` instead. The member fields are the same as the `validated_ledger` field. |
|
||||
| `complete_ledgers` | String | Range expression indicating the sequence numbers of the ledger versions the local rippled has in its database. This may be a disjoint sequence, for example `24900901-24900984,24901116-24901158`. |
|
||||
| `complete_ledgers` | String | Range expression indicating the sequence numbers of the ledger versions the local `rippled` has in its database. This may be a disjoint sequence, for example `24900901-24900984,24901116-24901158`. If the server does not have any complete ledgers (for example, it just started syncing with the network), this is the string `empty`. |
|
||||
| `hostid` | String | On an admin request, returns the hostname of the server running the `rippled` instance; otherwise, returns a unique four letter word. |
|
||||
| `io_latency_ms` | Number | Amount of time spent waiting for I/O operations, in milliseconds. If this number is not very, very low, then the `rippled` server is probably having serious load issues. |
|
||||
| `last_close` | Object | Information about the last time the server closed a ledger, including the amount of time it took to reach a consensus and the number of trusted validators participating. |
|
||||
|
||||
@@ -252,7 +252,7 @@ The `state` object may have some arrangement of the following fields:
|
||||
|:---------------------------------|:-----------------|:-----------------------|
|
||||
| `amendment_blocked` | Boolean | _(May be omitted)_ If `true`, this server is [amendment blocked](amendments.html#amendment-blocked). If the server is not amendment blocked, the response omits this field. [New in: rippled 0.80.0][] |
|
||||
| `build_version` | String | The version number of the running `rippled` version. |
|
||||
| `complete_ledgers` | String | Range expression indicating the sequence numbers of the ledger versions the local `rippled` has in its database. It is possible to be a disjoint sequence, e.g. "2500-5000,32570-7695432". |
|
||||
| `complete_ledgers` | String | Range expression indicating the sequence numbers of the ledger versions the local `rippled` has in its database. It is possible to be a disjoint sequence, e.g. "2500-5000,32570-7695432". If the server does not have any complete ledgers (for example, it just started syncing with the network), this is the string `empty`. |
|
||||
| `closed_ledger` | Object | (May be omitted) Information on the most recently closed ledger that has not been validated by consensus. If the most recently validated ledger is available, the response omits this field and includes `validated_ledger` instead. The member fields are the same as the `validated_ledger` field. |
|
||||
| `io_latency_ms` | Number | Amount of time spent waiting for I/O operations, in milliseconds. If this number is not very, very low, then the `rippled` server is probably having serious load issues. |
|
||||
| `load` | Object | _(Admin only)_ Detailed information about the current load state of the server |
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
# Configure Advisory Deletion
|
||||
|
||||
The default config file sets `rippled` to automatically delete outdated history of XRP Ledger state and transactions as new ledger versions become available. If your server uses most of its hardware resources during peak hours, you can configure the server to delete ledgers only when prompted by a command scheduled to run during off-peak hours, so that online deletion is less likely to impact server performance.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
This tutorial assumes your server meets the following prerequisites:
|
||||
|
||||
- You are on a supported operating system: Ubuntu Linux, Red Hat Enterprise Linux (RHEL), or CentOS.
|
||||
|
||||
- The `rippled` server is already [installed](install-rippled.html) and [online deletion](online-deletion.html) is enabled.
|
||||
|
||||
The default configuration file enables online deletion after 2000 ledger versions.
|
||||
|
||||
- A `cron` daemon is installed and running.
|
||||
|
||||
Ubuntu Linux runs a `cron` daemon by default.
|
||||
|
||||
On RHEL or CentOS, you can install the `cronie` package:
|
||||
|
||||
$ sudo yum install cronie
|
||||
|
||||
- Your server has enough disk space to store your chosen amount of history in its ledger store.
|
||||
|
||||
See [Capacity Planning](capacity-planning.html) for details of how much storage is required for different configurations. With advisory deletion enabled, the maximum history a server may accumulate before deletion is equal to the number of ledger versions configured in the `online_delete` setting **plus** the amount of time between online deletion prompts.
|
||||
|
||||
- You know which hours are least busy for your server.
|
||||
|
||||
## Configuration Steps
|
||||
|
||||
To configure advisory deletion with a daily schedule, perform the following steps:
|
||||
|
||||
1. Enable `advisory_delete` in the `[node_db]` stanza of your `rippled`'s config file.
|
||||
|
||||
[node_db]
|
||||
# Other settings unchanged ...
|
||||
online_delete=2000
|
||||
advisory_delete=1
|
||||
|
||||
- Set `advisory_delete` to `1` to run online deletion only when prompted. (Set it to `0` to run online deletion automatically as new ledger versions become available.)
|
||||
- Set `online_delete` to the minimum number of ledger versions to keep after running online deletion. The server accumulates more history than this until online deletion runs.
|
||||
|
||||
{% include '_snippets/conf-file-location.md' %}<!--_ -->
|
||||
|
||||
2. Test running the [can_delete method][] to prompt the server to run online deletion.
|
||||
|
||||
You can use the [`rippled` commandline interface](get-started-with-the-rippled-api.html#commandline) to run this command. For example:
|
||||
|
||||
$ rippled --conf=/etc/opt/ripple/rippled.cfg can_delete now
|
||||
|
||||
The response indicates the maximum ledger index that the server may delete from its ledger store. For example, the following message indicates that ledger versions up to and including ledger index 43633667 can be deleted:
|
||||
|
||||
{
|
||||
"result": {
|
||||
"can_delete": 43633667,
|
||||
"status": "success"
|
||||
}
|
||||
}
|
||||
|
||||
The server only deletes those ledger versions if the number of _newer_ validated ledger versions it has is equal to or greater than the `online_delete` setting.
|
||||
|
||||
3. Configure your `cron` daemon to run the `can_delete` method you tested in the previous step at a scheduled time.
|
||||
|
||||
Edit your `cron` configuration:
|
||||
|
||||
$ crontab -e
|
||||
|
||||
The following example sets the server to run deletion at 1:05 AM server time daily:
|
||||
|
||||
5 1 * * * rippled --conf /etc/opt/ripple/rippled.cfg can_delete now
|
||||
|
||||
Be sure that you schedule the command to run based on your server's configured time zone.
|
||||
|
||||
**Tip:** You do not need to schedule a `cron` job to run online deletion if you have `advisory_delete` disabled. In that case, `rippled` runs online deletion automatically when the difference between the server's oldest and current validated ledger versions is at least the value of `online_delete`.
|
||||
|
||||
4. Start (or restart) the `rippled` service.
|
||||
|
||||
$ sudo systemctl restart rippled
|
||||
|
||||
5. Periodically check your server's `complete_ledgers` range using the [server_info method][] to confirm that ledgers are being deleted as scheduled.
|
||||
|
||||
The lowest ledger index in `complete_ledgers` should increase after online deletion.
|
||||
|
||||
Deletion may take several minutes to complete when it runs, depending on how busy your server is and how much history you delete at a time.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If online deletion does not seem to be running after configuring it, try the following:
|
||||
|
||||
- Check that the user who configured the `cron` job has permissions to run the `rippled` server as a commandline client.
|
||||
- Check the syntax of your cron job and the time when it is supposed to run.
|
||||
- Check that the `rippled` executable is available at the path specified in your `cron` configuration. If necessary, specify the absolute path to the executable, such as `/opt/ripple/bin/rippled`.
|
||||
- Check your `rippled` logs for messages that begin with `SHAMapStore::WRN`. This can indicate that [online deletion is being interrupted](online-deletion.html#interrupting-online-deletion) because your server fell out of sync with the network.
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
@@ -0,0 +1,92 @@
|
||||
# Configure Full History
|
||||
|
||||
In its default configuration, the `rippled` server automatically deletes outdated history of XRP Ledger state and transactions as new ledger versions become available. This is sufficient for most servers, which do not need older history to know the current state and process transactions. However, it can be useful for the network if some servers provide as much history of the XRP Ledger as possible.
|
||||
|
||||
## Warnings
|
||||
|
||||
Storing full history is expensive. As of 2018-12-11, the full history of the XRP Ledger occupies approximately **9 terabytes** of disk space, which must be entirely stored on fast solid state disk drives for proper server performance. Such a large amount of solid state storage is not cheap, and the total amount of history you must store increases by approximately 12 GB per day.
|
||||
|
||||
Acquiring full history from the peer-to-peer network takes a long time (several months) and requires that your server has sufficient system and network resources to acquire older history while keeping up with new ledger progress. To get a faster start on acquiring ledger history, you may want to find another server operator who has a large amount of history already downloaded, who can give you a database dump or at least allow your server to explicitly peer with theirs for a long time to acquire history. The server can load ledger history from a file and verify the integrity of the historical ledgers it imports.
|
||||
|
||||
You do not need a full history server to participate in the network, validate transactions, or know the current state of the network. Full history is only useful for knowing the outcome of transactions that occurred in the past, or the state of the ledger at a given time in the past. To get such information, you must rely on other servers having the history you need.
|
||||
|
||||
If you want to contribute to storing the history of the XRP Ledger network without storing the full history, you can [configure history sharding](configure-history-sharding.html) to store randomly-selected chunks of ledger history instead.
|
||||
|
||||
## Configuration Steps
|
||||
|
||||
To configure your server to acquire and store full history, complete the following steps:
|
||||
|
||||
1. Stop the `rippled` server if it is running.
|
||||
|
||||
$ sudo systemctl stop rippled
|
||||
|
||||
0. Remove (or comment out) the `online_delete` and `advisory_delete` settings from the `[node_db]` stanza of your server's config file, and change the type to `NuDB` if you haven't already:
|
||||
|
||||
[node_db]
|
||||
type=NuDB
|
||||
path=/var/lib/rippled/db/nudb
|
||||
#online_delete=2000
|
||||
#advisory_delete=0
|
||||
|
||||
On a full-history server, you should use NuDB for the ledger store, because RocksDB requires too much RAM when the database is that large. For more information, see [Capacity Planning](capacity-planning.html). You can remove the following performance-related configuration options from the default `[node_db]` stanza, because they only apply to RocksDB: `open_files`, `filter_bits`, `cache_mb`, `file_size_mb`, and `file_size_mult.`
|
||||
|
||||
**Caution:** If you have any history already downloaded with RocksDB, you must either delete that data or change the paths to the databases in the config file when you switch to NuDB. You must change both the `path` field of the `[node_db]` stanza **and** the `[database_path]` (SQLite database) setting. Otherwise, the server may [fail to start](server-wont-start.html#state-db-error).
|
||||
|
||||
{% include '_snippets/conf-file-location.md' %}<!--_ -->
|
||||
|
||||
0. Set the `[ledger_history]` stanza of your server's config file to `full`:
|
||||
|
||||
[ledger_history]
|
||||
full
|
||||
|
||||
0. Set the `[ips_fixed]` stanza of your server's config file to explicitly peer with at least one server that has full history available.
|
||||
|
||||
[ips_fixed]
|
||||
169.55.164.20
|
||||
50.22.123.215
|
||||
|
||||
Your server can only download historical data from the peer-to-peer network if one its direct peers has the data available. The easiest way to ensure you can download full history is to peer with a server that already has full history.
|
||||
|
||||
**Tip:** Ripple makes a pool of full history servers publicly available. You can resolve the domain `s2.ripple.com` a few times to get the IP addresses of these servers. Ripple offers these servers as a public service, so be aware that their availability to peer with other servers is limited and you may be blocked if you abuse them.
|
||||
|
||||
0. If you have a database dump from another full-history server to use as a basis, set the `[import_db]` stanza of your server's config file to point to the data to be imported. (Otherwise, skip this step.)
|
||||
|
||||
[import_db]
|
||||
type=NuDB
|
||||
path=/tmp/full_history_dump/
|
||||
|
||||
0. Remove your server's existing database files, if you have any from previously running `rippled`.
|
||||
|
||||
After disabling online deletion, the server ignores any data that was downloaded while online deletion was enabled, so you may as well clear up the disk space. For example:
|
||||
|
||||
rm -r /var/lib/rippled/db/*
|
||||
|
||||
**Warning:** Be sure that you have not put any files you want to keep in the folder before you delete it. It is generally safe to delete all of a `rippled` server's database files, but you should only do this if the configured database folder is not used for anything other than `rippled`'s databases.
|
||||
|
||||
0. Start the `rippled` server, importing the database dump if you have one available:
|
||||
|
||||
If you have a database dump to load configured in `[import_db]`, start the server explicitly and include the `--import` [commandline option](commandline-usage.html#daemon-mode-options):
|
||||
|
||||
$ /opt/ripple/bin/rippled --conf /etc/opt/ripple/rippled.cfg --import
|
||||
|
||||
Importing a large database dump may take several minutes or even hours. During this time, the server is not fully started and synced with the network. Watch the server logs to see the status of the import.
|
||||
|
||||
If you are not importing a database dump, start the server normally:
|
||||
|
||||
$ sudo systemctl start rippled
|
||||
|
||||
0. If you added an `[import_db]` stanza to your server's config file, remove it after the import completes.
|
||||
|
||||
Otherwise, your server may try to import the same data again the next time it is restarted.
|
||||
|
||||
0. Monitor your server's available history with the [server_info method][].
|
||||
|
||||
The range of available ledgers reported in the `complete_ledgers` field should increase over time.
|
||||
|
||||
The earliest available ledger version in the production XRP Ledger's history is ledger index **32570**. The first two weeks or so of ledger history was lost due to a bug in the server at the time. Test nets and other chains generally have history going back to ledger index **1**.
|
||||
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
@@ -0,0 +1,75 @@
|
||||
# Configure Online Deletion
|
||||
|
||||
In its default configuration, the `rippled` server [deletes history](online-deletion.html) older than the most recent 2000 ledger versions, keeping approximately 15 minutes of ledger history (based on the current rate between ledgers). This page describes how to configure the amount of history your `rippled` server stores before deleting.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
This tutorial assumes your server meets the following prerequisites:
|
||||
|
||||
- You are on a supported operating system: Ubuntu Linux, Red Hat Enterprise Linux (RHEL), or CentOS.
|
||||
|
||||
- The `rippled` server is already [installed](install-rippled.html) and [online deletion](online-deletion.html) is enabled.
|
||||
|
||||
If you followed the installation instructions for a recommended platform, online deletion is enabled by default.
|
||||
|
||||
- Your server has [enough disk space](capacity-planning.html) to store your chosen amount of history in its ledger store.
|
||||
|
||||
|
||||
## Configuration Steps
|
||||
|
||||
To change the amount of history your server stores, perform the following steps:
|
||||
|
||||
1. Decide how many ledger versions' worth of history to store.
|
||||
|
||||
New ledger versions are usually validated 3 to 4 seconds apart, so the number of ledger versions corresponds roughly to the amount of time you want to store. See [Capacity Planning](capacity-planning.html) for details of how much storage is required for different configurations.
|
||||
|
||||
Online deletion is based on how many ledger versions to keep _after_ deleting history, so you should have enough disk space to store twice as many ledgers as you set it to keep.
|
||||
|
||||
0. In your `rippled`'s config file, edit the `online_delete` field of the `[node_db]` stanza.
|
||||
|
||||
[node_db]
|
||||
# Other settings unchanged ...
|
||||
online_delete=2000
|
||||
advisory_delete=0
|
||||
|
||||
Set `online_delete` to the minimum number of ledger versions to keep after running online deletion. With automatic deletion (the default), the server typically runs deletion when it has accumulated about twice this many ledger versions.
|
||||
|
||||
{% include '_snippets/conf-file-location.md' %}<!--_ -->
|
||||
|
||||
0. Start (or restart) the `rippled` service.
|
||||
|
||||
$ sudo systemctl restart rippled
|
||||
|
||||
0. Wait for your server to sync to the network.
|
||||
|
||||
Depending on your network and system capabilities and how long your server was offline, it may take between 5 and 15 minutes to fully sync.
|
||||
|
||||
When your server is synced with the network, the [server_info method][] reports a `server_state` value of `"full"`, `"proposing"`, or `"validating"`.
|
||||
|
||||
0. Periodically check your server's `complete_ledgers` range using the [server_info method][] to confirm that ledgers are being deleted.
|
||||
|
||||
After online deletion runs, the `complete_ledgers` range reflects that older ledgers are no longer available. As your server accumulates history, the total number of ledgers available should slowly increase to twice the `online_delete` value you configured, then decrease when online deletion runs.
|
||||
|
||||
0. Monitor your `rippled` logs for messages that begin with `SHAMapStore::WRN`. This can indicate that [online deletion is being interrupted](online-deletion.html#interrupting-online-deletion) because your server fell out of sync with the network.
|
||||
|
||||
If this happens regularly, your server may not have sufficient specifications to keep up with the ledger while running online deletion. Check that other services on the same hardware (such as scheduled backups or security scans) aren't competing with the `rippled` server for resources. You may want to try any of the following:
|
||||
|
||||
- Increase your system specs. See [System Requirements](system-requirements.html) for recommendations.
|
||||
- Change your configuration to store less history. (Step 2 of this tutorial)
|
||||
- Change your server's [`node_size` parameter](capacity-planning.html).
|
||||
- Use [NuDB instead of RocksDB](capacity-planning.html) for the ledger store.
|
||||
- [Schedule online deletion using Advisory Deletion](configure-advisory-deletion.html).
|
||||
|
||||
|
||||
## See Also
|
||||
|
||||
- [Online Deletion](online-deletion.html)
|
||||
- [Configure Advisory Deletion](configure-advisory-deletion.html)
|
||||
- [Configure History Sharding](configure-history-sharding.html)
|
||||
- [Configure Full History](configure-full-history.html)
|
||||
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
@@ -53,48 +53,52 @@ The example `rippled-example.cfg` file has the `type` field in the `[node_db]` s
|
||||
|
||||
#### More About Using RocksDB
|
||||
|
||||
[RocksDB](https://rocksdb.org/docs/getting-started.html) is an embeddable persistent key-value store that is optimized for rotational disks.
|
||||
[RocksDB](https://rocksdb.org/docs/getting-started.html) is an embeddable persistent key-value store.
|
||||
|
||||
RocksDB requires approximately one-third less disk [storage](#storage) than NuDB and provides better I/O latency. However, the better I/O latency comes as result of the large amount of RAM RocksDB requires to store data indexes.
|
||||
RocksDB works well on solid-state disks. RocksDB performs better than NuDB when used with rotational disks, but you may still encounter performance problems unless you use solid-state disks.
|
||||
|
||||
Validators should be configured to use RocksDB and to store no more than about 300,000 ledgers (approximately two weeks' worth of [historical data](#historical-data)) in the ledger store.
|
||||
RocksDB requires approximately one-third less [disk storage](#disk-space) than NuDB and provides better I/O latency. However, the better I/O latency comes as result of the large amount of RAM RocksDB requires to store data indexes.
|
||||
|
||||
Validators should be configured to use RocksDB and to store no more than about 300,000 ledgers (approximately two weeks' worth of [historical data](#disk-space)) in the ledger store.
|
||||
|
||||
RocksDB has performance-related configuration options that you can set in `rippled.cfg` to achieve maximum transaction processing throughput. Here is the recommended configuration for a `rippled` server using RocksDB:
|
||||
|
||||
```
|
||||
[node_db]
|
||||
type=RocksDB
|
||||
path={path_to_ledger_store}
|
||||
path=/var/lib/rippled/db/rocksdb
|
||||
open_files=512
|
||||
filter_bits=12
|
||||
cache_mb=512
|
||||
file_size_mb=64
|
||||
file_size_mult=2
|
||||
online_delete=2000
|
||||
advisory_delete=0
|
||||
```
|
||||
|
||||
(Adjust the `path` to the directory where you want to keep the ledger store on disk. Adjust the `online_delete` and `advisory_delete` settings as desired for your configuration.)
|
||||
|
||||
#### More About Using NuDb
|
||||
|
||||
[NuDB](https://github.com/vinniefalco/nudb#introduction) is an append-only key-value store that is optimized for SSD drives.
|
||||
|
||||
NuDB has nearly constant performance and memory footprints regardless of the amount of data being [stored](#storage). NuDB _requires_ a solid-state drive, but uses much less RAM than RocksDB to access a large database.
|
||||
NuDB has nearly constant performance and memory footprints regardless of the [amount of data being stored](#disk-space). NuDB _requires_ a solid-state drive, but uses much less RAM than RocksDB to access a large database.
|
||||
|
||||
Non-validator production servers should be configured to use NuDB and to store the amount of historical data required for the use case.
|
||||
|
||||
NuDB does not have performance-related configuration options available in `rippled.cfg`.
|
||||
NuDB does not have performance-related configuration options available in `rippled.cfg`. Here is the recommended configuration for a `rippled` server using NuDB:
|
||||
|
||||
#### History Sharding
|
||||
```
|
||||
[node_db]
|
||||
type=NuDB
|
||||
path=/var/lib/rippled/db/nudb
|
||||
online_delete=2000
|
||||
advisory_delete=0
|
||||
```
|
||||
|
||||
`rippled` offers a history sharding feature that allows you to store a randomized range of ledgers in a separate shard store. You can use the `[shard_db]` stanza to configure the shard store to use a different type of key-value store than the one you defined for the ledger store using the `[node_db]` stanza. For more information about how to use this feature, see [History Sharding](history-sharding.html).
|
||||
(Adjust the `path` to the directory where you want to keep the ledger store on disk. Adjust the `online_delete` and `advisory_delete` settings as desired for your configuration.)
|
||||
|
||||
|
||||
### Historical Data
|
||||
|
||||
The amount of historical data that a `rippled` server keeps online is a major contributor to required storage space. At the time of writing (2018-10-29), a `rippled` server stores about 12GB of data per day and requires 8.4TB to store the full history of the XRP Ledger. You can expect this amount to grow as transaction volume increases across the XRP Ledger network. You can control how much data you keep with the `online_delete` and `advisory_delete` fields.
|
||||
|
||||
Online deletion enables the purging of `rippled` ledgers from databases without any disruption of service. It removes only records that are not part of the current ledgers. Data in current ledgers means any data that's used by ledger versions that are new enough not to be deleted. Without online deletion, those databases grow without bounds. Freeing disk space requires stopping the process and manually removing database files. For more information, see [`[node_db]`: `online_delete`](https://github.com/ripple/rippled/blob/develop/cfg/rippled-example.cfg#L832).
|
||||
|
||||
<!-- {# ***TODO***: Add link to online_delete section, when complete, per https://ripplelabs.atlassian.net/browse/DOC-1313 #} -->
|
||||
|
||||
### Log Level
|
||||
|
||||
The example `rippled-example.cfg` file sets the logging verbosity to `warning` in the `[rpc_startup]` stanza. This setting greatly reduces disk space and I/O requirements over more verbose logging. However, more verbose logging provides increased visibility for troubleshooting.
|
||||
@@ -102,7 +106,6 @@ The example `rippled-example.cfg` file sets the logging verbosity to `warning` i
|
||||
**Caution:** If you omit the `log_level` command from the `[rpc_startup]` stanza, `rippled` writes logs to disk at the `debug` level and outputs `warning` level logs to the console. `debug` level logging requires several more GB of disk space per day than `warning` level, depending on transaction volumes and client activity.
|
||||
|
||||
|
||||
|
||||
## Network and Hardware
|
||||
|
||||
Each `rippled` server in the XRP Ledger network performs all of the transaction processing work of the network. Therefore, the baseline hardware for production `rippled` servers should be similar to that used in Ripple's [performance testing](https://ripple.com/dev-blog/demonstrably-scalable-blockchain/).
|
||||
@@ -116,7 +119,8 @@ For best performance in enterprise production environments, Ripple recommends ru
|
||||
|
||||
- Operating System: Ubuntu 16.04+
|
||||
- CPU: Intel Xeon 3+ GHz processor with 4 cores and hyperthreading enabled
|
||||
- Disk: SSD (7000+ writes/second, 10,000+ reads/second)
|
||||
- Disk speed: SSD (7000+ writes/second, 10,000+ reads/second)
|
||||
- Disk space: Varies. At least 50 GB recommended.
|
||||
- RAM: 32GB
|
||||
- Network: Enterprise data center network with a gigabit network interface on the host
|
||||
|
||||
@@ -124,25 +128,41 @@ For best performance in enterprise production environments, Ripple recommends ru
|
||||
|
||||
You'll get the best performance on bare metal, but virtual machines can perform nearly as well as long as the host hardware has high enough specs.
|
||||
|
||||
#### Storage
|
||||
#### Disk Speed
|
||||
|
||||
Here are some estimated `rippled` storage requirements:
|
||||
|
||||
- RocksDB stores around 8GB per day
|
||||
- NuDB stores around 12GB per day
|
||||
|
||||
The amount of data stored per day changes with activity in the network.
|
||||
|
||||
You should provision extra storage capacity to prepare for future growth. At the time of writing (2018-10-29), a `rippled` server storing the full history of the XRP Ledger required 8.4TB.
|
||||
|
||||
<!-- {# ***TODO: Update the dated storage consideration above, as needed. ***#} -->
|
||||
<!-- {# ***TODO: DOC-1331 tracks: Create historic metrics that a user can use to derive what will be required. For ex, a chart with 1TB in 2014, 3TB in 2015, 7TB in 2018 ***#} -->
|
||||
|
||||
SSD storage should support several thousand of both read and write IOPS. Ripple engineers observed the following maximum reads and writes per second:
|
||||
Ripple _strongly recommends_ using a high-grade solid state disk drive (SSD) with low-latency random reads and high throughput. Ripple engineers have observed the following maximum reads and writes per second:
|
||||
|
||||
- Over 10,000 reads per second (in heavily-used public server clusters)
|
||||
- Over 7,000 writes per second (in dedicated performance testing)
|
||||
|
||||
#### Disk Space
|
||||
|
||||
The amount of disk space `rippled` requires depend on how much [ledger history](ledger-history.html) you plan to keep available locally. A `rippled` server does not need to store more than the most recent 256 ledger versions to follow the consensus process and report the complete state of the ledger, but you can only query your server for transactions that executed in ledger versions it has stored locally.
|
||||
|
||||
You can control how much data you keep with [online deletion](online-deletion.html); the default config file has the server keep the latest 2000 ledger versions. Without online deletion, the server's disk requirements grow without bounds.
|
||||
|
||||
The following table approximates the requirements for different amounts of history, at the time of writing (2018-12-13):
|
||||
|
||||
| Real Time Amount | Number of Ledger Versions | Disk Space Required (RocksDB) | Disk Space Required (NuDB) |
|
||||
|:-----------------|:--------------------------|:------------------------------|:--|
|
||||
| 2 hours | 2,000 | 250 MB | 450 MB |
|
||||
| 1 day | 25,000 | 8 GB | 12 GB |
|
||||
| 14 days | 350,000 | 112 GB | 168 GB |
|
||||
| 30 days | 750,000 | 240 GB | 360 GB |
|
||||
| 90 days | 2,250,000 | 720 GB | 1 TB |
|
||||
| 1 year | 10,000,000 | 3 TB | 4.5 TB |
|
||||
| 2 years | 20,000,000 | 6 TB | 9 TB |
|
||||
| Full history (through 2018) | 43,000,000+ | (Not recommended) | ~9 TB |
|
||||
|
||||
These numbers are estimates. They depend on several factors, most importantly the volume of transactions in the network. As transaction volume increases, each ledger version stores more unique data. You should provision extra storage capacity to prepare for future growth.
|
||||
|
||||
The `online_delete` setting tells the server how many ledger versions to keep after deleting old history. You should plan for enough disk space to store twice that many ledger versions at maximum (right before online deletion runs).
|
||||
|
||||
For instructions on how to change the amount of history you keep, see [Configure Online Deletion](configure-online-deletion.html).
|
||||
|
||||
If you want to contribute to storing ledger history but you do not have enough disk space to store full history, you can use the [History Sharding](history-sharding.html) feature to store a randomized range of ledgers in a separate shard store. History sharding is configured in the `[shard_db]` stanza, and it can use a different type of key-value store than the one you defined for the ledger store using the `[node_db]` stanza.
|
||||
|
||||
|
||||
##### Amazon Web Services
|
||||
|
||||
Amazon Web Services (AWS) is a popular virtualized hosting environment. You can run `rippled` in AWS, but Ripple does not recommend using Elastic Block Storage (EBS). Elastic Block Storage's maximum number of IOPS (5,000) is insufficient for `rippled`'s heaviest loads, despite being very expensive.
|
||||
|
||||
@@ -107,7 +107,7 @@ Possible solutions:
|
||||
|
||||
## State DB Error
|
||||
|
||||
The following error can occur if the `rippled` server's state database is corrupted (possibly as the result of being shutdown unexpectedly):
|
||||
The following error can occur if the `rippled` server's state database is corrupted. This can occur as the result of being shutdown unexpectedly, or if you change the type of database from RocksDB to NuDB without changing the `path` and `[database_path]` settings in the config file.
|
||||
|
||||
```text
|
||||
2018-Aug-21 23:06:38.675117810 SHAMapStore:ERR state db error:
|
||||
@@ -133,6 +133,17 @@ rm -r /var/lib/rippled/db
|
||||
|
||||
**Tip:** It is generally safe to delete the `rippled` databases, because any individual server can re-download ledger history from other servers in the XRP Ledger network.
|
||||
|
||||
Alternatively, you can change the paths to the databases in the config file. For example:
|
||||
|
||||
```
|
||||
[node_db]
|
||||
type=NuDB
|
||||
path=/var/lib/rippled/custom_nudb_path
|
||||
|
||||
[database_path]
|
||||
/var/lib/rippled/custom_sqlite_db_path
|
||||
```
|
||||
|
||||
|
||||
## Online Delete is Less Than Ledger History
|
||||
|
||||
|
||||
@@ -536,11 +536,32 @@ pages:
|
||||
targets:
|
||||
- local
|
||||
|
||||
- md: concepts/the-rippled-server/history-sharding.md
|
||||
- md: concepts/the-rippled-server/ledger-history/ledger-history.md
|
||||
html: ledger-history.html
|
||||
funnel: Docs
|
||||
doc_type: Concepts
|
||||
category: The rippled Server
|
||||
subcategory: Ledger History
|
||||
blurb: rippled servers store a variable amount of transaction and state history locally.
|
||||
targets:
|
||||
- local
|
||||
|
||||
- md: concepts/the-rippled-server/ledger-history/online-deletion.md
|
||||
html: online-deletion.html
|
||||
funnel: Docs
|
||||
doc_type: Concepts
|
||||
category: The rippled Server
|
||||
subcategory: Ledger History
|
||||
blurb: Online deletion purges outdated transaction and state history.
|
||||
targets:
|
||||
- local
|
||||
|
||||
- md: concepts/the-rippled-server/ledger-history/history-sharding.md
|
||||
html: history-sharding.html
|
||||
funnel: Docs
|
||||
doc_type: Concepts
|
||||
category: The rippled Server
|
||||
subcategory: Ledger History
|
||||
blurb: History sharding divides the work of keeping historical ledger data among rippled servers.
|
||||
targets:
|
||||
- local
|
||||
@@ -1030,6 +1051,26 @@ pages:
|
||||
targets:
|
||||
- local
|
||||
|
||||
- md: tutorials/manage-the-rippled-server/configuration/configure-online-deletion.md
|
||||
html: configure-online-deletion.html
|
||||
funnel: Docs
|
||||
doc_type: Tutorials
|
||||
category: Manage the rippled Server
|
||||
subcategory: Configuration
|
||||
blurb: Configure how far back your server should store transaction history.
|
||||
targets:
|
||||
- local
|
||||
|
||||
- md: tutorials/manage-the-rippled-server/configuration/configure-advisory-deletion.md
|
||||
html: configure-advisory-deletion.html
|
||||
funnel: Docs
|
||||
doc_type: Tutorials
|
||||
category: Manage the rippled Server
|
||||
subcategory: Configuration
|
||||
blurb: Use advisory deletion to delete older ledger history on a schedule rather than as new history becomes available.
|
||||
targets:
|
||||
- local
|
||||
|
||||
- md: tutorials/manage-the-rippled-server/configuration/configure-history-sharding.md
|
||||
html: configure-history-sharding.html
|
||||
funnel: Docs
|
||||
@@ -1040,6 +1081,16 @@ pages:
|
||||
targets:
|
||||
- local
|
||||
|
||||
- md: tutorials/manage-the-rippled-server/configuration/configure-full-history.md
|
||||
html: configure-full-history.html
|
||||
funnel: Docs
|
||||
doc_type: Tutorials
|
||||
category: Manage the rippled Server
|
||||
subcategory: Configuration
|
||||
blurb: Full history servers provide a record of every transaction ever to occur in the XRP Ledger, although they are expensive to run.
|
||||
targets:
|
||||
- local
|
||||
|
||||
- md: tutorials/manage-the-rippled-server/configuration/enable-public-signing.md
|
||||
html: enable-public-signing.html
|
||||
funnel: Docs
|
||||
|
||||
BIN
img/fetch_depth.png
Normal file
BIN
img/fetch_depth.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.8 KiB |
BIN
img/online-deletion-process.png
Normal file
BIN
img/online-deletion-process.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
BIN
img/online_delete-vs-ledger_history.png
Normal file
BIN
img/online_delete-vs-ledger_history.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
Reference in New Issue
Block a user