Commit Graph

12 Commits

Author SHA1 Message Date
vyzo 1c4f0920fe use named constants for tracing message rejection reasons 2020-04-18 11:09:06 +03:00
vyzo 98671566a2 distinguish throttled validation because of a full worker queue. 2020-04-18 11:09:06 +03:00
vyzo e17e266aa9 track message delivery time within the validation pipeline 2020-04-18 11:09:06 +03:00
Piotr Dyraga 499109b165
Configurable size of validate queue
validateWorker() reads from validateQ and invokes validate function
that performs validation of the message. Signature validation is performed
synchronously. The number of validate workers defaults to the number of CPUs
and can be updated with WithValidateWorkers function. With no additional user
validators, signature validation is the bottleneck when receiving new messages.

Increasing the number of validating workers does not help given the context
switching and bottleneck nature of this spot. As stated in WithValidateWorkers
documentation, this function should be used rather to limit the number of workers
to devote less CPU time for synchronous validation. On the other hand, with the
default size of `validateQ`, some applications built on a top of libp2p may
experience throttled validation and lost messages.

This problem is addressed by WithValidateQueueSize allowing to configure the buffer
size for synchronous validation. Application developers knowing the nature of their
protocols can set this value to minimise the possibility of throttled synchronous
validation and dropped messages. Configurable buffer size allows to gracefully
handle peaks of messages and, from the other side, the number of concurrent
synchronous workers is still limited by validateWorkers property so the receiver
should not get congested.
2020-01-21 10:19:42 +01:00
protolambda 7981f9bfbd
fixes #247: implement msg id function as pubsub option 2019-12-16 03:54:40 +01:00
vyzo 958e09a5b3 remove useless nil check when initializing subsystem tracers 2019-11-15 20:42:04 +02:00
vyzo 67275a6382 tracing scaffolding 2019-11-15 20:42:04 +02:00
Adin Schmahmann d28f450046 expose the peer that propagates a message to the recipient 2019-10-18 02:39:37 -04:00
Raúl Kripalani 49274b0e8a
migrate to consolidated types. (#185) 2019-05-26 17:19:03 +01:00
vyzo 2df9d940bf remove unnecessary context in validateSingleTopic 2019-05-14 14:17:32 +03:00
vyzo f4d9eeec26 improve godocs 2019-05-14 14:03:08 +03:00
vyzo cb423f474d split off validation into its own type 2019-05-14 14:03:08 +03:00