Measure Startup Time of Cassandra Service
As a part of a Research Project, our Lab is running we would like to record the startup time of the Cassandra service, Is there any way I record this data ? (One way I could see I can achieve this is by sniffing if the port is open or closed, But I feel this is not a reliable way)
I couldn't find any standard profiler which could help me with this, Please insist of there is one.
One thing you could do is look for specific messages in the system.log
.
When Cassandra starts-up, the first message is about reading the cassandra.yaml
file:
INFO [main] 2022-01-13 08:32:06,717 YamlConfigurationLoader.java:93 - Configuration location: file:/Users/aaronploetz/local/apache-cassandra-4.0.0/conf/cassandra.yaml
When startup is complete, there is a log message which clearly states this:
INFO [main] 2022-01-13 08:32:11,823 CassandraDaemon.java:780 - Startup complete
Depending on your exact definition of "startup time," you could just look for messages from the CassandraDaemon
. That initially kicks off after the config file loads, but it's the beginning of the Java process actually coming up.
Key on those messages in the log, and you'll also get the times.
If by "profiler" you mean being able to do it programmatically, you can replicate the code in the BootstrapBinaryDisabledTest
class. In the bootstrap()
method, you will see that it checks the logs for the string "Starting listening for CQL clients":
node.logs().watchFor("Starting listening for CQL clients");
A node will only accept requests from CQL clients (applications) on port 9042
(by default) when the initialisation process has completed successfully. For Cassandra 4.0, the log entry looks like:
INFO [main] <date time> PipelineConfigurator.java:125 - Starting listening for CQL clients on /x.x.x.x:9042 (unencrypted)...
For Cassandra 3.11, the log entry looks like:
INFO [main] <date time> Server.java:159 - Starting listening for CQL clients on /x.x.x.x:9042 (unencrypted)...
The startup time for Cassandra is from when the daemon is started until the time that the node is listening for CQL clients. Cheers!