[GitHub] [tomcat] rmaucher commented on a change in pull request #354: Optimize Server startup time using multi-threading for annotation scanning

2020-09-12 Thread GitBox


rmaucher commented on a change in pull request #354:
URL: https://github.com/apache/tomcat/pull/354#discussion_r486924037



##
File path: java/org/apache/catalina/startup/LocalStrings_fr.properties
##
@@ -69,6 +69,7 @@ contextConfig.missingRealm=Aucun royaume (realm) n'a été 
configuré pour réal
 contextConfig.processAnnotationsDir.debug=Balayage du répertoire pour trouver 
des fichiers de classe avec annotations [{0}]
 contextConfig.processAnnotationsJar.debug=Analyse du fichier jars pour des 
classes annotées avec [{0}]
 contextConfig.processAnnotationsWebDir.debug=Balayage du répertoire 
d''applications web, pour fichiers de classe avec annotations [{0}]
+contextConfig.processAnnotationsInParallelFailure=exécution parallèle a échoué

Review comment:
   Yes, the translation is meh. As a rule, I'd say never commit any 
localization IMO, just let others handle in with poeditor later.

##
File path: java/org/apache/catalina/startup/LocalStrings_fr.properties
##
@@ -69,6 +69,7 @@ contextConfig.missingRealm=Aucun royaume (realm) n'a été 
configuré pour réal
 contextConfig.processAnnotationsDir.debug=Balayage du répertoire pour trouver 
des fichiers de classe avec annotations [{0}]
 contextConfig.processAnnotationsJar.debug=Analyse du fichier jars pour des 
classes annotées avec [{0}]
 contextConfig.processAnnotationsWebDir.debug=Balayage du répertoire 
d''applications web, pour fichiers de classe avec annotations [{0}]
+contextConfig.processAnnotationsInParallelFailure=exécution parallèle a échoué

Review comment:
   Yes, the translation is meh. As a rule, I'd say never commit any 
localization IMO, just let others handle in with poeditor later.

##
File path: java/org/apache/catalina/startup/LocalStrings_fr.properties
##
@@ -69,6 +69,7 @@ contextConfig.missingRealm=Aucun royaume (realm) n'a été 
configuré pour réal
 contextConfig.processAnnotationsDir.debug=Balayage du répertoire pour trouver 
des fichiers de classe avec annotations [{0}]
 contextConfig.processAnnotationsJar.debug=Analyse du fichier jars pour des 
classes annotées avec [{0}]
 contextConfig.processAnnotationsWebDir.debug=Balayage du répertoire 
d''applications web, pour fichiers de classe avec annotations [{0}]
+contextConfig.processAnnotationsInParallelFailure=exécution parallèle a échoué

Review comment:
   Yes, the translation is meh. As a rule, I'd say never commit any 
localization IMO, just let others handle in with poeditor later.

##
File path: java/org/apache/catalina/startup/LocalStrings_fr.properties
##
@@ -69,6 +69,7 @@ contextConfig.missingRealm=Aucun royaume (realm) n'a été 
configuré pour réal
 contextConfig.processAnnotationsDir.debug=Balayage du répertoire pour trouver 
des fichiers de classe avec annotations [{0}]
 contextConfig.processAnnotationsJar.debug=Analyse du fichier jars pour des 
classes annotées avec [{0}]
 contextConfig.processAnnotationsWebDir.debug=Balayage du répertoire 
d''applications web, pour fichiers de classe avec annotations [{0}]
+contextConfig.processAnnotationsInParallelFailure=exécution parallèle a échoué

Review comment:
   Yes, the translation is meh. As a rule, I'd say never commit any 
localization IMO, just let others handle in with poeditor later.

##
File path: java/org/apache/catalina/startup/LocalStrings_fr.properties
##
@@ -69,6 +69,7 @@ contextConfig.missingRealm=Aucun royaume (realm) n'a été 
configuré pour réal
 contextConfig.processAnnotationsDir.debug=Balayage du répertoire pour trouver 
des fichiers de classe avec annotations [{0}]
 contextConfig.processAnnotationsJar.debug=Analyse du fichier jars pour des 
classes annotées avec [{0}]
 contextConfig.processAnnotationsWebDir.debug=Balayage du répertoire 
d''applications web, pour fichiers de classe avec annotations [{0}]
+contextConfig.processAnnotationsInParallelFailure=exécution parallèle a échoué

Review comment:
   Yes, the translation is meh. As a rule, I'd say never commit any 
localization IMO, just let others handle in with poeditor later.

##
File path: java/org/apache/catalina/startup/LocalStrings_fr.properties
##
@@ -69,6 +69,7 @@ contextConfig.missingRealm=Aucun royaume (realm) n'a été 
configuré pour réal
 contextConfig.processAnnotationsDir.debug=Balayage du répertoire pour trouver 
des fichiers de classe avec annotations [{0}]
 contextConfig.processAnnotationsJar.debug=Analyse du fichier jars pour des 
classes annotées avec [{0}]
 contextConfig.processAnnotationsWebDir.debug=Balayage du répertoire 
