You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

203 lines
7.1 KiB

  1. Running in production
  2. =====================
  3. Logging
  4. -------
  5. Default logging level (``main:info,state:info,*:``) should suffice for normal
  6. operation mode. Read `this post
  7. <https://blog.cosmos.network/one-of-the-exciting-new-features-in-0-10-0-release-is-smart-log-level-flag-e2506b4ab756>`__
  8. for details on how to configure ``log_level`` config variable. Some of the
  9. modules can be found `here <./how-to-read-logs.html#list-of-modules>`__. If
  10. you're trying to debug Tendermint or asked to provide logs with debug logging
  11. level, you can do so by running tendermint with ``--log_level="*:debug"``.
  12. DOS Exposure and Mitigation
  13. ---------------------------
  14. Validators are supposed to setup `Sentry Node Architecture
  15. <https://blog.cosmos.network/tendermint-explained-bringing-bft-based-pos-to-the-public-blockchain-domain-f22e274a0fdb>`__
  16. to prevent Denial-of-service attacks. You can read more about it `here
  17. <https://github.com/tendermint/aib-data/blob/develop/medium/TendermintBFT.md>`__.
  18. P2P
  19. ~~~
  20. The core of the Tendermint peer-to-peer system is ``MConnection``. Each
  21. connection has ``MaxPacketMsgPayloadSize``, which is the maximum packet size
  22. and bounded send & receive queues. One can impose restrictions on send &
  23. receive rate per connection (``SendRate``, ``RecvRate``).
  24. RPC
  25. ~~~
  26. Endpoints returning multiple entries are limited by default to return 30
  27. elements (100 max).
  28. Rate-limiting and authentication are another key aspects to help protect
  29. against DOS attacks. While in the future we may implement these features, for
  30. now, validators are supposed to use external tools like `NGINX
  31. <https://www.nginx.com/blog/rate-limiting-nginx/>`__ or `traefik
  32. <https://docs.traefik.io/configuration/commons/#rate-limiting>`__ to achieve
  33. the same things.
  34. Debugging Tendermint
  35. --------------------
  36. If you ever have to debug Tendermint, the first thing you should probably do is
  37. to check out the logs. See `"How to read logs" <./how-to-read-logs.html>`__,
  38. where we explain what certain log statements mean.
  39. If, after skimming through the logs, things are not clear still, the second
  40. TODO is to query the `/status` RPC endpoint. It provides the necessary info:
  41. whenever the node is syncing or not, what height it is on, etc.
  42. ```
  43. $ curl http(s)://{ip}:{rpcPort}/status
  44. ```
  45. `/dump_consensus_state` will give you a detailed overview of the consensus
  46. state (proposer, lastest validators, peers states). From it, you should be able
  47. to figure out why, for example, the network had halted.
  48. ```
  49. $ curl http(s)://{ip}:{rpcPort}/dump_consensus_state
  50. ```
  51. There is a reduced version of this endpoint - `/consensus_state`, which
  52. returns just the votes seen at the current height.
  53. - `Github Issues <https://github.com/tendermint/tendermint/issues>`__
  54. - `StackOverflow questions <https://stackoverflow.com/questions/tagged/tendermint>`__
  55. Monitoring Tendermint
  56. ---------------------
  57. Each Tendermint instance has a standard `/health` RPC endpoint, which responds
  58. with 200 (OK) if everything is fine and 500 (or no response) - if something is
  59. wrong.
  60. Other useful endpoints include mentioned earlier `/status`, `/net_info` and
  61. `/validators`.
  62. We have a small tool, called tm-monitor, which outputs information from the
  63. endpoints above plus some statistics. The tool can be found `here
  64. <https://github.com/tendermint/tools/tree/master/tm-monitor>`__.
  65. What happens when my app dies?
  66. ------------------------------
  67. You are supposed to run Tendermint under a `process supervisor
  68. <https://en.wikipedia.org/wiki/Process_supervision>`__ (like systemd or runit).
  69. It will ensure Tendermint is always running (despite possible errors).
  70. Getting back to the original question, if your application dies, Tendermint
  71. will panic. After a process supervisor restarts your application, Tendermint
  72. should be able to reconnect successfully. The order of restart does not matter
  73. for it.
  74. Signal handling
  75. ---------------
  76. We catch SIGINT and SIGTERM and try to clean up nicely. For other signals we
  77. use the default behaviour in Go: `Default behavior of signals in Go programs
  78. <https://golang.org/pkg/os/signal/#hdr-Default_behavior_of_signals_in_Go_programs>`__.
  79. Hardware
  80. --------
  81. Processor and Memory
  82. ~~~~~~~~~~~~~~~~~~~~
  83. While actual specs vary depending on the load and validators count, minimal requirements are:
  84. - 1GB RAM
  85. - 25GB of disk space
  86. - 1.4 GHz CPU
  87. SSD disks are preferable for applications with high transaction throughput.
  88. Recommended:
  89. - 2GB RAM
  90. - 100GB SSD
  91. - x64 2.0 GHz 2v CPU
  92. While for now, Tendermint stores all the history and it may require significant
  93. disk space over time, we are planning to implement state syncing (See `#828
  94. <https://github.com/tendermint/tendermint/issues/828>`__). So, storing all the
  95. past blocks will not be necessary.
  96. Operating Systems
  97. ~~~~~~~~~~~~~~~~~
  98. Tendermint can be compiled for a wide range of operating systems thanks to Go
  99. language (the list of $OS/$ARCH pairs can be found `here
  100. <https://golang.org/doc/install/source#environment>`__).
  101. While we do not favor any operation system, more secure and stable Linux server
  102. distributions (like Centos) should be preferred over desktop operation systems
  103. (like Mac OS).
  104. Misc.
  105. ~~~~~
  106. NOTE: if you are going to use Tendermint in a public domain, make sure you read
  107. `hardware recommendations (see "4. Hardware")
  108. <https://cosmos.network/validators>`__ for a validator in the Cosmos network.
  109. Configuration parameters
  110. ------------------------
  111. - ``p2p.flush_throttle_timeout``
  112. ``p2p.max_packet_msg_payload_size``
  113. ``p2p.send_rate``
  114. ``p2p.recv_rate``
  115. If you are going to use Tendermint in a private domain and you have a private
  116. high-speed network among your peers, it makes sense to lower flush throttle
  117. timeout and increase other params.
  118. ::
  119. [p2p]
  120. send_rate=20000000 # 2MB/s
  121. recv_rate=20000000 # 2MB/s
  122. flush_throttle_timeout=10
  123. max_packet_msg_payload_size=10240 # 10KB
  124. - ``mempool.recheck``
  125. After every block, Tendermint rechecks every transaction left in the mempool to
  126. see if transactions committed in that block affected the application state, so
  127. some of the transactions left may become invalid. If that does not apply to
  128. your application, you can disable it by setting ``mempool.recheck=false``.
  129. - ``mempool.broadcast``
  130. Setting this to false will stop the mempool from relaying transactions to other
  131. peers until they are included in a block. It means only the peer you send the
  132. tx to will see it until it is included in a block.
  133. - ``consensus.skip_timeout_commit``
  134. We want skip_timeout_commit=false when there is economics on the line because
  135. proposers should wait to hear for more votes. But if you don't care about that
  136. and want the fastest consensus, you can skip it. It will be kept false by
  137. default for public deployments (e.g. `Cosmos Hub
  138. <https://cosmos.network/intro/hub>`__) while for enterprise applications,
  139. setting it to true is not a problem.
  140. - ``consensus.peer_gossip_sleep_duration``
  141. You can try to reduce the time your node sleeps before checking if theres something to send its peers.
  142. - ``consensus.timeout_commit``
  143. You can also try lowering ``timeout_commit`` (time we sleep before proposing the next block).
  144. - ``consensus.max_block_size_txs``
  145. By default, the maximum number of transactions per a block is 10_000. Feel free
  146. to change it to suit your needs.