小型应用程序需要时间加载

发布于 2024-11-10 01:13:25 字数 7486 浏览 0 评论 0原文

我有一个使用 Icefaces 1.8.2 和 jsf 1.1 开发的小型 Web 应用程序,该应用程序部署到 Oracle 应用服务器 10.1.3。我注意到最初加载应用程序需要一段时间,一旦加载速度就令人满意。

如何缩短应用程序的初始加载时间?

更新 1

我的查询在后端需要 2-3 秒,但是当我在前端渲染相同的查询时,需要几乎 7 秒。行数只有 1080。我正在数据表中呈现这些记录。这可能是什么原因?

更新 2

web.xml

<web-app xmlns="http://java.sun.com/xml/ns/j2ee/web-app_2_3.xsd">
    <context-param>
        <param-name>com.icesoft.faces.debugDOMUpdate</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
        <description>State saving method: "client" or "server" (= default) See JSF Specification
                     2.5.2</description>
    </context-param>
    <context-param>
        <param-name>com.icesoft.faces.concurrentDOMViews</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>com.icesoft.faces.synchronousUpdate</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>com.icesoft.faces.connectionTimeout</param-name>
        <param-value>100000</param-value>
    </context-param>
    <context-param>
        <param-name>com.icesoft.faces.standardRequestScope</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <param-name>org.apache.myfaces.redirectTracker.POLICY</param-name>
        <param-value>org.apache.myfaces.custom.redirectTracker.policy.FullRedirectTrackPolicy</param-value>
    </context-param>
    <context-param>
        <param-name>webAppRootKey</param-name>
        <param-value>app1</param-value>
    </context-param>
    <!-- Faces Servlet -->
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
        <servlet-name>Persistent Faces Servlet</servlet-name>
        <servlet-class>com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
        <servlet-name>Blocking Servlet</servlet-name>
        <servlet-class>com.icesoft.faces.webapp.xmlhttp.BlockingServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <!-- extension mapping -->
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Persistent Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Persistent Faces Servlet</servlet-name>
        <url-pattern>*.jspx</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Persistent Faces Servlet</servlet-name>
        <url-pattern>*.iface</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Persistent Faces Servlet</servlet-name>
        <url-pattern>/xmlhttp/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Blocking Servlet</servlet-name>
        <url-pattern>/block/*</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>10000</session-timeout>
    </session-config>
    <!-- Welcome files -->
    <welcome-file-list>
        <welcome-file>index.jsf</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    <listener>
        <listener-class>com.icesoft.faces.util.event.servlet.ContextEventRepeater</listener-class>
    </listener>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <!-- Spring Security -->
    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>

applicationContext.xml

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:security="http://www.springframework.org/schema/security"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd   http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.2.xsd">    
    <security:authentication-manager alias="_authenticationManager" />   
    <bean id="authenticationProvider"
          class="com.icesoft.icefaces.security.UserDetailsAuthenticationProvider">
        <security:custom-authentication-provider/>
        <property name="userDetailsService" ref="userDetailsService"/>
    </bean>
    <bean id="userDetailsService" class="com.icesoft.icefaces.security.UserDetailsServiceImpl">      
         <constructor-arg ref="userRepository"/>
    </bean>
    <bean id="userRepository"
          class="com.icesoft.icefaces.security.UserDaoImpl"/>
    <bean id="ntlmFilter" class="org.springframework.security.ui.ntlm.NtlmProcessingFilter">
        <security:custom-filter position="NTLM_FILTER"/>
        <property name="stripDomain" value="true"/>
    <property name="defaultDomain" value="XYZ"/>
    <property name="authenticationManager" ref="_authenticationManager" />
    </bean>
    <bean id="ntlmEntryPoint"
          class="org.springframework.security.ui.ntlm.NtlmProcessingFilterEntryPoint">
        <property name="authenticationFailureUrl" value="/accessDenied.jspx"/>
    </bean>
    <bean id="exceptionTranslationFilter"
          class="org.springframework.security.ui.ExceptionTranslationFilter">
        <property name="authenticationEntryPoint" ref="ntlmEntryPoint"/>
    </bean>
    <security:http access-denied-page="/denied.xhtml" entry-point-ref="ntlmEntryPoint"
                   servlet-api-provision="false">
        <security:intercept-url pattern="/accessDenied.jspx" filters="none"/>
        <security:intercept-url pattern="/**" access="ROLE_USER"/>
    </security:http>
</beans>

感谢任何帮助。 谢谢

I have a small web application developed using Icefaces 1.8.2 and jsf 1.1 which is deployed to Oracle Application Server 10.1.3. I have noticed that it is taking a while to load the application initially and once loaded speed is satisfactory.

How can I improve the initial loading time of the application?

Update 1

I a query which takes 2-3 seconds in back end, however when I render the same in front-end it takes almost 7 seconds. Number of rows is only 1080. I am rendering these records in datatable. What could be the reason for this?

Update 2

web.xml

<web-app xmlns="http://java.sun.com/xml/ns/j2ee/web-app_2_3.xsd">
    <context-param>
        <param-name>com.icesoft.faces.debugDOMUpdate</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
        <description>State saving method: "client" or "server" (= default) See JSF Specification
                     2.5.2</description>
    </context-param>
    <context-param>
        <param-name>com.icesoft.faces.concurrentDOMViews</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>com.icesoft.faces.synchronousUpdate</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>com.icesoft.faces.connectionTimeout</param-name>
        <param-value>100000</param-value>
    </context-param>
    <context-param>
        <param-name>com.icesoft.faces.standardRequestScope</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <param-name>org.apache.myfaces.redirectTracker.POLICY</param-name>
        <param-value>org.apache.myfaces.custom.redirectTracker.policy.FullRedirectTrackPolicy</param-value>
    </context-param>
    <context-param>
        <param-name>webAppRootKey</param-name>
        <param-value>app1</param-value>
    </context-param>
    <!-- Faces Servlet -->
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
        <servlet-name>Persistent Faces Servlet</servlet-name>
        <servlet-class>com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
        <servlet-name>Blocking Servlet</servlet-name>
        <servlet-class>com.icesoft.faces.webapp.xmlhttp.BlockingServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <!-- extension mapping -->
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Persistent Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Persistent Faces Servlet</servlet-name>
        <url-pattern>*.jspx</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Persistent Faces Servlet</servlet-name>
        <url-pattern>*.iface</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Persistent Faces Servlet</servlet-name>
        <url-pattern>/xmlhttp/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Blocking Servlet</servlet-name>
        <url-pattern>/block/*</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>10000</session-timeout>
    </session-config>
    <!-- Welcome files -->
    <welcome-file-list>
        <welcome-file>index.jsf</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    <listener>
        <listener-class>com.icesoft.faces.util.event.servlet.ContextEventRepeater</listener-class>
    </listener>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <!-- Spring Security -->
    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>

applicationContext.xml

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:security="http://www.springframework.org/schema/security"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd   http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.2.xsd">    
    <security:authentication-manager alias="_authenticationManager" />   
    <bean id="authenticationProvider"
          class="com.icesoft.icefaces.security.UserDetailsAuthenticationProvider">
        <security:custom-authentication-provider/>
        <property name="userDetailsService" ref="userDetailsService"/>
    </bean>
    <bean id="userDetailsService" class="com.icesoft.icefaces.security.UserDetailsServiceImpl">      
         <constructor-arg ref="userRepository"/>
    </bean>
    <bean id="userRepository"
          class="com.icesoft.icefaces.security.UserDaoImpl"/>
    <bean id="ntlmFilter" class="org.springframework.security.ui.ntlm.NtlmProcessingFilter">
        <security:custom-filter position="NTLM_FILTER"/>
        <property name="stripDomain" value="true"/>
    <property name="defaultDomain" value="XYZ"/>
    <property name="authenticationManager" ref="_authenticationManager" />
    </bean>
    <bean id="ntlmEntryPoint"
          class="org.springframework.security.ui.ntlm.NtlmProcessingFilterEntryPoint">
        <property name="authenticationFailureUrl" value="/accessDenied.jspx"/>
    </bean>
    <bean id="exceptionTranslationFilter"
          class="org.springframework.security.ui.ExceptionTranslationFilter">
        <property name="authenticationEntryPoint" ref="ntlmEntryPoint"/>
    </bean>
    <security:http access-denied-page="/denied.xhtml" entry-point-ref="ntlmEntryPoint"
                   servlet-api-provision="false">
        <security:intercept-url pattern="/accessDenied.jspx" filters="none"/>
        <security:intercept-url pattern="/**" access="ROLE_USER"/>
    </security:http>
</beans>

Appreciate any help.
Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

﹂绝世的画 2024-11-17 01:13:25

最好在数据库端使用分页,而不是一次获取所有记录。最终用户一次最多会在屏幕上看到 10-20 条记录。可能会忽略大部分结果。

您还可以对特定列进行排序,以便用户可以更好地找到结果。让用户直接迁移到找到的总结果页面中的特定结果页面,而无需浏览每个结果页面。

这将减少从数据库中获取不必要的记录和数据。当许多用户访问时可能会提高性能。

Its better to use pagination at database-end rather then fetching all records at a time. The end-user will see at-most 10-20 records at a time on screen & probably will neglect most of the results.

Also you can introduce sorting on specific columns so that the user can find results better. Let user migrate to the specific result page directly of the total result pages found, without going through each result page.

This will reduce fetching unnecessary records from the database & may increase performance when accessed by many users.

雾里花 2024-11-17 01:13:25

您是否尝试过在不同的应用程序服务器上进行测试?我没有使用过 Oracle 应用服务器,但我发现与在 Tomcat 上运行的相同应用程序相比,在 jetty 上运行的应用程序的启动速度要慢得多。
我建议尝试一下Tomcat。即使这不是您的实际部署选项,这至少应该有助于诊断。

Have you tried testing on a different application server? I've not used Oracle Application Server, but I have seen significantly slower start up for an app running on jetty compared to the same app running on Tomcat.
I suggest trying Tomcat. Even if that's not an actual deployment option for you, this should at least help diagnosis.

萌︼了一个春 2024-11-17 01:13:25

我通过重新编写一些代码和sql语句,将应用程序的性能提高到了令人满意的水平。

感谢大家的帮助。

I have improved the performance of the application to a satisfactory level by re-writing some code and sql statements.

Thanks to all for the help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文