You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/06/03 21:26:27 UTC

[GitHub] [pulsar] ciaocloud opened a new pull request #10819: Log number of seconds it takes the broker to bootstrap

ciaocloud opened a new pull request #10819:
URL: https://github.com/apache/pulsar/pull/10819


   <!--
   ### Contribution Checklist
     
     - Name the pull request in the form "[Issue XYZ][component] Title of the pull request", where *XYZ* should be replaced by the actual issue number.
       Skip *Issue XYZ* if there is no associated github issue for this pull request.
       Skip *component* if you are unsure about which is the best component. E.g. `[docs] Fix typo in produce method`.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
     
     - Each pull request should address only one issue, not mix up code from multiple issues.
     
     - Each commit in the pull request has a meaningful commit message
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
   
   **(The sections below can be removed for hotfixes of typos)**
   -->
   
   *(If this PR fixes a github issue, please add `Fixes #<xyz>`.)*
   
   Fixes #<xyz>
   
   *(or if this PR is one task of a github issue, please add `Master Issue: #<xyz>` to link to the master issue.)*
   
   Master Issue: #<xyz>
   
   ### Motivation
   
   *It would be nice to measure and print the number of seconds it takes the broker to bootstrap.*
   
   <!--- *Explain here the context, and why you're making that change. What is the problem you're trying to solve.* --->
   
   ### Modifications
   
   <!--- *Describe the modifications you've done.* --->
   *Measure and log the elapsed time between the start of pulsar service instance and the broker service ready. *
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   <!--- *(or)*
   
   This change is already covered by existing tests, such as *(please describe tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   --->
   
   ### Does this pull request potentially affect one of the following parts:
   
   *If `yes` was chosen, please highlight the changes*
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API: no
     - The schema: no
     - The default values of configurations: no
     - The wire protocol: no
     - The rest endpoints: no
     - The admin cli options: no
     - Anything that affects deployment: no
   
   ### Documentation
   
     - Does this pull request introduce a new feature? (yes / no) yes
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented) not documented
     - If a feature is not applicable for documentation, explain why?
     - If a feature is not documented yet in this PR, please create a followup issue for adding the documentation
   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] ciaocloud commented on pull request #10819: Log number of seconds it takes the broker to bootstrap

Posted by GitBox <gi...@apache.org>.
ciaocloud commented on pull request #10819:
URL: https://github.com/apache/pulsar/pull/10819#issuecomment-855186606


   > Thanks for your contribution. For this PR, do we need to update docs?
   
   Thank you for asking. As it is a trivial work, I don't think we'll need to update docs.


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Anonymitaet commented on pull request #10819: Log number of seconds it takes the broker to bootstrap

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on pull request #10819:
URL: https://github.com/apache/pulsar/pull/10819#issuecomment-854291630


   Thanks for your contribution. For this PR, do we need to update docs?


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Anonymitaet commented on pull request #10819: Log number of seconds it takes the broker to bootstrap

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on pull request #10819:
URL: https://github.com/apache/pulsar/pull/10819#issuecomment-854291630


   Thanks for your contribution. For this PR, do we need to update docs?


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] cckellogg commented on a change in pull request #10819: Log number of seconds it takes the broker to bootstrap

Posted by GitBox <gi...@apache.org>.
cckellogg commented on a change in pull request #10819:
URL: https://github.com/apache/pulsar/pull/10819#discussion_r645648185



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
##########
@@ -801,12 +803,16 @@ public Boolean get() {
                 this.resourceUsageTransportManager = (ResourceUsageTransportManager) object;
             }
 
+            long now = System.currentTimeMills();
+            double elapsedSeconds = (now - serviceStartTime) / 1000d;

Review comment:
       We could use the TimeUnit class to make the conversion for us.
   ```
   final long bootstrapTimeSeconds =
                       TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - startTimestamp);
   ```

##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
##########
@@ -801,12 +803,16 @@ public Boolean get() {
                 this.resourceUsageTransportManager = (ResourceUsageTransportManager) object;
             }
 
+            long now = System.currentTimeMills();
+            double elapsedSeconds = (now - serviceStartTime) / 1000d;
+            
             final String bootstrapMessage = "bootstrap service "
                     + (config.getWebServicePort().isPresent() ? "port = " + config.getWebServicePort().get() : "")
                     + (config.getWebServicePortTls().isPresent() ? ", tls-port = " + config.getWebServicePortTls() : "")
                     + (config.getBrokerServicePort().isPresent() ? ", broker url= " + brokerServiceUrl : "")
                     + (config.getBrokerServicePortTls().isPresent() ? ", broker tls url= " + brokerServiceUrlTls : "");
             LOG.info("messaging service is ready");

Review comment:
       Instead of adding new log we could add to the log above.
   ```
   LOG.info("messaging service is ready bootstrap_seconds={}", bootstrapTimeSeconds)
   ```




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] cckellogg merged pull request #10819: Log number of seconds it takes the broker to bootstrap

Posted by GitBox <gi...@apache.org>.
cckellogg merged pull request #10819:
URL: https://github.com/apache/pulsar/pull/10819


   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org