This repository has been archived by the owner on Aug 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 370
Create a tool that counts the size of each column family #936
Comments
IOTA Related information: GUI tools to manage rocksDB:
|
First Results: Each Column Family size in Percent
|
Crude code for future use: @Test
public void profileDBSectionsSize() throws Exception {
RocksDBPersistenceProvider localRocksDBPP = new RocksDBPersistenceProvider("mainnetdb",
"mainnetdb.log",1000);
Tangle localTangle = new Tangle();
localTangle.addPersistenceProvider(localRocksDBPP);
localTangle.init();
long counter;
long size;
List<Long> sizes = new LinkedList<>();
//scan the whole DB to get the size of all the components:
TransactionViewModel tx = TransactionViewModel.first(localTangle);
counter = 0;
while (tx != null) {
if (++counter % 10000 == 0) {
log.info("Scanned {} Transactions", counter);
}
tx = tx.next(localTangle);
}
// Key + Value + Metadata
sizes.add(counter * (Hash.SIZE_IN_BYTES + Transaction.SIZE + 450));
AddressViewModel add = AddressViewModel.first(localTangle);
counter = 0;
size = 0;
while (add != null) {
if (++counter % 10000 == 0) {
log.info("Scanned {} Addresses", counter);
}
size += add.size();
add = add.next(localTangle);
}
// Key + # of entries in each value ( + delimiter)
sizes.add(counter * Hash.SIZE_IN_BYTES + size * (Hash.SIZE_IN_BYTES + 1));
TagViewModel tag = TagViewModel.first(localTangle);
counter = 0;
size = 0;
while (tag != null) {
if (++counter % 10000 == 0) {
log.info("Scanned {} Tags", counter);
}
size += tag.size();
tag = tag.next(localTangle);
}
// Key + # of entries in each value ( + delimiter)
sizes.add(counter * Hash.SIZE_IN_BYTES + size * (Hash.SIZE_IN_BYTES + 1));
ApproveeViewModel approvee = ApproveeViewModel.first(localTangle);
counter = 0;
size = 0;
while (approvee != null) {
if (++counter % 10000 == 0) {
log.info("Scanned {} Approvees", counter);
}
size += approvee.size();
approvee = approvee.next(localTangle);
}
// Key + # of entries in each value ( + delimiter)
sizes.add(counter * Hash.SIZE_IN_BYTES + size * (Hash.SIZE_IN_BYTES + 1));
ApproveeViewModel bundle = ApproveeViewModel.first(localTangle);
counter = 0;
size = 0;
while (bundle != null) {
if (++counter % 10000 == 0) {
log.info("Scanned {} Bundles", counter);
}
size += bundle.size();
bundle = bundle.next(localTangle);
}
// Key + # of entries in each value ( + delimiter)
sizes.add(counter * Hash.SIZE_IN_BYTES + size * (Hash.SIZE_IN_BYTES + 1));
MilestoneViewModel milestone = MilestoneViewModel.first(localTangle);
counter = 0;
while (milestone != null) {
if (++counter % 10000 == 0) {
log.info("Scanned {} Bundles", counter);
}
milestone = milestone.next(localTangle);
}
sizes.add(counter * (Integer.BYTES + Hash.SIZE_IN_BYTES));
MilestoneViewModel milestoneForStateDiff = MilestoneViewModel.first(localTangle);
counter = 0;
size = 0;
while (milestoneForStateDiff != null) {
if (++counter % 10000 == 0) {
log.info("Scanned {} StateDiffs", counter);
}
StateDiffViewModel stateDiff = StateDiffViewModel.load(localTangle, milestoneForStateDiff.getHash());
size += stateDiff.getDiff().size();
milestoneForStateDiff = milestoneForStateDiff.next(localTangle);
}
sizes.add(counter * (Long.BYTES + Hash.SIZE_IN_BYTES) + size * (Long.BYTES + Hash.SIZE_IN_BYTES));
double sum = sizes.stream().reduce((a,b)->a+b).get();
int i = 0;
log.info("----------------------------");
log.info(String.format("transactionBytes: %.2f", sizes.get(i++) / sum * 100));
log.info(String.format("addressBytes: %.2f", sizes.get(i++) / sum * 100));
log.info(String.format("tagBytes: %.2f", sizes.get(i++) / sum * 100));
log.info(String.format("approveeBytes: %.2f", sizes.get(i++) / sum * 100));
log.info(String.format("bundleBytes: %.2f", sizes.get(i++) / sum * 100));
log.info(String.format("milestoneBytes: %.2f", sizes.get(i++) / sum * 100));
log.info(String.format("stateDiffBytes: %.2f", sizes.get(i++) / sum * 100));
log.info(String.format("Total (uncompressed): %.2f GB", sum / 1073741824 /*GB */));
} |
So my conclusion for deleting transaction is:
bottom line: I think we should start w/ only (1.) deleting the Transaction and attending to (4.) |
Any objections to closing this? |
None, it was left open before as @alon-e wanted to put the tool for this in a repo. But I don't think it's a priority to do anytime soon. |
6 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Description
We want to figure out what is the byte size of the data in each of the database column families. The result will be a tool that does the calculation. Use on the LatestDB.
Is there an existing implementation that we can use? KeyLoad
Motivation
Help us understand what the priority on the other issues (merge columns) is.
Requirements
The text was updated successfully, but these errors were encountered: