-
Bug
-
Resolution: Done
-
Critical
-
7.2.0.CD14, 7.1.5.CR2
io.undertow.servlet.spec.ServletRegistrationImpl.addMapping is O( n ) for the number of servlets as it iterates through the full list of them to be able to check all their mappings:
public Set<String> addMapping(final String... urlPatterns) { DeploymentInfo deploymentInfo = deployment.getDeploymentInfo(); final Set<String> ret = new HashSet<>(); final Set<String> existing = new HashSet<>(); for (ServletInfo s : deploymentInfo.getServlets().values()) { if (!s.getName().equals(servletInfo.getName())) { existing.addAll(s.getMappings()); } } for (String pattern : urlPatterns) { if (existing.contains(pattern)) { ret.add(pattern); } }
Compared to StandardWrapperFacade.addMapping in JBossWeb Tomcat, which just checks the given urlPatterns against a maintained map of existing pattern/name pairs, this does not perform or scale as well with high servlet/jsp counts (thousands):
public Set<String> addMapping(String... urlPatterns) { Set<String> conflicts = new HashSet<String>(); if (!((Context) wrapper.getParent()).isStarting()) { throw MESSAGES.cannotAddServletRegistrationAfterInit(((Context) wrapper.getParent()).getPath()); } if (urlPatterns == null || urlPatterns.length == 0) { throw MESSAGES.invalidServletRegistrationArguments(); } for (String urlPattern : urlPatterns) { Context context = ((Context) wrapper.getParent()); String wrapperName = context.findServletMapping(urlPattern); if (wrapperName != null) { Wrapper servletWrapper = (Wrapper) context.findChild(wrapperName); if (servletWrapper.isOverridable()) { // Some Wrappers (from global and host web.xml) may be // overridden rather than generating a conflict context.removeServletMapping(urlPattern); } else { conflicts.add(urlPattern); } } }
- clones
-
JBEAP-15583 [GSS](7.2.z) ServletRegistrationImpl.addMapping processing time increases with servlet counts
- Closed
- is incorporated by
-
JBEAP-15370 (7.1.z) Upgrade undertow from 1.4.18.SP9 to 1.4.18.SP11
- Closed
- is related to
-
UNDERTOW-1418 ServletRegistrationImpl.addMapping processing time increases with servlet counts
- Resolved