Subscribe to CloudFlare Worker Unlimited

The CloudFlare Worker has a free plan - but it only allows up to 100K requests (including invalid) per day. The request counter resets at midnight UTC.

My LB node https://steem.justyy.workers.dev is implemented using Worker script. And it gets popular. Thus, i have purchased the Unlimited plan - which starts at $5 per month - which also lifts the CPU time from 10ms to 50ms, and includes 10Million requests per month (roughtly 330K per day).

I have also pointed the subdomain steem.justyy.com to it which is easier to remember, however, at the moment, due to unknown technical problems, the alias domain isn’t working as expected.

Here is the response text:

1
{"jsonrpc":"2.0","error":{"code":-32000,"message":"End Of File:stringstream","data":{"code":11,"name":"eof_exception","message":"End Of File","stack":[{"context":{"level":"error","file":"sstream.cpp","line":109,"method":"peek","hostname":"","timestamp":"2020-07-13T19:04:42"},"format":"stringstream","data":{}},{"context":{"level":"warn","file":"json.cpp","line":489,"method":"from_string","hostname":"","timestamp":"2020-07-13T19:04:42"},"format":"","data":{"str":""}}]}},"id":null}

I will look into this and hopefully can finish this soon.


Every little helps! I hope this helps!

Steem On!~

If you like my work, please consider voting for me, thanks!
https://steemit.com/~witnesses type in justyy and click VOTE



Alternatively, you could proxy to me if you are too lazy to vote!

Also: you can vote me at the tool I made: https://steemyy.com/witness-voting/?witness=justyy

Visit me at: https://steemyy.com


This page is synchronized from the post: ‘Subscribe to CloudFlare Worker Unlimited’

Improvement to the Load Balancing Node

My Load Balancing RPC Node is getting popular, here is the statistics of the last 24 hours.

image.png

image.png

Setting Origin in the Header

In case you want to know the origin server that serves the request, you can check the custom header Origin. The Server header field is overridden by CloudFlare.

image.png

image.png

Adding more Nodes

I have also added nodes (provided by @ety001) so now the LB node has the following candidate servers that better suitable requests all over the world.

1
2
3
4
5
6
7
let nodes = [
"https://api.justyy.com",
"https://api.steemit.com",
"https://api.steemitdev.com",
"https://api.steem.fans",
"https://steem.61bts.com"
];

In China, the official api.steemit.com is blocked, so using this Load Balancer is advantageous:

https://steem.justyy.workers.dev


Every little helps! I hope this helps!

Steem On!~

If you like my work, please consider voting for me, thanks!
https://steemit.com/~witnesses type in justyy and click VOTE



Alternatively, you could proxy to me if you are too lazy to vote!

Also: you can vote me at the tool I made: https://steemyy.com/witness-voting/?witness=justyy

Visit me at: https://steemyy.com


This page is synchronized from the post: ‘Improvement to the Load Balancing Node’

Leetcode Biweekly Contest 30

I have recently started to attend the online coding contest. Leetcode has held weekly contests on Sunday early mornings - which isn’t ideal for coders living in Europe.

However, they have biweekly contests, which is run the Sat 3:30 to 5:30 (BST) every two weeks.

Today’s contest: https://leetcode.com/contest/biweekly-contest-30

I have managed to solve 3 puzzles in 30 minutes, however, failed to solve the fourth puzzle (difficulty level) in next hour.

The programming language I choose is Python, C++. I have 1 Wrong Answer submission for Problem 3 - which adds total 10 minutes time penalization.

image.png

The fourth puzzle is not that difficult - it is a pity that I didn’t get it - and my ranking is expected to drop.

Reformat Date

https://leetcode.com/contest/biweekly-contest-30/problems/reformat-date/
It is harder to use C++ as in C++ the string split function is not native. Python is good.

Range Sum of Sorted Subarray Sums

https://leetcode.com/contest/biweekly-contest-30/problems/range-sum-of-sorted-subarray-sums/
O(N^2) will work - as the input range is (10^3), however beware of the integer overflow.

Minimum Difference Between Largest and Smallest Value in Three Moves

https://leetcode.com/contest/biweekly-contest-30/problems/minimum-difference-between-largest-and-smallest-value-in-three-moves/
Sorting (O(N^LogN)) and then compare four different possibilities.

Stone Game IV

https://leetcode.com/contest/biweekly-contest-30/problems/stone-game-iv/
Dynamic Programming, similar to this puzzle

I’ll share the solutions on the blog in more details soon.

Although the contest has ended, you can try to participate on the virtual contest.


Every little helps! I hope this helps!

Steem On!~

If you like my work, please consider voting for me, thanks!
https://steemit.com/~witnesses type in justyy and click VOTE



Alternatively, you could proxy to me if you are too lazy to vote!

Also: you can vote me at the tool I made: https://steemyy.com/witness-voting/?witness=justyy

Visit me at: https://steemyy.com


This page is synchronized from the post: ‘Leetcode Biweekly Contest 30’

A Glance on the Traffic to the Load Balancer Node

Yesterday, I presented you a Load Balancer Node which is at:

https://steem.justyy.workers.dev

The advantages of using this node is:

  1. Close to 100% availability: the Node lives on the edge network (serverless function), and all it does is to forward your Steem API requests to an available node from the pre-defined list. The chances of all nodes go down are really unlikely to happen.
  2. Faster. The Load Balancer is automatically chosen that is georaphically close to you. Then depending on your location, it will pick a fastest node.

