Announcement Announcement Module
Collapse
No announcement yet.
Aegi has slowed down my login process Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Aegi has slowed down my login process

    Hi All,

    I have implemented acegi into my site based on the following tutorial. http://www.tfo-eservices.eu/wb_tutor...-1_1-html.html

    To authenticate a user the system simply uses an AuthenticationDAO which uses hibernate to look up the database.

    However, during testing I noticed that when I login into the system it does take quite a bit longer. I have excluded the images by using /images/*=#NONE#. This did not seem to help.

    Would anyone be able to suggest some things that I should look into help with performance as I must be doing something wrong as not many other users have mentioned this problem.

    Thank you
    David

  • #2
    When you saying slowed it down, what are we talking about here e.g. millis, seconds, weeks? It might help to see your applicationContext.xml. I would also up the logging to see if anything stands out.

    Comment


    • #3
      When I say it slowed it down I mean that it can take upto 10 seconds to login. If you could have a look at my two files below I would appreciate it.
      Application context-acegi context:
      Application contect security

      Here is my application context file
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

      <beans>
      <!-- GENERAL-->
      <bean id="multipartResolver" class="org.springframework.web.multipart.commons.C ommonsMultipartResolver"/>

      <bean id="messageSource" class="org.springframework.context.support.Resourc eBundleMessageSource">
      <property name="basenames">
      <list>
      <value>applicationResources</value>
      </list>
      </property>
      </bean>

      <!-- HIBERNATE CONFIG -->
      <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
      <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
      <property name="url" value="jdbc:mysql://MYURL?useServerPrepStmts=false"/>
      <property name="username" value="MY_LOGIN"/>
      <property name="password" value="MY_PASSWORD"/>
      </bean>

      <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
      <property name="dataSource" ref="dataSource"/>
      <property name="mappingResources">
      <list>
      <value>com/onepennypost/model/Applicant.hbm.xml</value>
      <value>com/onepennypost/model/Country.hbm.xml</value>
      <value>com/onepennypost/model/Member.hbm.xml</value>
      <value>com/onepennypost/model/ContactGroup.hbm.xml</value>
      <value>com/onepennypost/model/Contact.hbm.xml</value>
      <value>com/onepennypost/model/CategoryType.hbm.xml</value>
      <value>com/onepennypost/model/Category.hbm.xml</value>
      <value>com/onepennypost/model/PostcardType.hbm.xml</value>
      <value>com/onepennypost/model/PostcardCredit.hbm.xml</value>
      <value>com/onepennypost/model/PostcardCreditPayment.hbm.xml</value>
      <value>com/onepennypost/model/Postcard.hbm.xml</value>
      <value>com/onepennypost/model/Photo.hbm.xml</value>
      </list>
      </property>
      <property name="hibernateProperties">
      <ref bean="hibernateProperties" />
      </property>
      </bean>

      <bean id="hibernateProperties" class="org.springframework.beans.factory.config.Pr opertiesFactoryBean">
      <property name="properties">
      <props>
      <prop key="hibernate.dialect">org.hibernate.dialect.MySQ LDialect</prop>
      <prop key="hibernate.show_sql">true</prop>
      <prop key="hibernate.c3p0.minPoolSize">5</prop>
      <prop key="hibernate.c3p0.maxPoolSize">100</prop>
      <prop key="hibernate.c3p0.timeout">600</prop>
      <prop key="hibernate.c3p0.max_statement">50</prop>
      <prop key="hibernate.c3p0.testConnectionOnCheckout">fals e</prop>
      </props>
      </property>
      </bean>

      <bean id="openSessionInView" class="org.springframework.orm.hibernate3.support. OpenSessionInViewInterceptor">
      <property name="sessionFactory" ref="sessionFactory"/>
      <property name="singleSession"><value>false</value></property>
      </bean>

      <!-- TRANSACTIONS -->
      <bean id="transactionManager" class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
      <property name="sessionFactory" ref="sessionFactory"/>
      </bean>

      <bean id="txProxyTemplate" abstract="true" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
      <property name="transactionManager" ref="transactionManager"/>
      <property name="transactionAttributes">
      <props>
      <prop key="*">PROPAGATION_REQUIRED</prop>
      </props>
      </property>
      </bean>

      <!-- SERVICE -->
      <bean id="localFileService" class="com.onepennypost.service.LocalFileServiceIm pl" />

      <bean id="categoryService" parent="txProxyTemplate">
      <property name="target" ref="categoryServiceTarget"/>
      </bean>

      <bean id="categoryServiceTarget" class="com.onepennypost.service.CategoryServiceImp l">
      <property name="categoryDao" ref="categoryDao"/>
      <property name="localFileService" ref="localFileService"/>
      </bean>

      <bean id="contactService" parent="txProxyTemplate">
      <property name="target" ref="contactServiceTarget"/>
      </bean>

      <bean id="contactServiceTarget" class="com.onepennypost.service.ContactServiceImpl ">
      <property name="contactDao" ref="contactDao"/>
      </bean>

      <bean id="countryService" parent="txProxyTemplate">
      <property name="target" ref="countryServiceTarget"/>
      </bean>

      <bean id="countryServiceTarget" class="com.onepennypost.service.CountryServiceImpl ">
      <property name="countryDao" ref="countryDao"/>
      </bean>

      <bean id="memberService" parent="txProxyTemplate">
      <property name="target" ref="memberServiceTarget"/>
      </bean>

      <bean id="memberServiceTarget" class="com.onepennypost.service.MemberServiceImpl" >
      <property name="memberDao" ref="memberDao"/>
      <property name="categoryService" ref="categoryService"/>
      </bean>

      <bean id="postcardService" parent="txProxyTemplate">
      <property name="target" ref="postcardServiceTarget"/>
      </bean>

      <bean id="postcardServiceTarget" class="com.onepennypost.service.PostcardServiceImp l">
      <property name="postcardDao" ref="postcardDao"/>
      </bean>

      <!-- DAO -->

      <bean id="categoryDao" class="com.onepennypost.model.dao.hibernate.Catego ryDaoImpl">
      <property name="sessionFactory" ref="sessionFactory"/>
      </bean>

      <bean id="contactDao" class="com.onepennypost.model.dao.hibernate.Contac tDaoImpl">
      <property name="sessionFactory" ref="sessionFactory"/>
      </bean>

      <bean id="countryDao" class="com.onepennypost.model.dao.hibernate.Countr yDaoImpl">
      <property name="sessionFactory" ref="sessionFactory"/>
      </bean>

      <bean id="memberDao" class="com.onepennypost.model.dao.hibernate.Member DaoImpl">
      <property name="sessionFactory" ref="sessionFactory"/>
      </bean>

      <bean id="postcardDao" class="com.onepennypost.model.dao.hibernate.Postca rdDaoImpl">
      <property name="sessionFactory" ref="sessionFactory"/>
      </bean>

      </beans>

      Here is my application contect security
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

      <beans>
      <bean id="filterChainProxy" class="org.acegisecurity.util.FilterChainProxy">
      <property name="filterInvocationDefinitionSource">
      <value>
      CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
      PATTERN_TYPE_APACHE_ANT
      /member/*.htm=httpSessionContextIntegrationFilter,formAuth enticationProcessingFilter, exceptionTranslationFilter,filterSecurityIntercept or
      /j_acegi_security_check=httpSessionContextIntegrati onFilter,formAuthenticationProcessingFilter, exceptionTranslationFilter,filterSecurityIntercept or
      /images/**=#NONE#
      /memberfiles/**=#NONE#
      /images/base/**=#NONE#
      /javascript/**=#NONE#
      /flags/**=#NONE#
      /*.css=#NONE#

      </value>
      </property>
      </bean>

      <bean id="formAuthenticationProcessingFilter" class="org.acegisecurity.ui.webapp.AuthenticationP rocessingFilter">
      <property name="filterProcessesUrl">
      <value>/j_acegi_security_check</value>
      </property>
      <property name="authenticationFailureUrl">
      <value>/login.htm?error=true</value>
      </property>
      <property name="defaultTargetUrl">
      <value>/member/memberHome.htm</value>
      </property>
      <property name="alwaysUseDefaultTargetUrl">
      <value>true</value>
      </property>
      <property name="authenticationManager">
      <ref bean="authenticationManager" />
      </property>
      </bean>

      <bean id="filterSecurityInterceptor" class="org.acegisecurity.intercept.web.FilterSecur ityInterceptor">
      <property name="authenticationManager">
      <ref bean="authenticationManager" />
      </property>
      <property name="accessDecisionManager">
      <ref bean="accessDecisionManager" />
      </property>
      <property name="objectDefinitionSource">
      <value>
      CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
      PATTERN_TYPE_APACHE_ANT
      /member/*=ROLE_USER
      </value>
      </property>
      </bean>

      <bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager ">
      <property name="providers">
      <list>
      <ref bean="daoAuthenticationProvider" />
      </list>
      </property>
      </bean>

      <bean id="daoAuthenticationProvider" class="org.acegisecurity.providers.dao.DaoAuthenti cationProvider">
      <property name="userDetailsService">
      <ref bean="memberService" />
      </property>
      </bean>

      <bean id="accessDecisionManager" class="org.acegisecurity.vote.UnanimousBased">
      <property name="decisionVoters">
      <list>
      <ref bean="roleVoter" />
      </list>
      </property>
      </bean>

      <bean id="roleVoter" class="org.acegisecurity.vote.RoleVoter">
      <property name="rolePrefix">
      <value>ROLE_</value>
      </property>
      </bean>

      <bean id="formLoginAuthenticationEntryPoint" class="org.acegisecurity.ui.webapp.AuthenticationP rocessingFilterEntryPoint">
      <property name="loginFormUrl">
      <value>/login.htm</value>
      </property>
      <property name="forceHttps">
      <value>false</value>
      </property>
      </bean>

      <bean id="exceptionTranslationFilter" class="org.acegisecurity.ui.ExceptionTranslationFi lter">
      <property name="authenticationEntryPoint">
      <ref bean="formLoginAuthenticationEntryPoint" />
      </property>
      </bean>

      <bean id="httpSessionContextIntegrationFilter" class="org.acegisecurity.context.HttpSessionContex tIntegrationFilter">
      </bean>

      </beans>

      Comment


      • #4
        Have you tried to do some profiling (or tried something like glassbox) to work out where the time is being spent?
        Last edited by Luke Taylor; Mar 13th, 2007, 10:42 AM.

        Comment


        • #5
          I agree with Luke's comments. It's really hard to just look at that and say what the problem is. It does help if it's in [ code] [ /code] tags. I'd profile it and maybe look at the log outout for any obvious problems.

          Comment


          • #6
            Thank you for your replies. I will try glasshouse tongiht. However, I have noticed that the first time I went to the site it took 23 seconds to login. I then logged out and then logged back in using the same user and it took about 3 seconds.

            Has anyone seen that before?

            Note all jsp's were compiled.

            Comment


            • #7
              Originally posted by davidallen39 View Post

              Has anyone seen that before?

              Note all jsp's were compiled.
              No. Whatever it is, it's highly unlikely to be anything to do with Acegi. Much more likely to be hibernate/database or some other resource initialisation.

              Comment


              • #8
                I would again agree with Luke. If you are lazy initing something that would explain it. You could up the logging and see if anything jumps out.

                Comment


                • #9
                  Hi all,

                  I did what you suggested and turned up the logging to debug for acegi classes. Following is some of the logs. I would like to know if this looks normal. I will try and install glasshouse if I dont have any luck here.

                  Thank you for your time
                  david

                  12:47:20,452 DEBUG org.acegisecurity.intercept.web.PathBasedFilterInv ocationDefinitionMap:112 - Candidate is: '/memberfiles/1/1/thumbnails/1171678804924.jpg'; pattern is /memberfiles/**; matched=true
                  12:47:20,453 DEBUG org.acegisecurity.util.FilterChainProxy:139 - /memberFiles/1/1/thumbnails/1171678804924.jpg has an empty filter list
                  12:47:20,614 DEBUG org.acegisecurity.intercept.web.PathBasedFilterInv ocationDefinitionMap:100 - Converted URL to lowercase, from: '/images/virtual_create_postcard_n.jpg'; to: '/images/virtual_create_postcard_n.jpg'
                  12:47:20,615 DEBUG org.acegisecurity.intercept.web.PathBasedFilterInv ocationDefinitionMap:112 - Candidate is: '/images/virtual_create_postcard_n.jpg'; pattern is /member/*.htm; matched=false
                  12:47:20,615 DEBUG org.acegisecurity.intercept.web.PathBasedFilterInv ocationDefinitionMap:112 - Candidate is: '/images/virtual_create_postcard_n.jpg'; pattern is /j_acegi_security_check; matched=false
                  12:47:20,616 DEBUG org.acegisecurity.intercept.web.PathBasedFilterInv ocationDefinitionMap:112 - Candidate is: '/images/virtual_create_postcard_n.jpg'; pattern is /images/**; matched=true
                  12:47:20,616 DEBUG org.acegisecurity.util.FilterChainProxy:139 - /images/virtual_create_postcard_n.jpg has an empty filter list
                  12:47:20,624 DEBUG org.acegisecurity.intercept.web.PathBasedFilterInv ocationDefinitionMap:100 - Converted URL to lowercase, from: '/memberfiles/1/1/thumbnails/1171766447936.jpg'; to: '/memberfiles/1/1/thumbnails/1171766447936.jpg'
                  12:47:20,625 DEBUG org.acegisecurity.intercept.web.PathBasedFilterInv ocationDefinitionMap:112 - Candidate is: '/memberfiles/1/1/thumbnails/1171766447936.jpg'; pattern is /member/*.htm; matched=false
                  12:47:20,625 DEBUG org.acegisecurity.intercept.web.PathBasedFilterInv ocationDefinitionMap:112 - Candidate is: '/memberfiles/1/1/thumbnails/1171766447936.jpg'; pattern is /j_acegi_security_check; matched=false
                  12:47:20,626 DEBUG org.acegisecurity.intercept.web.PathBasedFilterInv ocationDefinitionMap:112 - Candidate is: '/memberfiles/1/1/thumbnails/1171766447936.jpg'; pattern is /images/**; matched=false
                  12:47:20,626 DEBUG org.acegisecurity.intercept.web.PathBasedFilterInv ocationDefinitionMap:112 - Candidate is: '/memberfiles/1/1/thumbnails/1171766447936.jpg'; pattern is /memberfiles/**; matched=true
                  12:47:20,627 DEBUG org.acegisecurity.util.FilterChainProxy:139 - /memberFiles/1/1/thumbnails/1171766447936.jpg has an empty filter list

                  Comment


                  • #10
                    Ok here are some stats that show the time it takes to process a request.

                    14:16:53,456 - The spring controller was requested
                    14:16:54,528 - Acegi them performs a security check and control is passed to the controller
                    14:16:57,691 - Controller does its thing and passes control to jsp

                    It is here that we begin to see debug statements like the following and they continue up until 14:17:22,185

                    The following bug statements are printed out for 25 seconds?? Does anyone know why it takes this long

                    14:16:58,941 DEBUG org.acegisecurity.intercept.web.PathBasedFilterInv ocationDefinitionMap:100 - Converted URL to lowercase, from: '/javascript/pdf.js'; to: '/javascript/pdf.js'
                    14:16:58,943 DEBUG org.acegisecurity.intercept.web.PathBasedFilterInv ocationDefinitionMap:112 - Candidate is: '/javascript/pdf.js'; pattern is /member/*.htm; matched=false
                    14:16:58,945 DEBUG org.acegisecurity.intercept.web.PathBasedFilterInv ocationDefinitionMap:112 - Candidate is: '/javascript/pdf.js'; pattern is /j_acegi_security_check; matched=false
                    14:16:58,948 DEBUG org.acegisecurity.intercept.web.PathBasedFilterInv ocationDefinitionMap:112 - Candidate is: '/javascript/pdf.js'; pattern is /images/**; matched=false
                    14:16:58,952 DEBUG org.acegisecurity.intercept.web.PathBasedFilterInv ocationDefinitionMap:112 - Candidate is: '/javascript/pdf.js'; pattern is /memberfiles/**; matched=false
                    14:16:58,955 DEBUG org.acegisecurity.intercept.web.PathBasedFilterInv ocationDefinitionMap:112 - Candidate is: '/javascript/pdf.js'; pattern is /images/base/**; matched=false
                    14:16:58,957 DEBUG org.acegisecurity.intercept.web.PathBasedFilterInv ocationDefinitionMap:112 - Candidate is: '/javascript/pdf.js'; pattern is /javascript/**; matched=true
                    14:16:58,960 DEBUG org.acegisecurity.util.FilterChainProxy:139 - /javascript/pdf.js has an empty filter list
                    14:16:59,571 DEBUG org.acegisecurity.intercept.web.PathBasedFilterInv ocationDefinitionMap:100 - Converted URL to lowercase, from: '/javascript/utils.js'; to: '/javascript/utils.js'
                    14:16:59,575 DEBUG org.acegisecurity.intercept.web.PathBasedFilterInv ocationDefinitionMap:112 - Candidate is: '/javascript/utils.js'; pattern is /member/*.htm; matched=false
                    ............
                    14:17:22,184 DEBUG org.acegisecurity.intercept.web.PathBasedFilterInv ocationDefinitionMap:112 - Candidate is: '/images/virtual_screen_xsmall.jpg'; pattern is /images/**; matched=true
                    14:17:22,185 DEBUG org.acegisecurity.util.FilterChainProxy:139 - /images/virtual_screen_xsmall.jpg has an empty filter list

                    Comment


                    • #11
                      I am sure this comment has nothing to see with your problem but I would like to ask you a question.

                      In you applicationContext.xml file why are you declaring your datasource as a dbcp BasicDatasource, and then in hibernate properties declaring a c3p0 connection pool? Wouldn't be easier to only use one of them, either dbcp or c3p0?

                      Comment


                      • #12
                        Are they all for static items (images, js etc) with an empty filter list or is there other functionality involved? Where do the main jumps in time occur throughout the 22 seconds (or is the time pretty much continuous)?

                        Comment


                        • #13
                          Originally posted by lou_tribal View Post
                          In you applicationContext.xml file why are you declaring your datasource as a dbcp BasicDatasource, and then in hibernate properties declaring a c3p0 connection pool? Wouldn't be easier to only use one of them, either dbcp or c3p0?
                          As you say, this isn't related to the problem. I would agree though it does make sense to only configurer it in one way. I would suggest doing it in Spring rather than the Hibernate properties.

                          Comment

                          Working...
                          X