d''applications web, pour fichiers de classe avec annotations [{0}]
+contextConfig.processAnnotationsInParallelFailure=exécution parallèle a échoué

Review comment:
   Yes, the translation is meh. As a rule, I'd say never commit any 
localization IMO, just let others handle in with poeditor later.





This is an automated message from the 

[GitHub] [tomcat] rmaucher commented on a change in pull request #354: Optimize Server startup time using multi-threading for annotation scanning

2020-09-12 Thread GitBox


rmaucher commented on a change in pull request #354:
URL: https://github.com/apache/tomcat/pull/354#discussion_r486924037



##
File path: java/org/apache/catalina/startup/LocalStrings_fr.properties
##
@@ -69,6 +69,7 @@ contextConfig.missingRealm=Aucun royaume (realm) n'a été 
configuré pour réal
 contextConfig.processAnnotationsDir.debug=Balayage du répertoire pour trouver 
des fichiers de classe avec annotations [{0}]
 contextConfig.processAnnotationsJar.debug=Analyse du fichier jars pour des 
classes annotées avec [{0}]
 contextConfig.processAnnotationsWebDir.debug=Balayage du répertoire 
d''applications web, pour fichiers de classe avec annotations [{0}]
+contextConfig.processAnnotationsInParallelFailure=exécution parallèle a échoué

Review comment:
   Yes, the translation is meh. As a rule, I'd say never commit any 
localization IMO, just let others handle in with poeditor later.

##
File path: java/org/apache/catalina/startup/LocalStrings_fr.properties
##
@@ -69,6 +69,7 @@ contextConfig.missingRealm=Aucun royaume (realm) n'a été 
configuré pour réal
 contextConfig.processAnnotationsDir.debug=Balayage du répertoire pour trouver 
des fichiers de classe avec annotations [{0}]
 contextConfig.processAnnotationsJar.debug=Analyse du fichier jars pour des 
classes annotées avec [{0}]
 contextConfig.processAnnotationsWebDir.debug=Balayage du répertoire 
d''applications web, pour fichiers de classe avec annotations [{0}]
+contextConfig.processAnnotationsInParallelFailure=exécution parallèle a échoué

Review comment:
   Yes, the translation is meh. As a rule, I'd say never commit any 
localization IMO, just let others handle in with poeditor later.

##
File path: java/org/apache/catalina/startup/LocalStrings_fr.properties
##
@@ -69,6 +69,7 @@ contextConfig.missingRealm=Aucun royaume (realm) n'a été 
configuré pour réal
 contextConfig.processAnnotationsDir.debug=Balayage du répertoire pour trouver 
des fichiers de classe avec annotations [{0}]
 contextConfig.processAnnotationsJar.debug=Analyse du fichier jars pour des 
classes annotées avec [{0}]
 contextConfig.processAnnotationsWebDir.debug=Balayage du répertoire 
d''applications web, pour fichiers de classe avec annotations [{0}]
+contextConfig.processAnnotationsInParallelFailure=exécution parallèle a échoué

Review comment:
   Yes, the translation is meh. As a rule, I'd say never commit any 
localization IMO, just let others handle in with poeditor later.





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:
us...@infra.apache.org



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



[GitHub] [tomcat] rmaucher commented on a change in pull request #354: Optimize Server startup time using multi-threading for annotation scanning

2020-09-11 Thread GitBox


rmaucher commented on a change in pull request #354:
URL: https://github.com/apache/tomcat/pull/354#discussion_r486924037



##
File path: java/org/apache/catalina/startup/LocalStrings_fr.properties
##
@@ -69,6 +69,7 @@ contextConfig.missingRealm=Aucun royaume (realm) n'a été 
configuré pour réal
 contextConfig.processAnnotationsDir.debug=Balayage du répertoire pour trouver 
des fichiers de classe avec annotations [{0}]
 contextConfig.processAnnotationsJar.debug=Analyse du fichier jars pour des 
classes annotées avec [{0}]
 contextConfig.processAnnotationsWebDir.debug=Balayage du répertoire 
d''applications web, pour fichiers de classe avec annotations [{0}]
+contextConfig.processAnnotationsInParallelFailure=exécution parallèle a échoué

Review comment:
   Yes, the translation is meh. As a rule, I'd say never commit any 
localization IMO, just let others handle in with poeditor later.





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:
us...@infra.apache.org



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



[GitHub] [tomcat] rmaucher commented on a change in pull request #354: Optimize Server startup time using multi-threading for annotation scanning

2020-09-08 Thread GitBox


rmaucher commented on a change in pull request #354:
URL: https://github.com/apache/tomcat/pull/354#discussion_r485121593