Well, we call it load balancer - but this node is not taking the actual ‘load’ into account. It considers the ping time instead. But, in a sense, the node that responds slower may be likely to be on a high load average.

Here is some stats for this load balancer in the last 24 hours.

image.png

image.png


Every little helps! I hope this helps!

Steem On!~

Reposted to Computing & Technology

If you like my work, please consider voting for me, thanks!
https://steemit.com/~witnesses type in justyy and click VOTE



Alternatively, you could proxy to me if you are too lazy to vote!

Also: you can vote me at the tool I made: https://steemyy.com/witness-voting/?witness=justyy

Visit me at: https://steemyy.com


This page is synchronized from the post: ‘A Glance on the Traffic to the Load Balancer Node’

How Many Blocks and Total Rewards for a Steem Witness in the Past 24 Hours?

The blockchain is a public database, this shouldn’t be hard to find out. In this post we know how to call the Steem API to find out the witness that procduce each block and the reward (in VESTS) he/she collects for generating the block (mining).

Let’s create a database in SQLite - with the schema:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
sqlite> .schema
CREATE TABLE witnessblocks (
witness text,
number integer,
vests real,
time text,
block integer,
constraint pkey primary key (block)
);
CREATE INDEX index_block on witnessblocks(block);
CREATE INDEX index_witness on witnessblocks(witness);
CREATE INDEX index_time on witnessblocks(time);
CREATE INDEX index_vests on witnessblocks(vests);
CREATE INDEX index_number on witnessblocks(number);

Then, we can run a SQL to find out the number of blocks and total rewards for each witness. Results are sorted by total rewards in SP (which can be computed by simply roughly divided by 1943 SP) - see this number at: https://steemyy.com

Query:

1
sqlite> select witness,count(1), sum(vests/1943.761) as total from witnessblocks where time >= date('now', '-24 hour')  group by witness order by total desc limit 30;

Result (a bit surprising, more than expected, different than what the steemworld says @steemchiller): I double check the data and everything seems correct. My understanding is that a lot of misses are re-scheduled and that is why the TOP witnesses get more turns to produce blocks.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
justyy|2326|578.82025257632
steemchiller|2324|578.325146664636
hinomaru-jp|2324|578.322147174472
hivei0|2323|578.073978002953
scissor.sisters|2322|577.826185736312
dlike|2321|577.5771644482
steem-supporter|2320|577.328037061142
inwi|2319|577.082116292075
beargame|2319|577.079035895361
smt-wherein|2318|576.832034089068
steem-dragon|2318|576.831055014993
roundblocknew|2318|576.828982039459
rnt1|2317|576.583037687762
hoasen|2317|576.582024700568
symbionts|2317|576.578049543128
steem-agora|2316|576.338157853255
maiyude|2316|576.336006269803
future.witness|2313|575.584969334193
protoss20|2309|574.593023568226
dev.supporters|2305|573.596812309745
matreshka|193|240.560583586665
parse|192|239.309574386974
cryptoking777|191|238.066390513031
menacamel|191|238.066344493484
juddsmith079|190|236.823358969544
enjoylondon|190|236.815291552305
rlawlstn123|187|233.082098971016
leverfile|186|231.834906382009
upeross|185|230.587764003393
roadofrich|30|37.3927565415707

Once this data is verified, I’ll add it to the witness ranking table


Every little helps! I hope this helps!

Steem On!~

Reposted to Computing & Technology

If you like my work, please consider voting for me, thanks!
https://steemit.com/~witnesses type in justyy and click VOTE



Alternatively, you could proxy to me if you are too lazy to vote!

Also: you can vote me at the tool I made: https://steemyy.com/witness-voting/?witness=justyy

Visit me at: https://steemyy.com


This page is synchronized from the post: ‘How Many Blocks and Total Rewards for a Steem Witness in the Past 24 Hours?’

Introducing the Load Balancing RPC Node: https://steem.justyy.workers.dev/

A node is a node, it fails sometimes. So what happens when a RPC node fails? You can fail over - but that requires you to write some code to try next available node.

How about I tell you that I provide a Load balancing RPC Node that will automatically find the fastest route (a good one) and redirect the STEEM API calls for you?

Introducing the Load Balancing RPC Node: https://steem.justyy.workers.dev/

See the list of nodes: https://steemyy.com/node-status.php

image.png

image.png

https://steemyy.com/steemjs/
image.png

The candidate nodes:

Currently, I have added the following:

1
2
3
4
5
let nodes = [
"https://api.justyy.com",
"https://api.steemit.com",
"https://api.steemitdev.com",
];

So, the chance of all three nodes die - almost close to ZERO. That should give you some confidence of using it. The Load Balancer Node lives on the CloudFlare Edge - (yes, the serverless function)

image.png

Beware that this node returns different version number, sometimes 0.23.0 and sometimes 0.23.1!


Every little helps! I hope this helps!

Steem On!~

If you like my work, please consider voting for me, thanks!
https://steemit.com/~witnesses type in justyy and click VOTE



Alternatively, you could proxy to me if you are too lazy to vote!

Also: you can vote me at the tool I made: https://steemyy.com/witness-voting/?witness=justyy

Visit me at: https://steemyy.com


This page is synchronized from the post: ‘Introducing the Load Balancing RPC Node: https://steem.justyy.workers.dev/‘

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×