-
Notifications
You must be signed in to change notification settings - Fork 4
Use same load balancing policy as fortis-services #118
Conversation
jcjimenez
left a 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.
LGTM with question regarding copy-pasted code.
|
|
||
| /** | ||
| * Copy-pasted version of DefaultConnectionFactory to over-write the load balancing policy | ||
| * There is only one change called out by START/END comments below |
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 if we do something like this instead of copy-pasting so much code?
class FortisConnectionFactory extends CassandraConnectionFactory {
override def createCluster(conf: CassandraConnectorConf): Cluster = {
val lbp = new TokenAwarePolicy(new DCAwareRoundRobinPolicy.Builder().build())
DefaultConnectionFactory.clusterBuilder(conf).withLoadBalancingPolicy(lbp).build()
}
}
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.
Nice one. Fixed in e86952b.
|
Our tests pass but running this in Spark actually crashes: This is because for a Scala object (not class), Fixed this in 2f382aa. |
db9c4e7 to
e86952b
Compare
For some reason we're seeing ~80ms write times from fortis-services to Cassandra but multi-second write times from fortis-spark to Cassandra. One of the differences between the two setups is that fortis-services uses the NodeJS connector which has a different default load-balancing policy than the Spark connector used in fortis-spark which assumes that Spark workers and Cassandra nodes are co-located on the same hosts (which is not the case in our deployment). This change makes the setup consistent so that both projects use the same load-balancing policy.
e86952b to
2f382aa
Compare
|
This is a ~50% performance improvement over the previous implementation but still orders of magnitude slower than it should be. |
For some reason we're seeing ~80ms write times from fortis-services to Cassandra but multi-second write times from fortis-spark to Cassandra.
One of the differences between the two setups is that fortis-services uses the NodeJS connector which has a different default load-balancing policy than the Spark connector used in fortis-spark which assumes that Spark workers and Cassandra nodes are co-located on the same hosts (which is not the case in our deployment). This change makes the setup consistent so that both projects use the same load-balancing policy.