mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-21 20:25:51 +00:00
Rate limiting: copy-editing
This commit is contained in:
@@ -6,11 +6,11 @@ The `rippled` server limits the rate at which API clients can make requests on p
|
||||
|
||||
When a client is approaching the rate limit, the server adds the field `"warning": "load"` at the top level of an [API response](response-formatting.html). This warning is not added to every response, but the server may send several such warnings before it disconnects a client.
|
||||
|
||||
If a client goes past the rate limit, the server disconnects that client and does not serve further requests from the client's API address for a while. The disconnect message is different for the WebSocket and JSON-RPC APIs.
|
||||
If a client goes past the rate limit, the server disconnects that client and does not serve further requests from the client's API address for a while. The WebSocket and JSON-RPC APIs use different disconnect messages.
|
||||
|
||||
## WebSocket API Disconnect Message
|
||||
|
||||
For a WebSocket API connection, the server closes the connection and provides a close message and code with the close message. The way you access these messages depends on your WebSocket client implementation. For example, using the [Node.js ws library](https://github.com/websockets/ws), the following code prints the close reason when disconnected:
|
||||
For the WebSocket API, the server closes the connection and provides a close message and code. The way you access these messages depends on your WebSocket client implementation. For example, using the [Node.js ws library](https://github.com/websockets/ws), the following code prints the close reason when disconnected:
|
||||
|
||||
```js
|
||||
const WebSocket = require('ws')
|
||||
@@ -25,7 +25,7 @@ ws.on('close', (code,reason) => {
|
||||
// reason: threshold exceeded
|
||||
```
|
||||
|
||||
If the connection is closed because of rate limiting, the close code is `1008` and the reason is the string `threshold exceeded`.
|
||||
If the connection is closed because of rate limiting, the close code is `1008` and the close message is the string `threshold exceeded`.
|
||||
|
||||
## JSON-RPC Rate Limited Error
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ Losing connections from time to time is normal for any peer-to-peer network. **O
|
||||
A large number of these messages around the same time may indicate a problem, such as:
|
||||
|
||||
- Your internet connection to one or more specific peers was cut off.
|
||||
- Your server may have been overloading the peer with requests, causing it to drop your server.
|
||||
- Your server may have been overloading the peer with requests, causing the peer to disconnect your server.
|
||||
|
||||
|
||||
## Consumer entry dropped with balance at or above drop threshold
|
||||
@@ -66,9 +66,9 @@ The following log message indicates that a client to the server's public API has
|
||||
2020-Feb-24 23:05:35.566312806 Resource:WRN Consumer entry 169.55.164.21 dropped with balance 15970 at or above drop threshold 15000
|
||||
```
|
||||
|
||||
The entry contains the IP address of the client that exceeded its rate limit, and the client's "balance", which is a score estimating the rate at which the client has been using the API. The threshold for dropping a client [hardcoded to a score of 15000](https://github.com/ripple/rippled/blob/06c371544acc3b488b9d9c057cee4e51f6bef7a2/src/ripple/resource/impl/Tuning.h#L34-L35).
|
||||
The entry contains the IP address of the client that exceeded its rate limit, and the client's "balance", which is a score estimating the rate at which the client has been using the API. The threshold for dropping a client is [hardcoded to a score of 15000](https://github.com/ripple/rippled/blob/06c371544acc3b488b9d9c057cee4e51f6bef7a2/src/ripple/resource/impl/Tuning.h#L34-L35).
|
||||
|
||||
If you see frequent messages from the same IP address, you may want to block those IP addresses from your network to reduce the load on your server's public API. (For example, you may be able configure your firewall to block those IP addresses.)
|
||||
If you see frequent messages from the same IP address, you may want to block those IP addresses from your network to reduce the load on your server's public API. (For example, you may be able to configure your firewall to block those IP addresses.)
|
||||
|
||||
To avoid being dropped by rate limiting on your own server, [connect as an admin](get-started-with-the-rippled-api.html#admin-access).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user