7 Replies Latest reply on Jul 16, 2007 11:07 AM by monkeyden

    SMPC Configuration

    monkeyden

      I'm running JMeter against a screen in my application and it's failing miserably, so I created a rudimentary test case and it's failing also. I'm guessing that I have something misconfigured. Here is what I have:

      <persistence xmlns="http://java.sun.com/xml/ns/persistence"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
       version="1.0">
      
       <persistence-unit name="dcdb">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <jta-data-source>java:/ds_dcdb</jta-data-source>
       <properties>
       <property name="hibernate.hbm2ddl.auto" value="none"/>
       <property name="hibernate.cache.use_query_cache" value="true"/>
       <property name="hibernate.show_sql" value="true"/>
       <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect" />
       <property name="jboss.entity.manager.factory.jndi.name" value="java:/dcdb"/>
       <property name="hibernate.default_schema" value="dcdb"/>
       </properties>
       </persistence-unit>
       <persistence-unit name="images">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <jta-data-source>java:/ds_images</jta-data-source>
       <properties>
       <property name="hibernate.hbm2ddl.auto" value="none"/>
       <property name="hibernate.cache.use_query_cache" value="true"/>
       <property name="hibernate.show_sql" value="true"/>
       <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect" />
       <property name="jboss.entity.manager.factory.jndi.name" value="java:/images"/>
       <property name="hibernate.default_schema" value="img"/>
       </properties>
       </persistence-unit>
      </persistence>


      components.xml
      <core:managed-persistence-context name="dcdbEM" persistence-unit-jndi-name="java:/dcdb" auto-create="true"/>


      pages.xml
      <page view-id="/test/testEmployee.xhtml" action="#{testEmployeeAction.loadEmployee}"/>


      Action
      @Name("testEmployeeAction")
      @Scope(ScopeType.SESSION)
      public class TestEmployeeAction {
      
       @Logger
       private static Log log;
      
       Employee employee;
      
       @Create
       public void create(){
      
       }
      
       public void loadEmployee(){
       EmployeeBO employeeBO = (EmployeeBO)Component.getInstance("employeeBO");
       this.employee = (Employee)employeeBO.findByPrimaryKey(new Long(206485));
       log.debug("Employee found: #0", employee.getFullName());
       }
      
       /**
       * @return the employee
       */
       public Employee getEmployee() {
       return employee;
       }
      
       /**
       * @param employee the employee to set
       */
       public void setEmployee(Employee employee) {
       this.employee = employee;
       }
      }
      


      The entity
      @Entity
      @Name("employee")
      @Table(name = "DWL_EMPLOYEES")
      public class Employee extends EmployeeBase implements java.io.Serializable {
      
       @Id
       @Column(name = "EMPLOYEE_ID", length = 22, nullable = false)
       public Long getEmployeeId() {
       return this.employeeId;
       }
      
       public void setEmployeeId(Long employeeId) {
       this.employeeId = employeeId;
       }
      
       @Column(name = "FIRST_NAME", length = 30, nullable = true)
       public String getFirstName() {
       return this.firstName;
       }
      
       public void setFirstName(String firstName) {
       this.firstName = firstName;
       }
       ...
      


      And in the view I use facelets
      <ui:define name="body">
       <h:form id="testEmployeeForm">
       #{testEmployeeAction.employee.firstName}
       </h:form>
       </ui:define>


      The page works fine with a single request from the browser but under load, the whole document is sent in the response but my assertion fails (i.e. the employee name is not displayed). In fact, when using just 10 threads, 7 of them fail.

      Thanks for any advice.

        • 1. Re: SMPC Configuration
          monkeyden

          Oh, BTW, here is the business object

          @Name("employeeBO")
          public class EmployeeBO extends AbstractBusinessObject implements Serializable {
          
           @In
           private EntityManager dcdbEM;
          
           @Logger
           private Log log;
          
           public AbstractBaseEntity findByPrimaryKey(Object employeeId) {
           return this.dcdbEM.find(Employee.class, employeeId);
           }
          }


          • 2. Re: SMPC Configuration
            monkeyden

            Incidentally, turning off the page action and just calling loadEmployee() from the @Create method gives me a 100% success rate, while using the page action yields 1-3%. Seems like a simple load test for this feature.

            • 3. Re: SMPC Configuration
              monkeyden

              I am becoming increasingly convinced that this is an issue with page actions and not an issue with my configuration. I have completely removed all references to any persistence related components and changed loadEmployee() and added accessors like so:

              public void loadEmployee(){
               this.firstName = "monkey";
              }
              
              public String getFirstName() {
               return firstName;
              }
              
              public void setFirstName(String firstName) {
               this.firstName = firstName;
              }


              and the view:
              #{testEmployeeAction.firstName}


              Still it fails at the same rate.

              • 4. Re: SMPC Configuration
                pmuir

                Why is the bean session scoped?

                • 5. Re: SMPC Configuration
                  monkeyden

                  The result is the same with an event scoped bean. The page action is not called more than 30% of the time. To be more specific about the test case, I used 10 threads with a 1 second wait time. I looked at Pages and it seemed to be getting the pages from the cached list. I wonder if there is some threading issue here.

                  • 6. Re: SMPC Configuration
                    pmuir

                    If you can make this test super simple and just show this problem, then add it to JIRA so we can take a look. Thanks :)

                    • 7. Re: SMPC Configuration
                      monkeyden

                      Hi Pete,
                      I haven't forgotten about this. I ran some more tests, using JMeter's HttpClient listener, rather than Http Request. The threads created for the standard Http Request are not mutually exclusive and may be reused. As a result, I'm beginning to think that it has more to do with our code than Seam's. Go figure! :) I will get back if I determine otherwise. Thanks for responding. I appreciate it greatly.