-
Notifications
You must be signed in to change notification settings - Fork 473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move blocking readPair call to boundedElastic thread #1653
base: master
Are you sure you want to change the base?
Conversation
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.
Thanks for your contribution <3
.doOnNext(counters -> readRepair(mailbox, counters)); | ||
.doOnNext(counters -> { | ||
Mono.fromRunnable(() -> { | ||
readRepair(mailbox, counters); |
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.
Can we manage to subscribe here only if read repairs are enabled ie probability > 0 ?
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.
Sure, you mean something like:
.doOnNext(counters -> {
if (probability > 0) {
Mono.fromRunnable(() -> {
readRepair(mailbox, counters);
})
.subscribeOn(Schedulers.boundedElastic())
.subscribe();
}
});
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.
Yes
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.
@chibenwa I'm sorry could you guide how to access probability property here? 🤔
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.
from the configuration
d2c426a
to
dec0b5d
Compare
@@ -170,7 +170,16 @@ public Mono<MailboxCounters> getMailboxCountersReactive(Mailbox mailbox) { | |||
} | |||
return Mono.just(counters); | |||
}) | |||
.doOnNext(counters -> readRepair(mailbox, counters)); | |||
.doOnNext(counters -> { | |||
if (this.cassandraConfiguration.getMailboxReadRepair() > 0) { |
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'm oretty sure it should be
if (this.cassandraConfiguration.getMailboxReadRepair() > 0) { | |
if (this.cassandraConfiguration.getMailboxCountersReadRepair() > 0) { |
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.
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 believe what chibenwa is saying is:
getMailboxReadRepair()
is used inCassandraMailboxMapper
- for
CassandraMessageMapper
, we usegetMailboxCountersReadRepairChanceMax()
and/orgetMailboxCountersReadRepairChanceOneHundred()
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.
Maybe we could extract that line actually in a function to avoid duplication, that we could call from there and from your code change :)
Also read repair could be a good place for pseudo random usage aka non blocking... There is no need for cryptographioc grade randomness for such an application. Maybe otherall this could be a better fix. WDYT? |
Hi! 🙂
We noticed you did a great job in ensuring the reactive modules indeed stay reactive end to end. The mailbox module, however, was discovered to still have a blocking call in
CassandraMessageMapper
class as detected by BlockHound:This PR fixes this code. We also re-ran the tests and verified the performance (in terms of heap usage) before and after the fix:
Before
After