我是Liferay开发的新手,我在Liferay Tomcat服务器启动时遇到了麻烦。这需要将近3分钟(169048毫秒),这对于开发来说是不可接受的。我想把它降到大约一分钟。
以下是我的机器的规格:
我正在使用:
为了加快速度,我已经:
#disable some filters com.liferay.portal.servlet.filters.sso.cas.CASFilter = false com.liferay.portal.servlet.filters.sso.ntlm.NtlmFilter = false com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter = false com.liferay.portal.servlet.filters.sso.opensso.OpenSSOFilter= false com.liferay.portal.sharepoint.SharepointFilter = false com.liferay.portal.servlet.filters.gzip.GZipFilter = false #disable indexing index.on.startup=false
这是我的启动日志:
Jan 30, 2013 8:39:49 AM org.apache.catalina.core.AprLifecycleListener init INFO: Loaded APR based Apache Tomcat Native library 1.1.24. Jan 30, 2013 8:39:49 AM org.apache.catalina.core.AprLifecycleListener init INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. Jan 30, 2013 8:39:51 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-apr-8080"] Jan 30, 2013 8:39:51 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-apr-8009"] Jan 30, 2013 8:39:51 AM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 2620 ms Jan 30, 2013 8:39:51 AM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Jan 30, 2013 8:39:51 AM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.27 Jan 30, 2013 8:39:51 AM org.apache.catalina.startup.HostConfig deployDescriptor INFO: Deploying configuration descriptor C:\Liferay\portal-6.1.1-ce-ga2\tomcat-7.0.27\conf\Catalina\localhost\Hi-portlet.xml Jan 30, 2013 8:39:51 AM org.apache.catalina.startup.HostConfig deployDescriptor WARNING: A docBase C:\Liferay\portal-6.1.1-ce-ga2\tomcat-7.0.27\webapps\Hi-portlet inside the host appBase has been specified, and will be ignored Jan 30, 2013 8:39:51 AM org.apache.catalina.startup.SetContextPropertiesRule begin WARNING: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Hi-portlet' did not find a matching property. Jan 30, 2013 8:39:52 AM org.apache.catalina.startup.HostConfig deployDescriptor INFO: Deploying configuration descriptor C:\Liferay\portal-6.1.1-ce-ga2\tomcat-7.0.27\conf\Catalina\localhost\ROOT.xml Loading jar:file:/C:/Liferay/portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/system.properties Loading jar:file:/C:/Liferay/portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/portal.properties Loading file:/C:/Liferay/portal-6.1.1-ce-ga2/portal-ide.properties Loading file:/C:/Liferay/portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/classes/portal-developer.properties Loading file:/C:/Liferay/portal-6.1.1-ce-ga2/portal-ext.properties Jan 30, 2013 8:39:59 AM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext 08:40:16,321 INFO [pool-2-thread-1][DialectDetector:71] Determine dialect for HSQL Database Engine 2 08:40:16,330 WARN [pool-2-thread-1][DialectDetector:86] Liferay is configured to use Hypersonic as its database. Do NOT use Hypersonic in production. Hypersonic is an embedded database useful for development and demo'ing purposes. The database settings can be changed in portal-ext.properties. 08:40:16,484 INFO [pool-2-thread-1][DialectDetector:136] Found dialect org.hibernate.dialect.HSQLDialect Starting Liferay Portal Community Edition 6.1.1 CE GA2 (Paton / Build 6101 / July 31, 2012) 08:41:36,974 INFO [pool-2-thread-1][BaseDB:452] Database supports case sensitive queries 08:41:37,828 INFO [pool-2-thread-1][ServerDetector:154] Server supports hot deploy 08:41:37,850 INFO [pool-2-thread-1][PluginPackageUtil:1030] Reading plugin package for the root context 08:42:19,657 INFO [pool-2-thread-1][AutoDeployDir:106] Auto deploy scanner started for C:\Liferay\portal-6.1.1-ce-ga2\deploy 08:42:24,410 INFO [pool-2-thread-1][HotDeployImpl:178] Deploying Hi-portlet from queue 08:42:24,415 INFO [pool-2-thread-1][PluginPackageUtil:1033] Reading plugin package for Hi-portlet Jan 30, 2013 8:42:24 AM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext Jan 30, 2013 8:42:30 AM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring FrameworkServlet 'Remoting Servlet' Jan 30, 2013 8:42:34 AM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory C:\Liferay\portal-6.1.1-ce-ga2\tomcat-7.0.27\webapps\resources-importer-web 08:42:35,522 INFO [pool-2-thread-1][HotDeployImpl:178] Deploying resources-importer-web from queue 08:42:35,523 INFO [pool-2-thread-1][PluginPackageUtil:1033] Reading plugin package for resources-importer-web Jan 30, 2013 8:42:36 AM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext Jan 30, 2013 8:42:36 AM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory C:\Liferay\portal-6.1.1-ce-ga2\tomcat-7.0.27\webapps\welcome-theme 08:42:36,609 INFO [pool-2-thread-1][HotDeployEvent:109] Plugin welcome-theme requires resources-importer-web 08:42:37,305 INFO [pool-2-thread-1][HotDeployImpl:178] Deploying welcome-theme from queue 08:42:37,306 INFO [pool-2-thread-1][PluginPackageUtil:1033] Reading plugin package for welcome-theme Jan 30, 2013 8:42:37 AM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext 08:42:37,787 INFO [pool-2-thread-1][ThemeHotDeployListener:87] Registering themes for welcome-theme 08:42:39,764 INFO [pool-2-thread-1][ThemeHotDeployListener:100] 1 theme for welcome-theme is available for use Jan 30, 2013 8:42:40 AM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-apr-8080"] 08:42:40,167 INFO [liferay/hot_deploy-1][HotDeployMessageListener:142] Group or layout set prototype already exists for company liferay.com Jan 30, 2013 8:42:40 AM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-apr-8009"] Jan 30, 2013 8:42:40 AM org.apache.catalina.startup.Catalina start INFO: Server startup in 169048 ms
有什么建议吗?
答案 0 :(得分:2)
评论已经提供了一些提示。我要说的是,最重要的问题是检查是否使用了虚拟内存(分页) - 只要操作系统必须将内存分页到磁盘,就会丢失:可能会有巨大的性能损失。< / p>
当您升级内存时(例如,如果您点击虚拟内存),您可能需要考虑将操作系统升级到64位操作系统 - 32位只能解决4G问题,您可能会遇到appserver内存限制,因为每个进程只能获得一个有限的记忆。
您还可以测试Liferay在运行这么多其他应用程序之前是否启动得更快 - 这是您在内存问题上遇到的另一个暗示。
SSD选项将进一步加速您的系统,但价格远高于RAM。此外,不建议使用SSD上的虚拟内存 - 它会更快地耗尽驱动器。而不是在SSD上使用虚拟内存,而不是使用虚拟内存 - 这将更快,更便宜。
答案 1 :(得分:0)
升级到Liferay 7可解决此问题。
虽然Liferay 7启动速度不快,但开发人员真的永远不需要重启它,因为可以通过部署新的OSGi组件来覆盖所有内容。这实际上是Liferay 6和Liferay 7之间的最大区别。
我为Liferay 7开发了3个月,包括非常深的自定义(例如拦截所有文件读取以进行审核),并且从未需要重新启动Liferay服务器。
答案 2 :(得分:0)
服务器速度在很大程度上取决于配置良好的JVM(内存,垃圾收集器类型等)和Tomcat连接器线程池。取决于可用的服务器资源。 Liferay提供了推荐的配置:
`-server -XX:NewSize=1024m -XX:MaxNewSize=1024m -Xms4096m
-Xmx4096m -XX:MetaspaceSize=300m -XX:MaxMetaspaceSize=300m
-XX:SurvivorRatio=12 –XX:TargetSurvivorRatio=90 –
XX:MaxTenuringThreshold=15 -XX:+UseLargePages
-XX:LargePageSizeInBytes=256m -XX:+UseParNewGC
-XX:ParallelGCThreads=16 -XX:+UseConcMarkSweepGC
-XX:+CMSParallelRemarkEnabled -XX:+CMSCompactWhenClearAllSoftRefs
-XX:CMSInitiatingOccupancyFraction=85 -XX:+CMSScavengeBeforeRemark
-XX:+UseLargePages -XX:LargePageSizeInBytes=256m
-XX:+UseCompressedOops -XX:+DisableExplicitGC -XX:-UseBiasedLocking
-XX:+BindGCTaskThreadsToCPUs -XX:+UseFastAccessorMethods
-XX:InitialCodeCacheSize=32m -XX:ReservedCodeCacheSize=96m`
上述JVM设置应该为您的开发提供一个起点 性能调整。每个系统的最终参数会因各种不同而有所不同 因素包括当前用户数和交易速度。
在tomcat服务器中,您可以在/[tomcat_server]/bin/setenv.sh或bat]文件中定义此配置,如 CATALINA_OPTS 环境变量。