SunJiFengPlus opened a new issue, #13063:
URL: https://github.com/apache/skywalking/issues/13063

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no 
similar feature requirement.
   
   
   ### Description
   
   In our company's promotion of Skywalking, we found that some project team 
feedback after adding Skywalking-java will make the application startup time 
longer (35s -> 60s). The way to verify this is to use JMeter to continuously 
send Http requests to the application, then record the time and start the 
application again, until JMeter's request no longer return error, then 
calculate the time difference.
   
   I've hardcoded the time spent on the following methods
   - `SkyWalkingAgent#premian` 
   - `SkyWalkingAgent.Transformer#transform` 
   - `ProtectiveShieldMatcher#matches` 
   
   like this
   ```java
       @Override
       public boolean matches(T target) {
           try {
               if (LOGGER.isDebugEnable()) {
                   long start = System.currentTimeMillis();
                   boolean matches = this.matcher.matches(target);
                   COST.addAndGet(System.currentTimeMillis() - start);
                   LOGGER.debug("So far the Byte-buddy matches has took : {} 
ms", COST.get());
                   return matches;
               } else {
                   return this.matcher.matches(target);
               }
           } catch (Throwable t) {
               if (LOGGER.isDebugEnable()) {
                   LOGGER.debug(t, "Byte-buddy occurs exception when match 
type.");
               }
               return false;
           }
       }
   ```
   
   Until the application is able to handle http requests correctly, the most 
time-consuming method is `ProtectiveShieldMatcher#matches`, it cost 16s+
   
   The application contains a large number of classes, mostly prefixed with 
`com.our.company`, which do not need to be enhanced. I got a huge reduction in 
startup time by ignoring this prefixed class in Bytebuddy.
   
   ### Use case
   
   For applications that are sensitive to startup time and require fast 
deployment and scaling, applications are less tolerant of increased startup 
time. Reduce the startup time increase by ignoring classes that enhance the 
specified prefix. This prefix can probably be configured in `agent.config`
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a pull request to implement this on your own?
   
   - [x] Yes I am willing to submit a pull request on my own!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to