Below is a list of some of the Hive-related programming issues worked on by the BlockTrades team during the past work period. We’ve been pretty busy during the last period (so busy that I had trouble finding time to make this report, but one benefit of everyone taking off for the holidays is I finally got some free time). Because of the amount of time that has passed since the last report and the amount of work that has been done, I’ll just cover some of the highlights here.
Hive Application Framework: framework for building robust and scalable Hive apps
Our recent work has focused on optimizations, primarily of HAF and HAF apps.
As mentioned in my last report, we noticed that while the sql_serializer indexed most of the blocks into the HAF database very quickly, its performance was considerably slower once it dropped out of “massive sync” mode (where many blocks are processed simultaneously) into “single block” live sync mode. We observed that the sql_serializer was dropping out of massive sync mode earlier than it could theoretically, which resulted in hundreds of thousands or even a million or more blocks being processed in this slower single block mode, depending on how old the block_log being used to initialized the hived node.
After a few design revisions based on the new algorithm described in my previous post and a lot of testing and bug fixes (we resolved the last bug yesterday and finished verifying the fix today), the sql_serializer now stays in massive sync mode until the node is within one minute of syncing to the headblock, then it builds the database indexes and foreign keys needed for live sync mode, then it transitions to live sync mode to process the remaining blocks to the head block, then syncs block by block as new blocks are created.
With the current blockchain at just over 60M blocks, reaching headblock while filling a HAF database only takes around 10 hours now on our fast systems, which is pretty fantastic, in my opinion. By way of a minor comparison, reindexing an account history hived node (the need of which is obsoleted by HAF) took over 17 hours back when the blockchain was much smaller.
The above benchmark presumes starting with a block_log file that is within a million blocks or so of the current headblock, because block delivery times between p2p nodes begins to dominate as the time bottleneck if starting with a very old block_log file (or no initial block_log at all). As a side note, I hope we will find some time soon to look at speeding up normal P2P sync time. While it is fairly fast now, I think there may still be room for improvement.
Balance tracker user interface (HAF app)
Our two new Hive devs have created an API and a web interface for the balance_tracker (an example HAF app) using the PostgREST web server as an experiment in creating a HAF app that only requires SQL and Javascript coding. For more details on this app, see my previous post.
So far this process has gone well, and we’re currently collecting benchmarks and seeing how far we can optimize the app. If you want to check it out, you can visit: https://gitlab.syncad.com/hive/balance_tracker (checkout the develop branch).
Optimization HAF account history app (hafah)
We continued to experiment with various ways of optimizing the HAF-based account history app that is designed to replace account history hived nodes.
In its current form, it is a somewhat unique HAF app, because it doesn’t create any additional database tables of its own now, instead it just relies on the default database tables created by hived’s sql_serializer plugin. We were able to achieve this by changing the sql_serializer to directly generate the impacted_accounts table that was previously computed by the hafah app. As discussed in previous posts, this change eliminated entirely the need to index a hafah app and only minimally impacted the time that the sql_serializer takes to fill a HAF database.
But reuse of HAF’s tables vs the app creating its own tables has posed some unique challenges as far as optimization goes, and we’re looking at how to best optimize the queries of the app when it is only returning irreversible data (we expect we can get much better performance in this case, because the app only needs to look at data in the irreversible tables, instead of having to operate over both the irreversible and reversible tables).
Yet more HAF example apps
We created some more example HAF apps to demonstrate various types of HAF apps:
- a fork-impervious app: haf_new_account_colloector is an app that only processes blocks as they become irreversible, so it serves up API results very fast and the data it returns is guaranteed to not be changed by a fork, but the data it returns is delayed relative to the head block.
- a standard app: haf_memo_scanner is an app that process blocks before they become irreversible, providing the most recent data, but some of the data can potentially be reversed if the blockchain experiences a micro-fork.
- haf_account_creation_fee_follower and haf_account_creation_fee_follower_threads: these are two versions of the same app, but the second version uses multiple threads for higher performance (at the expense of some additional code complexity).
During this process we also found and fixed a few more bugs in HAF itself.
Hived (blockchain node software) work
Rationalization of resource credit (RC) costs
We’re continuing to work on improving the calculations associated with resource credits (the manna costs to an account when the account broadcasts a transaction such as a post, a vote, or a coin transfer). Right now that means we are creating tools to effectively measure and record these costs. I expect we will complete this work in the first half of January.
Optimization of get_block API calls
We’re also looking to optimizing one of the most expensive API calls still processed by hived itself: the API calls for returning data about blocks. We’ve made some progress in this area (reduction in CPU usage and some reduction in latency), but we’re still investigating if there’s more room for improvement.
What’s next?
- Clean up docs for HAF
- Create scripts to simplify setup of a HAF-based server
- Finish conversion of hivemind to a HAF-based app
- Add support for filtering of operations by sql_serializer to allow for smaller HAF server databases
- Complete work on resource credit rationalization
- Finish optimization of hafah when operating in “irreversible” mode and collect benchmarks for the two different operating modes (irreversible vs reversible mode)
- Finish up optimization of get_block API calls
- Integrate tests and more benchmarking into CI system for various repos
Very good,
IMO the system now is way to static. I would hear more about it if you have the time to explain to me what the plan is to improve it.
IMO it should include price/computing + in some way an avg hive price ( for scaling) power and for sure the already included supply/demand. Maybe also included active/transacting wallets as a hidden correcting part.
because if hive hits for example 400$ each, witness earnings would allow much more computing power for scaling.
sure an extreme example, but mass adoption could end up in those moves, and then 1 Hive today in power (RC) should not be the same as the 400$ one.
Otherwise, hive would IMO not scale. I know L2 and so on. But the value comes IMO with a more powerful Hive token because computing power becomes cheaper and scales too.
Our current improvements are centered on getting more accurate measurements of the costs of transactions and operations that can then be used to rationalize the pricing for them (currently some of the costs are fairly arbitrary and the execution costs of verifying transaction signatures was completely ignored).
I don't expect the current changes to RC to be the last ones done, but this is an important step along the way.
good to know! thank you and a happy new year!
Possibly but there can be bottlenecks that are more tied to the software architecture which don't necessarily lend themselves to scaling up by spending money. For example, fastest single-threaded computer you can buy at any price isn't really all that much faster than an iPhone.
Of course, it is also true that with more money, more work can go into optimizing and rearchitecting the software, to a point.
The concept is good, though, but the relationship between money and scaling isn't linear or simple.
*For example, the fastest single-threaded computer you can buy at any price isn't really all that much faster than an iPhone.
That's true. And the Software is of course in some way the bottleneck.
I agree 100% on this. But to the simple point of storage and the 400$ Hive example, I think the Block size could easily increase or become dynamic? Ok, Dynamic makes it too complex for the example :D
The point was more, there are some " long hanging fruits" out there that would allow scaling and should be included in future RC updates ( or even think about the options)
And to not become behind the curve, I think it's not bad to have in mind the cheaper and more powerful technic that will be affordable :)
Also true but it is exponential between time/computing power ( possible scaling)
Nice talk like always!
I wish you a happy new year!
Maybe? Would still requiring processing that data in real time (every 3 seconds).
Happy new year to you as well!
Remember the differences between 'two', 'too' and 'to'.
no difference, all the same.
oh deer.
What IS IMO? Thank you
In My Opinion
Thank you!
Didn't you mention in one of the posts (or perhaps it was a comment you made), that there was work being done to change the API to a standard that Coinbase uses? My interpretation of that was that Hive is going to have a tough time getting on CB without making that change.
Am I understanding that correctly and how is the progress there going?
As I understand it, Coinbase likes tokens to integrate some interface called Rosetta. I haven't looked into it myself, but @howo reviewed it. I suggested to him that it should probably be supported via a hived plugin.
More good progress. I hope you got some time off over Xmas. Wishing for Hive to go viral next year!
I mostly relaxed and ate a lot over Christmas weekend. An old pingpong buddy stopped by as well, so I spent a couple of hours trying to counter the effects of all that food. A lot more fun than working out with a pingpong robot.
Good to hear. I think we all needed some good times to end the year.
Your list of HAF app examples talked about how HAF worked for these apps but didn't actually describe in the poat what the app did right? Just checking to make sure I'm not crazy... but the names of the apps sounds like they're pretty interesting. Are these small apps comparatively simple to make via HAF?
Yes, I only described their implementation architecture, not their function, although hopefully the names hint at that. The main reason for creating these apps was to have code examples of some of the typical design choices for a new HAF app.
Yes, they were very easy to make I think (one guy, mtrela on gitlab, created all four of them).
Cool! Merry xmas and wish you a happy new year 👍
Thanks, Merry Christmas and Happy New Year to you as well!
The new development of the project next year 2022 will provide strong and achieved the aim of hive software.... tnx for the great work the team are doing.
If you solve many problems, it will be very powerful
great work!
Very interesting. Thank you very much and happy holidays.
Thanks, happy new year!
Awesome to hear the progress of the Hive blockchain, 2022 will be Hive's greatest year so far, I can feel it in my bones.
When are we going to have the next HF, and any news about smt on HIVE?
I think the next HF will likely come near the end of February, but there's no set date yet.
When we looked into SMTs, we found the code wasn't nearly complete (despite what had been reported by Steemit). Based on that, we decided it was better to create a more flexible smart-contract system to support token creation instead. We plan to build that in 2022 on top of HAF.
Congratulations @blocktrades! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s):
Your next payout target is 1485000 HP.
The unit is Hive Power equivalent because your rewards can be split into HP and HBD
You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOP
Check out the last post from @hivebuzz:
Support the HiveBuzz project. Vote for our proposal!
Congratulations @blocktrades! Your post has been a top performer on the Hive blockchain and you have been rewarded with the following badge:
You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOP
Check out the last post from @hivebuzz:
Support the HiveBuzz project. Vote for our proposal!
yes good
@blocktrades, is it possible (and reasonable) to increase the number of witnesses rewarded from 20+1 to 25+1 for example, in order to make the ecosystem more decentralized and stable?
Exelente👍🏻
Felicidades a todo el equipo por su trabajo, esperemos que este funcionando muy pronto.