chibenwa commented on PR #997:
URL: https://github.com/apache/james-project/pull/997#issuecomment-1124482635
Quick local bench for batch on top of CassandraDeletedMessageDAO
DAO modifications:
```
public Mono<Void> addDeleted(CassandraId cassandraId, Flux<MessageUid>
uids) {
return uids.reduce(new BatchStatement(BatchStatement.Type.UNLOGGED),
(batch, uid) ->
batch.add(addStatement.bind()
.setUUID(MAILBOX_ID, cassandraId.asUuid())
.setLong(UID, uid.asLong())))
.flatMap(cassandraAsyncExecutor::executeVoid);
}
```
Original bench:
```
@Test
void bench() {
Flux.range(0, 100000)
.doOnNext(i -> {
if (i % 1000 == 0) {
System.out.println(i);
}
})
.flatMap(i -> testee.addDeleted(MAILBOX_ID, MessageUid.of(i)), 4)
.blockLast();
}
```
Executes in 20s locally. Without specifying concurrency on the flux this is
still 9.2 seconds for an unfair Cassandra query budget consumption.
With batch:
```
@Test
void bench2() {
Flux.range(0, 100000)
.map(MessageUid::of)
.window(1000)
.flatMap(uids -> testee.addDeleted(MAILBOX_ID, uids), 2)
.blockLast();
}
```
Executes in 2.4 seconds.
This tends to prove the benefit of unlogged batch as a performance
improvments when performing multiple inserts to the same primary key as
mentionned by the link above.
We still need gatling confirmation...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]