Commit cb745d4e authored by Mateusz Żebrak's avatar Mateusz Żebrak
Browse files

Store single aiohttp.ClientSession - make benefit from keep-alive HTTP feature...

Store single aiohttp.ClientSession - make benefit from keep-alive HTTP feature provided by some proxy servers like jussi

Even though hived/beekeeper itself does not allow for the keep-alive
feature, still when communicating with some mainnet nodes we can benefit
from storing a single session. That's because proxy server might add
the keep-alive HTTP feature itself.

After hive!1363 we can finally implement this behaviour, because aiohttp
will handle the disabled keep-alive by itself and previously it was
unable to detect disabled keep-alive because of hived/beekeeper nodes
not fulfill the RPC specification
(in HTTP/1.1 its required to implicitly put `Connection: close`
header when disabled)

Now we don't have to handle special case for beekepere communication and
for testnet hived communication versus mainnet (jussi) communication.
All work is being done by aiohttp which correctly resuses
session or disables the keep-alive feature.

When communicating with api.hive.blog, during 1 min test (~40 calls)
to UpdateNodeData, I got interesting results - during data harvesting:
- avg in ~0.46s with this commit
- while it was ~0.77s before.
parent 90f14aa5
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment