-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve start speed via QuickStartWebApp #11
Comments
The
|
Sadly |
I've filed a feature request for the Maven plugin at jetty/jetty.project#9497 . Meanwhile, perhaps I could experiment with the |
I've invoked the generator myself; the speed improvement is not that ground-breaking: 822ms vs 1200ms startup time. Perhaps that's because the classpath scanning runs in parallel on all cores: the performance improvement could be much bigger on a single-core machines (or single-core docker images). The code which generated the file:
Jetty server needs to be started to perform the classpath detection. To configure WebAppContext to reuse the generated
|
The best solution would be if the There's no one-fits-all xml unfortunately since it lists all Vaadin Routes for example, which means that the xml needs to be updated whenever there's a new route; also the xml differs for dev mode and production mode (since production mode doesn't run That being said, I can still add some basic support for quickstart since it will be valuable for native builds. The <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee" metadata-complete="false" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5.0">
<context-param>
<param-name>org.eclipse.jetty.containerInitializers</param-name>
<param-value><![CDATA[
"ContainerInitializer{com.vaadin.flow.server.startup.WebComponentExporterAwareValidator,interested=[],applicable=[],annotated=[]}",
"ContainerInitializer{org.eclipse.jetty.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer,interested=[org.atmosphere.container.JSR356Endpoint],applicable=[],annotated=[]}",
"ContainerInitializer{com.vaadin.flow.server.startup.RouteRegistryInitializer,interested=[com.example.MainView],applicable=[],annotated=[]}",
"ContainerInitializer{com.vaadin.flow.server.startup.WebComponentConfigurationRegistryInitializer,interested=[com.vaadin.flow.component.WebComponentExporterFactory$DefaultWebComponentExporterFactory],applicable=[],annotated=[]}",
"ContainerInitializer{org.eclipse.jetty.websocket.jakarta.client.JakartaWebSocketShutdownContainer,interested=[],applicable=[],annotated=[]}",
"ContainerInitializer{com.vaadin.flow.server.startup.VaadinAppShellInitializer,interested=[com.example.AppShell],applicable=[],annotated=[]}",
"ContainerInitializer{com.vaadin.flow.server.startup.LookupServletContainerInitializer,interested=[com.vaadin.flow.di.LookupInitializer$AppShellPredicateImpl, com.vaadin.flow.router.DefaultRoutePathProvider, com.vaadin.flow.di.LookupInitializer$StaticFileHandlerFactoryImpl, com.vaadin.flow.di.LookupInitializer, com.vaadin.flow.di.LookupInitializer$ResourceProviderImpl, com.vaadin.flow.server.startup.DefaultApplicationConfigurationFactory],applicable=[],annotated=[]}",
"ContainerInitializer{com.vaadin.flow.server.startup.AnnotationValidator,interested=[],applicable=[],annotated=[]}",
"ContainerInitializer{org.atmosphere.cpr.ContainerInitializer,interested=[],applicable=[],annotated=[]}",
"ContainerInitializer{com.vaadin.flow.server.startup.ErrorNavigationTargetInitializer,interested=[com.vaadin.flow.router.RouteNotFoundError, com.vaadin.flow.router.InternalServerError],applicable=[],annotated=[]}",
"ContainerInitializer{org.atmosphere.cpr.AnnotationScanningServletContainerInitializer,interested=[org.atmosphere.annotation.BroadcasterCacheServiceProcessor, org.atmosphere.annotation.AtmosphereHandlerServiceProcessor, org.atmosphere.annotation.BroadcasterListenerServiceProcessor, org.atmosphere.annotation.AtmosphereServiceProcessor, org.atmosphere.annotation.BroadcasterCacheListenererviceProcessor, org.atmosphere.annotation.AtmosphereFrameworkServiceProcessor, org.atmosphere.annotation.AsyncSupportListenerServiceProcessor, org.atmosphere.annotation.WebSocketFactoryServiceProcessor, org.atmosphere.annotation.BroadcasterServiceProcessor, org.atmosphere.annotation.EndpointMapperServiceProcessor, org.atmosphere.annotation.BroadcasterFactoryServiceProcessor, org.atmosphere.annotation.ManagedServiceProcessor, org.atmosphere.annotation.UUIDProviderServiceProcessor, org.atmosphere.annotation.AtmosphereResourceListenerServiceProcessor, org.atmosphere.annotation.BroadcasterCacheInspectorServiceProcessor, org.atmosphere.annotation.AtmosphereInterceptorServiceProcessor, org.atmosphere.annotation.MeteorServiceProcessor, org.atmosphere.annotation.WebSocketProtocolServiceProcessor, org.atmosphere.annotation.BroadcastFilterServiceProcessor, org.atmosphere.annotation.WebSocketProcessorServiceProcessor, org.atmosphere.annotation.AsyncSupportServiceProcessor, org.atmosphere.annotation.WebSocketHandlerServiceProcessor, org.atmosphere.annotation.AtmosphereResourceFactoryServiceProcessor],applicable=[],annotated=[]}"]]></param-value>
</context-param>
<context-param>
<param-name>org.eclipse.jetty.originAttribute</param-name>
<param-value>origin</param-value>
</context-param>
<listener origin="DefaultsDescriptor(jar:file:/home/mavi/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty/jetty-webapp/11.0.14/15e01322cc54172e474357f8ae8dd4ec15e5ed09/jetty-webapp-11.0.14.jar!/org/eclipse/jetty/webapp/webdefault.xml):0">
<listener-class>org.eclipse.jetty.servlet.listener.IntrospectorCleaner</listener-class>
</listener>
<listener origin="@WebListener(com.example.Bootstrap):1">
<listener-class>com.example.Bootstrap</listener-class>
</listener>
<listener origin="@WebListener(com.vaadin.flow.server.startup.ServletContextListeners):2">
<listener-class>com.vaadin.flow.server.startup.ServletContextListeners</listener-class>
</listener>
<listener origin="@WebListener(com.vaadin.flow.server.startup.VaadinAppShellInitializer):3">
<listener-class>com.vaadin.flow.server.startup.VaadinAppShellInitializer</listener-class>
</listener>
<listener>
<listener-class>org.eclipse.jetty.websocket.jakarta.client.JakartaWebSocketShutdownContainer</listener-class>
</listener>
</web-app> I'll add both:
|
Showstopper: if I add the |
Need to revert and remove the jetty-quickstart. Instead I'll document the steps necessary. |
Reopening: the new Jetty Maven plugin needs to be tested; README would benefit from the plugin. |
Jetty's QuickStartWebApp mechanism allow to generate a Jetty config file in build time, which would then remove the need to waste time in classpath scanning in runtime, allowing for far faster startup times.
Couple of links:
The text was updated successfully, but these errors were encountered: