create account

Greenshift 037: Developing A Network Cache by qfilter

View this thread on: hive.blogpeakd.comecency.com
· @qfilter ·
$0.03
Greenshift 037: Developing A Network Cache
So, I've missed the last couple of days due to being stuck at work for consecutive twelve hour days, but given that I'm relatively free I thought I would share an idea I came up with while in the shower and refined during my breaks during work. Pardon not adding any new code today, I'm kind of burnt out on that end for today.

So, let's setup the issue we're going to tackle today:

When we're getting content for users to pick from, we are doing a lot of querying from the blockchain. Some of this querying is justified. But what if we query from the same starting point a second time a short time after the first? Well it is likely nothing has changed. So we waste a lot of time querying, especially if areas of the Steem topology are traversed very frequently in a short period of time.

Querying also takes a lot of time and some of the relationships do a lot of queries. So any solution needs to reduce the number of queries while also maintaining the fidelity of the product. What's the solution for this problem? Developing a cache for the entire network and updating the cache when updates are made.

Here's how it works:

We store nodes of the relevant network in our database. The relevant nodes in our case is a point where the relationships branch off of. In our case, a node would be a specific account since all relationships derive some information given a account. So, we would store seven things (given our current application):

1. Account Name (This acts as a Node identifier / reference )
2. Content derived from relationship 1
3. Content derived from relationship 2
4. Content derived from relationship 3
5. Content derived from relationship 4
6. Content derived from relationship 5
7. Timestamp of last operation

The first six are pretty obvious why we store them. We store the account name so if we search the same account in the future by anybody, we can simply give them the content rather than querying the blockchain a lot. The reason we need the timestamp is to perform a single check on the blockchain. If the author has performed an operation, then our information may be outdated and we should re-query the chain. If no operation has been performed, then we simply store the information in our network cache.

In heavily traversed paths, this prevents us from spamming the blockchain and overloading the server on the web application end. The cache also saves the end user tons of time and makes the overall experience more enjoyable while providing the same content they would receive otherwise. And that's an ideal solution. One with tons of benefits with no downside.

So we'll implement something like this in the future before launching the app. But for now, we'll probably shift our focus to developing a good entry portal into our traversal mechanism and developing a few backup relationships, so users have plenty of options to select from. Have a great night everyone!
👍  , , , ,
properties (23)
authorqfilter
permlinkgreenshift-037-developing-a-network-cache
categorygreenshift
json_metadata{"tags":["greenshift","blog","development","brainstorm","programming"],"app":"steemit/0.1","format":"markdown"}
created2018-08-31 02:20:12
last_update2018-08-31 02:20:12
depth0
children5
last_payout2018-09-07 02:20:12
cashout_time1969-12-31 23:59:59
total_payout_value0.029 HBD
curator_payout_value0.001 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,911
author_reputation391,282,423,676
root_title"Greenshift 037: Developing A Network Cache"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id69,849,936
net_rshares22,031,527,051
author_curate_reward""
vote details (5)
@carn ·
Just wanna let you know, even though I'm not a good commenter, I am following this to see how it goes. Also mentioned it in the brainstorming channel of the SteemPeak Discord channel ;)

Good luck!
👍  
properties (23)
authorcarn
permlinkre-qfilter-greenshift-037-developing-a-network-cache-20180831t045249488z
categorygreenshift
json_metadata{"tags":["greenshift"],"community":"steempeak","app":"steempeak"}
created2018-08-31 04:52:51
last_update2018-08-31 04:52:51
depth1
children0
last_payout2018-09-07 04:52:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length197
author_reputation849,541,941,985
root_title"Greenshift 037: Developing A Network Cache"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id69,858,999
net_rshares11,813,088,022
author_curate_reward""
vote details (1)
@ilovecoding ·
Hello! Your post has been resteemed and upvoted by @ilovecoding because **we love coding**! Keep up good work! Consider upvoting this comment to support the @ilovecoding and increase your future rewards! ^_^ Steem On! 
 ![](https://codingforspeed.com/images/i-love-coding.jpg)
👍  
properties (23)
authorilovecoding
permlink20180831t022027419z
categorygreenshift
json_metadata{"tags":["ilovecoding"],"app":"ilovecoding"}
created2018-08-31 02:20:27
last_update2018-08-31 02:20:27
depth1
children0
last_payout2018-09-07 02:20:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length276
author_reputation40,845,997,808
root_title"Greenshift 037: Developing A Network Cache"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id69,849,954
net_rshares553,409,479
author_curate_reward""
vote details (1)
@steemitboard ·
Congratulations @qfilter! You received a personal award!

<table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@qfilter/birthday1.png</td><td>1 Year on Steemit</td></tr></table>

<sub>_[Click here to view your Board of Honor](https://steemitboard.com/@qfilter)_</sub>


**Do not miss the last post from @steemitboard:**
<table><tr><td><a href="https://steemit.com/steemitboard/@steemitboard/5jrq2c-steemitboard-saint-nicholas-day"><img src="https://steemitimages.com/64x128/http://i.cubeupload.com/mGo2Zd.png"></a></td><td><a href="https://steemit.com/steemitboard/@steemitboard/5jrq2c-steemitboard-saint-nicholas-day">Saint Nicholas challenge for good boys and girls</a></td></tr></table>

> Support [SteemitBoard's project](https://steemit.com/@steemitboard)! **[Vote for its witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1)** and **get one more award**!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-qfilter-20181207t231250000z
categorygreenshift
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2018-12-07 23:12:51
last_update2018-12-07 23:12:51
depth1
children0
last_payout2018-12-14 23:12:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length920
author_reputation38,975,615,169,260
root_title"Greenshift 037: Developing A Network Cache"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id76,519,714
net_rshares0
@steemitboard ·
Congratulations @qfilter! You received a personal award!

<table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@qfilter/birthday2.png</td><td>Happy Birthday! - You are on the Steem blockchain for 2 years!</td></tr></table>

<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@qfilter) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=qfilter)_</sub>


###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-qfilter-20191207t230826000z
categorygreenshift
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2019-12-07 23:08:27
last_update2019-12-07 23:08:27
depth1
children0
last_payout2019-12-14 23:08:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length616
author_reputation38,975,615,169,260
root_title"Greenshift 037: Developing A Network Cache"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id93,206,822
net_rshares0
@steemprojects ·
This post has been just added as new item to _[timeline of Q-Filter on Steem Projects](https://steemprojects.com/projects/p/q-filter/?utm_source=comment_timeline&utm_medium=steem&utm_campaign=new_event&utm_content=c1)_.

If you want to be notified about new updates from this project, register on Steem Projects and add Q-Filter to your favorite projects.
properties (22)
authorsteemprojects
permlinkre-greenshift-037-developing-a-network-cache-20180831t025456
categorygreenshift
json_metadata""
created2018-08-31 02:54:57
last_update2018-08-31 02:54:57
depth1
children0
last_payout2018-09-07 02:54:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length357
author_reputation29,054,729,340
root_title"Greenshift 037: Developing A Network Cache"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id69,851,943
net_rshares0