You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by GitBox <gi...@apache.org> on 2020/08/17 16:17:52 UTC

[GitHub] [tomcat] kamnani opened a new pull request #340: Optimize server startup time

kamnani opened a new pull request #340:
URL: https://github.com/apache/tomcat/pull/340


   Tomcat Takes quite a bit of time to start the server if there are 1000's of Jar's in the class path. This wastes a lot of developer time, where we need to start and stop the server quite often. 
   This pull request has a couple of optimizations that reduces the server startup time : 
   
   1)  Accelerate classloading
   
   *Optimization 1:  *Cache and maintain file handles for each jar.  This adds 1MB of old generation memory but eliminates 100,000,000+ file open/close operations.
   
   *Optimization 2: *Cache the contents of each jar in memory via a Bloom filter.  This adds 1.5MB of old generation memory but eliminates 100,000,000+ archive lookups.
   
   2) Parallelize annotation scans
   
   Tomcat searches the entire classpath for all instances of certain annotations, such as @WebServlet, @WebFilter, @MultipartConfig, etc.  This is performed by scanning each classpath entry sequentially.
   
   *Optimization:  *Scan the jars in parallel.  
   
   


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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] [tomcat] kamnani edited a comment on pull request #340: Optimize server startup time

Posted by GitBox <gi...@apache.org>.
kamnani edited a comment on pull request #340:
URL: https://github.com/apache/tomcat/pull/340#issuecomment-675134104


   1) "Configuration should not be via system properties unless absolutely necessary. In this instance configuration should probably be on the Host." 
   - This configurations here affects the Java behavior, so the reason I mentioned it via the System Property route. Can you be more specific on that? 
   
   2) About the testing, I thought there are already pre-existing tests.  Is there something more specific being scouted for - Always ready to write more testing code.
   
   3)  "It looks like simply deploying those 1000s of JARs into a shared class loader (or $CATALINA_BASE/lib) would achieve the same aim as the cache" 
   - The cache here prevents the searching time from each of the Jars we know the resource might not even be present. If the cache is not there, there will be an overhead time to search the resource even in the Jars where they might not be present (Location really doesn't matter here). 
   
   4) I wonder why thread per core defaults to 1 instead of 2. 
   
   5) "I wonder to what extend the existing WebResources implementation can be tuned - particularly the cache - to achieve the same result." 
   We have two optimizations on that part, one being in the WebResources and the other Is the JarFile handles. The bloom filter approach is the crucial part, since thats where we reduce the JarLookup time. 
   
   6) PR #333 =>  what we have is a very general approach and is independent of Presence or Absence of INDEX.LIST file. i am not too familiar with what they have proposed, but clearly they dont have the Bloom filter and thus relies heavily on the INDEX.LIST files for enhancing the resource lookup. 
   
   


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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] [tomcat] kamnani edited a comment on pull request #340: Optimize server startup time

Posted by GitBox <gi...@apache.org>.
kamnani edited a comment on pull request #340:
URL: https://github.com/apache/tomcat/pull/340#issuecomment-675134104


   1) "Configuration should not be via system properties unless absolutely necessary. In this instance configuration should probably be on the Host." 
   - This configurations here affects the Java behavior, so the reason I mentioned it via the System Property route. Can you be more specific on that? 
   
   2) About the testing, I thought there are already pre-existing tests.  Is there something more specific being scouted for - Always ready to write more testing code.
   
   3)  "It looks like simply deploying those 1000s of JARs into a shared class loader (or $CATALINA_BASE/lib) would achieve the same aim as the cache" 
   - The cache here prevents the searching time from each of the Jars we know the resource might not even be present. If the cache is not there, there will be an overhead time to search the resource even in the Jars where they might not be present (Location really doesn't matter here). 
   
   4) I wonder why thread per core defaults to 1 instead of 2. 
   
   5) "I wonder to what extend the existing WebResources implementation can be tuned - particularly the cache - to achieve the same result." 
   - We have two optimizations on that part, one being in the WebResources and the other Is the JarFile handles. The bloom filter approach is the crucial part, since thats where we reduce the JarLookup time. 
   
   6) PR #333 =>  what we have is a very general approach and is independent of Presence or Absence of INDEX.LIST file. i am not too familiar with what they have proposed, but clearly they dont have the Bloom filter and thus relies heavily on the INDEX.LIST files for enhancing the resource lookup. 
   
   Thank you so much for your time @markt-asf  :) 


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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] [tomcat] kamnani edited a comment on pull request #340: Optimize server startup time

