Merge branch 'release-0.6' into develop
This commit is contained in:
commit
c31896a290
87
README.rst
87
README.rst
@ -50,52 +50,75 @@ testnets, of course.
|
|||||||
Implementation
|
Implementation
|
||||||
==============
|
==============
|
||||||
|
|
||||||
ElectrumX does not currently do any pruning. With luck it may never
|
ElectrumX does not do any pruning or throwing away of history. It
|
||||||
become necessary. So how does it achieve a much more compact database
|
will retain this property for as long as feasible, and I believe it is
|
||||||
than Electrum server, which prunes a lot of hisory, and also sync
|
efficiently achievable for the forseeable future with plain Python.
|
||||||
faster?
|
|
||||||
|
|
||||||
All of the following likely play a part:
|
So how does it achieve a much more compact database than Electrum
|
||||||
|
server, which is forced to prune hisory for busy addresses, and yet
|
||||||
|
sync roughly 2 orders of magnitude faster?
|
||||||
|
|
||||||
|
I believe all of the following play a part:
|
||||||
|
|
||||||
- aggressive caching and batching of DB writes
|
- aggressive caching and batching of DB writes
|
||||||
- more compact representation of UTXOs, the address index, and
|
- more compact and efficient representation of UTXOs, address index,
|
||||||
history. Electrum server stores full transaction hash and height
|
and history. Electrum-Server stores full transaction hash and
|
||||||
for all UTXOs. In its pruned history it does the same. ElectrumX
|
height for each UTXO, and does the same in its pruned history. In
|
||||||
just stores the transaction number in the linear history of
|
contrast ElectrumX just stores the transaction number in the linear
|
||||||
transactions. For at least another 5 years the transaction number
|
history of transactions. For at least another 5 years this
|
||||||
will fit in a 4-byte integer. ElectrumX calculates the height from
|
transaction number will fit in a 4-byte integer, and when necessary
|
||||||
a simple lookup in a linear array which is stored on disk.
|
expanding to 5 or 6 bytes is trivial. ElectrumX can determine block
|
||||||
ElectrumX also stores transaction hashes in a linear array on disk.
|
height from a simple binary search of tx counts stored on disk.
|
||||||
- storing static append-only metadata which is indexed by position on
|
ElectrumX stores historical transaction hashes in a linear array on
|
||||||
disk rather than in levelDB. It would be nice to do this for histories
|
disk.
|
||||||
but I cannot think how they could be easily indexable on a filesystem.
|
- placing static append-only metadata indexable by position on disk
|
||||||
- avoiding unnecessary or redundant computations
|
rather than in levelDB. It would be nice to do this for histories
|
||||||
- more efficient memory usage
|
but I cannot think of a way.
|
||||||
- asyncio and asynchronous prefetch of blocks.
|
- avoiding unnecessary or redundant computations, such as converting
|
||||||
|
address hashes to human-readable ASCII strings with expensive bignum
|
||||||
|
arithmetic, and then back again.
|
||||||
|
- better choice of Python data structures giving lower memory usage as
|
||||||
|
well as faster traversal
|
||||||
|
- leveraging asyncio for asynchronous prefetch of blocks to mostly
|
||||||
|
eliminate CPU idling. As a Python program ElectrumX is unavoidably
|
||||||
|
single-threaded in its essence; we must keep that CPU core busy.
|
||||||
|
|
||||||
ElectrumX should not have any need of threads.
|
Python's asyncio means ElectrumX has no (direct) use for threads and
|
||||||
|
associated complications. I cannot foresee any case where they might
|
||||||
|
be necessary.
|
||||||
|
|
||||||
|
|
||||||
Roadmap
|
Roadmap Pre-1.0
|
||||||
=======
|
===============
|
||||||
|
|
||||||
- come up with UTXO root logic and implement it
|
- minor code cleanups
|
||||||
- test a few more performance improvement ideas
|
- minor additions of missing functionality
|
||||||
- implement light caching of client responses
|
- logging improvements, mostly post-sync. Pre-sync logs seem decent.
|
||||||
- yield during expensive requests and/or penalize the connection
|
- at most 1 more DB format change; I will make a weak attempt to
|
||||||
|
retain 0.6 release's DB format if possible
|
||||||
|
- provision of configurable ways to limit client connections so as to
|
||||||
|
mitigate intentional or unintentional degradation of server response
|
||||||
|
time to other clients. Based on IRC discussion this will likely be a
|
||||||
|
combination of address subscription and bandwidth limits.
|
||||||
|
|
||||||
|
|
||||||
|
Roadmap Post-1.0
|
||||||
|
================
|
||||||
|
|
||||||
|
- UTXO root logic and implementation
|
||||||
- improve DB abstraction so LMDB is not penalized
|
- improve DB abstraction so LMDB is not penalized
|
||||||
|
- investigate effects of cache defaults and DB configuration defaults
|
||||||
|
on sync time and simplify / optimize the default config accordingly
|
||||||
- potentially move some functionality to C or C++
|
- potentially move some functionality to C or C++
|
||||||
|
|
||||||
The above are in no particular order.
|
|
||||||
|
|
||||||
|
|
||||||
Database Format
|
Database Format
|
||||||
===============
|
===============
|
||||||
|
|
||||||
The database and metadata formats of ElectrumX are certain to change
|
The database and metadata formats of ElectrumX are likely to change.
|
||||||
in the future. Such a change will render old DBs unusable. For now I
|
Such changes will render old DBs unusable. At least until 1.0 I do
|
||||||
do not intend to provide converters as this is still non-production
|
not intend to provide converters; moreover from-genesis sync time to
|
||||||
software. Moreover from-genesis sync time is quite bearable.
|
create a pristine database is quite tolerable.
|
||||||
|
|
||||||
|
|
||||||
Miscellany
|
Miscellany
|
||||||
|
|||||||
@ -1,3 +1,24 @@
|
|||||||
|
version 0.6.0
|
||||||
|
-------------
|
||||||
|
|
||||||
|
- DB format has changed again. This doesn't give a performance gain
|
||||||
|
or reduction that I could measure, but is cleaner in that each table
|
||||||
|
entry is now a singleton and not an array, which I much prefer as a
|
||||||
|
cleaner solution. It may enable other goodness in the future.
|
||||||
|
- Logging is much less noisy when serving clients. In fact anything
|
||||||
|
in your logs that isn't just status updates probably is a bug that I
|
||||||
|
would like to know about. Unfortunately clean shutdown whilst
|
||||||
|
serving clients leads to massive log spew. This is harmless and I
|
||||||
|
believe because of my noob status with asyncio. I intend to fix
|
||||||
|
this in a nearby release.
|
||||||
|
- expensive client requests are intended to yield to other requests
|
||||||
|
sufficiently frequently that there should be no noticeable delays or
|
||||||
|
pauses under normal load from hog clients.
|
||||||
|
- Notifications to hog clients are now queued in sequence with their
|
||||||
|
request responses. They used to be sent immediately regardless of
|
||||||
|
pending requests which seems less than ideal.
|
||||||
|
- some trivial improvements and fixes to local RPC query output
|
||||||
|
|
||||||
version 0.5.1
|
version 0.5.1
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
VERSION = "ElectrumX 0.5.1"
|
VERSION = "ElectrumX 0.6.0"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user