-
Notifications
You must be signed in to change notification settings - Fork 10
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
Move get_info off main thread and run in http thread #920
Conversation
plugins/chain_plugin/include/eosio/chain_plugin/get_info_db.hpp
Outdated
Show resolved
Hide resolved
I think it could be implemented in a simpler way. Instead of having the chain_plugin query the controller for all the individual members, why not have the controller allocate a new struct of Then the |
…version_string) at the construction of get_info_db_impl objects
Will work on mutex locations tomorrow. Hopefully now all tests can pass without modifying them. |
Thanks. New implementation makes it mutex free while doing it in chain_plugin |
if (options.count("plugin")) { | ||
const auto& v = options.at("plugin").as<std::vector<std::string>>(); | ||
last_tracked_votes_enabled = std::ranges::any_of(v, [](const std::string& p) { return p.find("eosio::chain_api_plugin") != std::string::npos; }); | ||
chain_api_plugin_configured = std::ranges::any_of(v, [](const std::string& p) { return p.find("eosio::chain_api_plugin") != std::string::npos; }); |
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.
We agreed that we didn't need that check since chain_api_plugin
is most of the time configured.
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 is most likely configured in BP nodes but not necessarily in other nodes.
Why? I think it is better to do it in controller, as it makes the information available to whomever needs it (could be prometheus for example), not just the chain plugin. |
plugins/chain_plugin/include/eosio/chain_plugin/get_info_db.hpp
Outdated
Show resolved
Hide resolved
I think it is better separate concern doing it in chain_plugin; let controller just emit signals and its users decide what to do with the signals. All the data required by get_info is available with currently controller APIs. There is no need to add another one. |
Note:start |
/v1/chain/get_info
is a top 1 or 2 used RPC endpoint (AntelopeIO/leap#1212). It is currently processed on themain
thread. Moving it off the main thread will reduce load on themain
thread, and will shorten response time when themain
thread is stuck (#830).This PR moves
get_info
off themain
thread and runs it onhttp
thread. The data required by get_info is cached onaccept_block
signal and is used to serviceget_info
when needed.Notably, the implementation is mutex free such that the
main
thread is never blocked byget_info
.Resolves #527