-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update API/serialization time constraints #1139
Conversation
… return at least one.
…erialization_time per serialization step.
…ation on the http thread
…ation on the http thread
…me up to a max of 1000 items or http-max-response-time is -1.
… constructor of mutable_variant_object since there is an explicit constructor for it.
…tion_time which applies only to action data deserialization
in:
why don't we return at the end
|
Never mind again I see it now. I like it :-). |
make_resolver(chain(), get_abi_serializer_max_time(), throw_on_yield::no), | ||
get_abi_serializer_max_time()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems odd that we set the same get_abi_serializer_max_time
both in the resolver (setting a yield function when creating the abi_serializer
), and in the impl::abi_traverse_context
. But I still have not wrapped my head about all the details of this so probably it is needed?
plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp
Outdated
Show resolved
Hide resolved
… limit and time limit
…instead of 10ms
Update of API/serialization time constraints
Requirements:
atomic
request (such asget_block
,send_transaction*
andpush_transaction*
) successfullyatomic
API calls, such asget_table_rows
,get_table_by_scope
,get_scheduled_transactions
andget_producers
(where the user is free to request a smaller range if needed), the node operator should be able to specify a max request time.ABI serialization limit
The ABI deserialization for most ABI intensive requests (including
get_block
,send_transaction*
,push_transaction*
,get_account
,get_table_rows
) was moved to the HTTP thread pool, so ABI deserialization no longer can affect the responsiveness of nodeos's main thread.Note that ABI serialization, when processing the API parameters (for example for
send_transaction2
), still occurs on the main thread and is limited byabi-serializer-max-time-ms
. In case of serialization failure, the API will fail and return an error.For the deserialization now occuring on the http thread pool, any single deserialization call will be limited by
abi-serializer-max-time-ms
as well. If that limit is hit for a specific object, the request will not fail, instead that object will be returned in the binary, non-deserialized form.So when processing a request such as
get_block
, the request will always succeed (no timeout), but some specific objects may be returned in non-deserialized form. The max time for processing aget_block
request will only be limited by the maximum number of actions in a block andabi-serializer-max-time-ms
.However because the deserialization is now done off the main thread, the absence of a lower limit should not impact the responsiveness of the node when serving legitimate requests.
Constraints on the number of items returned for non-atomic APIs
http_max_response_time
now applies only to requests which specify a range of objects to be retrieved (get_table_rows
,get_table_by_scope
,get_scheduled_transactions
andget_producers
), and specifies the maximum time spent on the main thread. The default ofhttp-max-response-time-ms
has been changed from 30ms to 15ms.As before, API requests can also specify an optional
time_limit_ms
which now also provides a constraint on the maximum time spent on the main thread (excluding deserialization). Iftime_limit_ms
is not specified then the nodeos configuration ofhttp-max-response-time-ms
will be used as the limit of time spent on the main thread.As long as the request is valid and the requested range is not empty, a minimum of one object will always be returned (one row for
get_table_rows
for example). There is also a hard coded maximum of 1000 items returned, unlesshttp_max_response_time
is set to-1
in which case there is no limit.Note: This PR changes
/v1/chain/get_activated_protocol_features
to be considered an atomic request.limit
andtime_limit_ms
of the request will be ignored and all activated protocol features will always be returned.So we define:
max_time
is the minimum ofhttp_max_response_time
andtime_limit_ms
(negative values are equivalent to infinite time).max_items
is the requested range size, limited to 1000 unlesshttp_max_response_time
is negative.min_items
is 1 if the requested range is not empty, 0 otherwiseAPI processing occurs in two steps:
min_items
,max_items
], with amax_time
processing limit.abi-serializer-max-time-ms
, and returning the response.Developer notes
safe_add
added totime_point
that avoids overflow.mutable_variant_object
forvariant_object
to avoid copy.Resolves #1062