Posted by GitBox <gi...@apache.org>.
kamnani edited a comment on pull request #340:
URL: https://github.com/apache/tomcat/pull/340#issuecomment-675134104


   1) "Configuration should not be via system properties unless absolutely necessary. In this instance configuration should probably be on the Host." 
   - This configurations here affects the Java behavior, so the reason I mentioned it via the System Property route. Can you be more specific on that? 
   
   2) About the testing, I thought there are already pre-existing tests.  Is there something more specific being scouted for - Always ready to write more testing code.
   
   3)  "It looks like simply deploying those 1000s of JARs into a shared class loader (or $CATALINA_BASE/lib) would achieve the same aim as the cache" 
   - The cache here prevents the searching time from each of the Jars we know the resource might not even be present. If the cache is not there, there will be an overhead time to search the resource even in the Jars where they might not be present (Location really doesn't matter here). 
   
   4) I wonder why thread per core defaults to 1 instead of 2. 
   
   5) "I wonder to what extend the existing WebResources implementation can be tuned - particularly the cache - to achieve the same result." 
   - We have two optimizations on that part, one being in the WebResources and the other Is the JarFile handles. The bloom filter approach is the crucial part, since thats where we reduce the JarLookup time. 
   
   6) PR #333 =>  what we have is a very general approach and is independent of Presence or Absence of INDEX.LIST file. i am not too familiar with what they have proposed, but clearly they dont have the Bloom filter and thus relies heavily on the INDEX.LIST files for enhancing the resource lookup. 
   
   


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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] [tomcat] markt-asf commented on pull request #340: Optimize server startup time

Posted by GitBox <gi...@apache.org>.
markt-asf commented on pull request #340:
URL: https://github.com/apache/tomcat/pull/340#issuecomment-684677208


   New PRs #348 and #349 submitted.


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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] [tomcat] markt-asf closed pull request #340: Optimize server startup time

Posted by GitBox <gi...@apache.org>.
markt-asf closed pull request #340:
URL: https://github.com/apache/tomcat/pull/340


   


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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] [tomcat] kamnani commented on pull request #340: Optimize server startup time

Posted by GitBox <gi...@apache.org>.
kamnani commented on pull request #340:
URL: https://github.com/apache/tomcat/pull/340#issuecomment-675134104


   "Configuration should not be via system properties unless absolutely necessary. In this instance configuration should probably be on the Host." 
   This configurations here affects the Java behavior, so the reason I mentioned it via the System Property route. Can you be more specific on that? 
   


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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] [tomcat] kamnani edited a comment on pull request #340: Optimize server startup time

Posted by GitBox <gi...@apache.org>.
kamnani edited a comment on pull request #340:
URL: https://github.com/apache/tomcat/pull/340#issuecomment-675134104


   1) "Configuration should not be via system properties unless absolutely necessary. In this instance configuration should probably be on the Host." 
   - This configurations here affects the Java behavior, so the reason I mentioned it via the System Property route. Can you be more specific on that? 
   
   2) About the testing, I thought there are already pre-existing tests.  Is there something more specific being scouted for - Always ready to write more testing code.
   
   3)  "It looks like simply deploying those 1000s of JARs into a shared class loader (or $CATALINA_BASE/lib) would achieve the same aim as the cache" 
   - The cache here prevents the searching time from each of the Jars we know the resource might not even be present. If the cache is not there, there will be an overhead time to search the resource even in the Jars where they might not be present (Location really doesn't matter here). 
   
   4) I wonder why thread per core defaults to 1 instead of 2. 
   
   5) "I wonder to what extend the existing WebResources implementation can be tuned - particularly the cache - to achieve the same result." 
   - We have two optimizations on that part, one being in the WebResources and the other Is the JarFile handles. The bloom filter approach is the crucial part, since thats where we reduce the JarLookup time. 
   
   6) PR #333 =>  what we have is a very general approach and is independent of Presence or Absence of INDEX.LIST file. i am not too familiar with what they have proposed, but clearly they dont have the Bloom filter and thus relies heavily on the INDEX.LIST files for enhancing the resource lookup. 
   
   Thank you so much for your time :) 


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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org