-
Notifications
You must be signed in to change notification settings - Fork 56
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
get_block() request very slooow. #253
Comments
Are you requesting them with full transaction details or just hashes? Do you have the redis cache enabled? |
I'm requesting them with full transactions and don't use redis cache. |
Did you make the WS request through Dshackle as well? If yes, can you test it again restarting Dshackle before the test, to make sure it doesn't use any internal caching? |
Yup, ws requests go through Dshackle. The current test is:
lb-local: Dschackle on local machine edit:lb-local is the one I restarted before the test. |
hm, so, just to confirm your findings. When you requests I suspect that the slow response may happen for an old block, and a request for a recent block may work better. Maybe that the reason of the difference. PS I see why Dshackle can be slow for this particular request, but I don't understand why WS and HTTP work differently. That's why I'm asking this to better understand where to look at. |
Everything you stated is correct. getBlock is slow over http and almost no overhead over ws. And it's also true, that ws test is requesting only the latest block where http test is fetching last 50 blocks. I will create identical tests for ws and http and let you know. |
You were right. The ws test was fast, because it fetched cached / latest block. Here are the results, http vs ws:
You mentioned that you know why get block with txs is slow. Can you elaborate? Are blocks with full tx not cached? Is there a way to overcome that? |
I also tried with redis and results are the same. |
I had some wrong assumptions for caching this type of requests. Dshackle processes the block and transactions inside it independently. It works fine for the recent blocks, because most of the data in the memory. Then this data gets removed from this "hot data" cache, but the secondary cache doesn't have it because it's unpopular data, so it wastes a lot of time checking each transaction independently. I'll need to rewrite this part to make it fast as it supposed to be. |
Is there any ETA for the fix? Or maybe some pointers how to properly fix the problem? |
I've fixed it in Do you think you can try with that version? It's not uploaded to docker, but you could build it locally (join our Discord, if you have questions) |
btw, how do you measure CPU usage and what is the high load in your case? |
Having the same issue, specifically for eth_getBlockByNumber" params":["latest",true]. I'm using @MysticRyuujin's dappnode package. @tomih What are you using to benchmark, I'll try it against my instance. |
I wrote simple python script: https://gist.github.com/tomih/177c40722b06a4de94aff9fa27376b70 |
I benchmarked dshackle and found that get_block (by number or by hash) and with included transactions is terribly slow.
Here are the average results for last 50 blocks:
Block average response time: dshackle on node: 1526.1953592300415 ms dshackle on local machine: 1431.77649974823 ms node: 135.94377040863037 ms
Other calls, like block.latest, get_transaction_receipt or getBalance return expected results (ie. add few ms latency).
Can somebody explain why getBlock is so slow and how to tackle the problem?
edit: get_block call without transactions is fast as expected.
Thnx,
Tomi
The text was updated successfully, but these errors were encountered: