Skip to content

Commit 25a2da7

Browse files
authored
Update Cassandra TTL behavior (#9371)
* `IAmAlive` writes when TTL is configured were unintentionally using a cluster-wide LWT. This caused Cassandra performance issues even with a modest (few dozen) silos trying to start, so we allow this update to be `LocalSerial` instead to improve performance.
1 parent 268f8af commit 25a2da7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Cassandra/Orleans.Clustering.Cassandra/OrleansQueries.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,10 @@ UPDATE membership
197197
IF
198198
version = :expected_version;
199199
""",
200+
// This is ignored because we're creating a LWT
200201
MembershipWriteConsistencyLevel);
201202

202-
return _updateIAmAliveWithTtlPreparedStatement.Bind(new
203+
BoundStatement updateIAmAliveTimeWithTtL = _updateIAmAliveWithTtlPreparedStatement.Bind(new
203204
{
204205
partition_key = clusterIdentifier,
205206
// The same version still needs to be written, to update its cell-level TTL
@@ -217,6 +218,10 @@ UPDATE membership
217218
// But we still check that the version was the same during the update so we don't stomp on another update
218219
expected_version = existingVersion.Version,
219220
});
221+
222+
// To improve performance, we allow IAmAlive updates to be LocalSerial
223+
updateIAmAliveTimeWithTtL.SetSerialConsistencyLevel(ConsistencyLevel.LocalSerial);
224+
return updateIAmAliveTimeWithTtL;
220225
}
221226

222227
public async ValueTask<IStatement> DeleteMembershipEntry(string clusterIdentifier, MembershipEntry membershipEntry)

0 commit comments

Comments
 (0)