-
Notifications
You must be signed in to change notification settings - Fork 370
Solidify transactions we walk across while doing GTTA #1826
Solidify transactions we walk across while doing GTTA #1826
Conversation
ThreadFactory threadFactory = new ThreadFactoryBuilder() | ||
.setNameFormat(this.getClass().getSimpleName() + " %d") | ||
.build(); | ||
solidExecutor = Executors.newCachedThreadPool(threadFactory); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it needs to be changed to another executor?
Currently we have a limit on the amount of GTTA calls we can make, so this also limits how much solidification we can do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What made you chose this dummy solidifier instead of a null check? Probably same speed after optimizing, but just wondering. I would generally not chose the empty class approach.
Theres no issue linked, but besides that it looks good. CPU load increase makes sense due to more tx requested, but i didn´t check locally. Was the network traffic increasing as well?
About the other executor, lets leave it as is until we notice a problem. We shouldn´t solve problems that don´t exist yet.
Maybe we should consider setting the checkSolidity second parameter to something more sensible instead of defaulting to maximum integer, like 10.000 (called in AsyncTipSelSolidifier.java:43)
You may consider this an approval code wise, but as theres some questions im marking it as comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks like a good stand in. The solidifier will be easily replaced post 1.9.0, and the implementation of said solidifier will be very simple with this setup (basically just replacing a couple lines). Just a couple comments regarding the checkSolidity call as well as the potential memory leak on an unchecked set size.
public void solidify(Hash transactionHash) { | ||
// Don't try to solidify transactions that are in the process of being solidified | ||
//Problem: we are not checking transactions in the past cone here | ||
if (transactionToSolidify.add(transactionHash)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you pointed out this has the potential to get DOS attacked if there is enough power behind the spammers being thrown at the node. Does it make sense maybe to have a limit to the maximum number of objects within the set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I tested this I counted the number of AsyncSolidifier threads created when I bombed the node with Jmeter spam
I think there are more chances of bombing the CPU out before getting an oom from this
solidExecutor.submit(() -> { | ||
try { | ||
log.debug("attempting to solidify transaction {}", transactionHash); | ||
transactionValidator.checkSolidity(transactionHash); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As Brord pointed out, we probably shouldn't allow this to run up to MAX_INTEGER and limit it to something like 10k analysed transactions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will use the same solidification limit as the milestone solidifier
If it is too much here, it is too much for milestones
import com.iota.iri.service.tipselection.TipSelector; | ||
import com.iota.iri.service.tipselection.WalkValidator; | ||
import com.iota.iri.service.tipselection.Walker; | ||
import com.iota.iri.service.tipselection.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really a review on this PR specifically, but can we do something about Codacy freaking out about these kinds of imports?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I know...
I need to find time to take care of this, so much to do...
I am just wired to use polymorphism instead of
Fixed :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
While doing GTTA we will attempt to solidify transactions we walk across.
This will make sure that transactions that we missed out on for whatever reason will solidify
Fixes #1818
Type of change
How Has This Been Tested?
I ran both 1.8.5 and a canary with this change.
I called GTTA in a loop on both with JMETER
GTTA with this change was still faster compared to 1.8.5.
Throughput: 176.662 ops/minute compared to 71.603 ops/minute
However, profiling showed that solidifying takes 30 % of cpu time...
Checklist: