AntelopeIO / spring

C++ implementation of the Antelope protocol with Savanna consensus
Other
8 stars 3 forks source link

get_info off the main thread #527

Open heifner opened 1 month ago

heifner commented 1 month ago

Currently /v1/chain/get_info processing is posted to the main thread. get_info could be moved off the main thread by copying the current get_info data into the get_info_results struct on every accept_block signal. Then get_info could be handled completely off the main thread.

See https://github.com/AntelopeIO/leap/issues/1212 for original issue which includes EOS Nation API usage graphs.

linh2931 commented 2 days ago

get_info is pushed to the read-only queue. In an API node with --read-only-thread configured, get_info will be serviced by read-only threads.

Do we want to have a dedicated thread for get_info?

If we cache get_info_results on every accept_block signal, will it be a waste if no get_info is called?

heifner commented 2 days ago

I don't think we want a dedicated thread for get_info, just the http thread pool. If get_info is not called then yes it is a waste to update the info on every accept_block. However, this seems like a good trade-off. We can disable this logic if chain_api_plugin is not enabled.

linh2931 commented 2 days ago

Thanks.

Why do the existing read-only threads not help here?

greg7mdp commented 2 days ago

it is a waste to update the info on every accept_block

I doubt that the cost of doing this is even measurable. I wouldn't worry about it.