I have enabled the CloudFlare Unlimited Worker last week, and this gives the generous 50ms CPU cycle for request, and 10Million Request monthly. On average, 0.33 Million (330K) requests quota every day.
Mainly the Load Balancing Node spends time in pinging the candidate RPC nodes that is the fetch - which does not cost the CPU time.
However, as CF limits maximum 6 requests at a time, that is only 6 simutaneous pings will be done and the rest will be put in the queue. But that is good enough for now.
I’ll keep monitoring the performance and keep optimising the Node.
I have added the following - showing the list of masked email address on the account registration page: https://steemyy.com/reg.php
I have recently identified an account registration that the email fails to send - and thus, it would be nice to keep an eye on the list in case you are awaiting emails.
If you register an account, but fail somehow in the process, you can contact me via justyy AT zoho.com or send me a message on steem blockchain.
The emails will never be discloused and are only used later in case of Account Recovery - to prove the ownership of the accounts.
It is a Javascript code that runs on the CloudFlare edges (more than 200 network centers). The network is the computing. When requests are received, the Node will send a ‘ping’ request to a few nodes, and whoever returns first win the request.
See this on the CloudFlare worker debugging console - the remote virtual debugger.
But all those work are behind the scenes. The user will not see these details, and the Load Balancer is just working fine - and it indicates the actual Node that served the requests via the Response’ custom header origin
When SteemMonster moved away from Steem, I noticed that the number of transactions in a block has been drastically reduced.
That is not good, the number of transactions shows the activity on the steem blockchain, in a way indicates how popular our chain is.
With a little help, I am able to see how many blocks are having zero transactions in the last 24 hours, 7 days, and 2 weeks.
1 2 3 4 5 6
select count(1) from witnessblocks where number=0 and time>=datetime("now", "-1 day"); select count(1) from witnessblocks where number=0 and time>=datetime("now", "-7 day"); select count(1) from witnessblocks where number=0 and time>=datetime("now", "-14 day"); select count(1) from witnessblocks where number>0 and time>=datetime("now", "-1 day"); select count(1) from witnessblocks where number>0 and time>=datetime("now", "-7 day"); select count(1) from witnessblocks where number>0 and time>=datetime("now", "-14 day");
However, I have not updated for ages, and since the coinmarketcap is no longer working (requires paid subscription), I have decided to make some changes to at lease replace the coin price lookup with coingecko
_thread.start_new_thread( thread_proc, ("Thread-1", "a Number") ) _thread.start_new_thread( thread_proc, ("Thread-2", "a Number") )
Unfortunately, the above threads may not finish (and be aborted) before the main script is terminated. Because we are not synchronize the threads yet. We can however, do an easy trick:
1 2
while True: pass
This endless loop will allow all threads to forcibly joining but the script hangs until we Ctrl+C or kill it. We can use the threading module but that requires us to write a Thread class that inherits the threading.Thread.
We can uset the threading.Event() to join the threads. For example:
_thread.start_new_thread( thread_proc, (evt1, "Thread-1", "a Number") ) _thread.start_new_thread( thread_proc, (evt2, "Thread-2", "a Number") )
evt1.wait() evt2.wait()
Multithreading Requests to API Server using Python’s _threading Module
Let’s launch 100 threads that sends concurrent requests to a the Load Balancer Node https://steem.justyy.workers.dev. And we need to store the threading.Event() in an array so that we can join all threads.
import _thread
import threading
import json
import requests
from random import randrange
def worker(evt, threadName, block):
data = {"jsonrpc":"2.0", "method":"condenser_api.get_block", "params":[block], "id":1}
r = requests.post(url="https://steem.justyy.workers.dev",json=data)
rjson = r.json()
result = rjson["result"]
print(threadName, len(result["transactions"]))
evt.set()
try:
threads = []
for i in range(100):
evt = threading.Event()
threads.append(evt)
_thread.start_new_thread( worker, (evt, "Thead-" + str(i), randrange(1, 40000000)) )
for i in threads:
i.wait()
except:
print("Error2")
As expected, it will show the following:
I have also tried other nodes, and the result seems to me that all nodes can handle multiple requests at the same time from the same origin.