-
Notifications
You must be signed in to change notification settings - Fork 310
Performance overhead of ReactiveCassandraTemplate #1218
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
Comments
After a first investigation, the main difference comes from the fact of using the |
Upon further investigation, it seems that Cassandra is the fastest write-store that we currently support. Disabling the database interaction helped to reveal a few things that didn't bubble up because the actual database was so slow in other Spring Data modules so we never noticed these. We've identified a few things that we could optimize:
Applying these changes I can yield now about 60000 inserts/sec (without Cassandra, with Cassandra about 16000 which is close to 18726 using plain CQL). The overhead in performance drag becomes way smaller and if you consider what |
During the analysis of object allocations a method became visible that constructs an |
We now cache the outcome for column types, AnnotatedType lookuop by annotation and bypass the conversion service by considering primitive type wrappers in the assignability check. Closes #1218
We now cache the outcome for column types, AnnotatedType lookuop by annotation and bypass the conversion service by considering primitive type wrappers in the assignability check. Closes #1218
Use ClassUtils.isAssignableValue(…) instead of ClassUtils.resolvePrimitiveIfNecessary(target).isAssignableFrom(…). Closes #1218
Use ClassUtils.isAssignableValue(…) instead of ClassUtils.resolvePrimitiveIfNecessary(target).isAssignableFrom(…). Closes #1218
Use ClassUtils.isAssignableValue(…) instead of ClassUtils.resolvePrimitiveIfNecessary(target).isAssignableFrom(…). Closes #1218
As brought to light from someone on the Gitter channel, it appears there is a significant performance overhead for query flows that use the ReactiveCassandraTemplate. Notably this includes the reactive @'Repository classes.
The throughput test ran compared writing using ReactiveCassandraRepository::insert vs ReactiveCqlTemplate::execute (cql, args). Local testing gave the following results (writes per second):
As you can see there is a significant difference.
I have tried the test with prepared statements both enabled and disabled and it makes little difference. CPU profiling shows no hotspots for the repository inserts and no discernible difference in the overall profiles. Could it be the mapping layer that builds the statements? I will continue to dig into possibilities.
The test showing the throughput difference can be found here (credits to original author piddubnyi): https://github.com/samueldlightfoot/spring-data-cassandra-performnace
Here are the JProfiler snapshots for runs of both for anyone interested (I may be missing something in my analysis):
Spring Data Performance.zip
Entity:
Repository:
Runner:
The text was updated successfully, but these errors were encountered: