1

The docker quickstart doesn't tell me how to disable rate limiting.

Also, the Go SDK which we are using seems to have a rate limit function as well... I'm guessing that is just enforcing the rate limit it gets from Horizon.

so presumably if I disable rate limiting in Horizon, I'm good.

Is that a startup parameter or a config file to disable rate limiting?

my local horizon is set just like the public horizon:

stk@steve-kelp:~$ curl -i "https://localhost:8000"
curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number
stk@steve-kelp:~$ curl -i "http://localhost:8000"
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, max-age=0
Content-Disposition: inline
Content-Type: application/hal+json; charset=utf-8
Vary: Origin
X-Ratelimit-Limit: 101
X-Ratelimit-Remaining: 100
X-Ratelimit-Reset: 1

1 Answer 1

2

It's either environment variables which you can read from a config file by using a start script (like this one comes along with debian/ubuntu packages) or command line params.

To disable rate limiting you have to set PER_HOUR_RATE_LIMIT=0 (config/env) or add --per-hour-rate-limit 0 (command line).

For docker a configuration file should be located in /opt/stellar/horizon/etc/horizon.env, see https://github.com/stellar/docker-stellar-core-horizon#customizing-configurations.

There is a good overview of all options in horizon help:

stellar@l:/root$ stellar-horizon help
client-facing api server for the stellar network

Usage:
  horizon [flags]
  horizon [command]

Available Commands:
  db          commands to manage horizon's postgres db
  serve       run horizon server
  version     print horizon version

Flags:
      --connection-timeout int         defines the timeout of connection after which 504 response will be sent or stream will be closed, if Horizon is behind a load balancer with idle connection timeout, this should be set to a few seconds less that idle timeout (default 55)
      --db-url string                  horizon postgres database to connect with
      --enable-asset-stats /assets     enables asset stats during the ingestion and expose /assets endpoint, Enabling it has a negative impact on CPU
      --friendbot-url string           friendbot service to redirect to
      --history-retention-count uint   the minimum number of ledgers to maintain within horizon's history tables.  0 signifies an unlimited number of ledgers will be retained
      --history-stale-threshold uint   the maximum number of ledgers the history db is allowed to be out of date from the connected stellar-core db before horizon considers history stale
      --ingest                         causes this horizon process to ingest data from stellar-core into horizon's db
      --log-file string                name of the file where logs will be saved (leave empty to send logs to stdout)
      --log-level string               minimum log severity (debug, info, warn, error) to log (default "info")
      --loggly-tag string              Tag to be added to every loggly log event (default "horizon")
      --loggly-token string            Loggly token, used to configure log forwarding to loggly
      --max-db-connections int         max db connections (per DB), may need to be increased when responses are slow but DB CPU is normal (default 20)
      --max-path-length /paths         the maximum number of assets on the path in /paths endpoint (default 4)
      --network-passphrase string      Override the network passphrase
      --per-hour-rate-limit int        max count of requests allowed in a one hour period, by remote ip address (default 3600)
      --port uint                      tcp port to listen on for http requests (default 8000)
      --rate-limit-redis-key string    redis key for storing rate limit data, useful when deploying a cluster of Horizons, ignored when redis-url is empty
      --redis-url string               redis to connect with, for rate limiting
      --sentry-dsn string              Sentry URL to which panics and errors should be reported
      --skip-cursor-update             causes the ingester to skip reporting the last imported ledger state to stellar-core
      --sse-update-frequency int       defines how often streams should check if there's a new ledger (in seconds), may need to increase in case of big number of streams (default 5)
      --stellar-core-db-url string     stellar-core postgres database to connect with
      --stellar-core-url string        stellar-core to connect with (for http commands)
      --tls-cert string                TLS certificate file to use for securing connections to horizon
      --tls-key string                 TLS private key file to use for securing connections to horizon

Use "horizon [command] --help" for more information about a command.
1
  • whoa! now that explains the rate limit problem. It is based on an hour window, not 100 per second which you get from looking at the HTTP: headers. So the HTTP response headers have TWO values for rate limiting: the number of seconds of the window and the # transaction in the window. The config is only one number and it is per hour. Huh?!? Commented Feb 23, 2019 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.