##
File path: java/org/apache/catalina/mbeans/MBeanFactory.java
##
@@ -490,6 +491,7 @@ public String createStandardContext(String parent,
 public String createStandardHost(String parent, String name,
  String appBase,
  boolean autoDeploy,
+ boolean parallelAnnotationScanning,

Review comment:
   This is not enough to justify changing this API. You can create the 
host, then set the flag just after. Good enough.





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:
us...@infra.apache.org



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



[GitHub] [tomcat] rmaucher commented on a change in pull request #354: Optimize Server startup time using multi-threading for annotation scanning

2020-09-07 Thread GitBox


rmaucher commented on a change in pull request #354:
URL: https://github.com/apache/tomcat/pull/354#discussion_r484426457



##
File path: java/org/apache/catalina/startup/ContextConfig.java
##
@@ -122,6 +126,11 @@
 
 private static final Log log = LogFactory.getLog(ContextConfig.class);
 
+private static final int DEFAULT_CLASS_CACHE_SIZE = 16384;
+
+private static final float DEFAULT_LOAD_FACTOR = .75f;
+
+private static int CONCURRENCY_LEVEL = 1;

Review comment:
   Ok for the map size, maybe (it seems very large, 16k classes ?), I don't 
quite see the point of the rest. The concurrency may be up to the utility 
executor thread count, and I don't think this is an optimization which makes 
any difference.

##
File path: java/org/apache/catalina/startup/ContextConfig.java
##
@@ -1374,7 +1383,19 @@ protected void webConfig() {
 protected void processClasses(WebXml webXml, Set orderedFragments) 
{
 // Step 4. Process /WEB-INF/classes for annotations and
 // @HandlesTypes matches
-Map javaClassCache = new HashMap<>();
+
+Map javaClassCache;
+
+if (context.getParent() instanceof Host) {
+   Host host = (Host) context.getParent();
+Container container = host.getParent();
+CONCURRENCY_LEVEL = container.getStartStopThreads();
+javaClassCache = new ConcurrentHashMap<>(DEFAULT_CLASS_CACHE_SIZE, 
DEFAULT_LOAD_FACTOR,
+CONCURRENCY_LEVEL);
+} else {
+javaClassCache = new ConcurrentHashMap<>(DEFAULT_CLASS_CACHE_SIZE, 
DEFAULT_LOAD_FACTOR,
+CONCURRENCY_LEVEL);
+}

Review comment:
   Well, if it's changed to be always a ConcurrentHashMap, it probably 
won't be a measurable performance difference.

##
File path: java/org/apache/catalina/startup/ContextConfig.java
##
@@ -2136,26 +2157,98 @@ protected InputSource getWebXmlSource(String filename, 
boolean global) {
 }
 
 protected void processAnnotations(Set fragments,
-boolean handlesTypesOnly, Map 
javaClassCache) {
-for(WebXml fragment : fragments) {
-// Only need to scan for @HandlesTypes matches if any of the
-// following are true:
-// - it has already been determined only @HandlesTypes is required
-//   (e.g. main web.xml has metadata-complete="true"
-// - this fragment is for a container JAR (Servlet 3.1 section 8.1)
-// - this fragment has metadata-complete="true"
-boolean htOnly = handlesTypesOnly || !fragment.getWebappJar() ||
-fragment.isMetadataComplete();
-
-WebXml annotations = new WebXml();
-// no impact on distributable
-annotations.setDistributable(true);
-URL url = fragment.getURL();
-processAnnotationsUrl(url, annotations, htOnly, javaClassCache);
-Set set = new HashSet<>();
-set.add(annotations);
-// Merge annotations into fragment - fragment takes priority
-fragment.merge(set);
+boolean handlesTypesOnly, Map 
javaClassCache) {
+
+if (context.getParent() instanceof Host && ((Host) 
context.getParent()).isParallelAnnotationScanning()) {
+processAnnotationsInParallel(fragments, handlesTypesOnly, 
javaClassCache);
+return;
+}
+
+for (WebXml fragment : fragments) {
+scanWebXmlFragment(handlesTypesOnly, fragment, javaClassCache);
+}
+}
+
+private void scanWebXmlFragment(boolean handlesTypesOnly, WebXml fragment, 
Map javaClassCache) {
+
+// Only need to scan for @HandlesTypes matches if any of the
+// following are true:
+// - it has already been determined only @HandlesTypes is required
+//   (e.g. main web.xml has metadata-complete="true"
+// - this fragment is for a container JAR (Servlet 3.1 section 8.1)
+// - this fragment has metadata-complete="true"
+boolean htOnly = handlesTypesOnly || !fragment.getWebappJar() ||
+fragment.isMetadataComplete();
+
+WebXml annotations = new WebXml();
+// no impact on distributable
+annotations.setDistributable(true);
+URL url = fragment.getURL();
+processAnnotationsUrl(url, annotations, htOnly, javaClassCache);
+Set set = new HashSet<>();
+set.add(annotations);
+// Merge annotations into fragment - fragment takes priority
+fragment.merge(set);
+}
+
+/**
+ * Executable task to scan a segment for annotations. Each task does the
+ * same work as the for loop inside processAnnotations();
+ *
+ * @author Engebretson, John
+ * @author Kamnani, Jatin
+ */
+private class AnnotationScanTask implements Callable {
+private final WebXml fragment;
+private final boolean handlesTypesOnly;
+