Enterprise JavaBeans™ (EJB™) Architecture Scalability/Load Test


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Goal: Analyze performance testing strategies and techniques for EJB applications Assumtions: There is a requirement to performance test EJB middleware Automated test is preferred to manual test (see cost/benefit handout)
  • Given those assumptions, how do we go about: Load testing EJBs? Automating that testing? The majority of load tools on the market are: Based on GUI-oriented capture/playback Designed for later in the development life cycle (i.e. system test)
  • 4 EJB's comprise a simple order entry system: Customer entity bean Vendor entity bean Product entity bean OrderEntry session bean Deployed on WebLogic 5.1.0 Use Cloudscape database for persistence Our session bean simply manipulates the three entity beans to process an order Suppose that you find that this EJB application as a whole doesn't meet performance requirements. What next? What would you have to do in order to test / diagnose?
  • Enterprise JavaBeans™ (EJB™) Architecture Scalability/Load Test

    1. 1. Enterprise JavaBeans ™ (EJB ™ ) Architecture Scalability/Load Test Ted Osborne [email_address] RSW Software, Inc. www.rswsoftware.com
    2. 2. Agenda <ul><li>The Current Landscape: Performance Testing & EJBs </li></ul><ul><li>Example Case Study using EJB-test </li></ul><ul><li>Survey EJB Performance Test Strategies & Techniques </li></ul>
    3. 3. Performance Testing & EJBs Presentation tier Data tier Middle tier : web client : web client : client : EJB server : web client : web server : database server : client : client : EJB : EJB : Internet
    4. 4. Our &quot;OrderEntry&quot; Example WebLogic 5.1.0 : EJB server Cloudscape : database server <<requests>> <<responses>> orderentry.jar : Session EJB product.jar : Entity EJB vendor.jar : Entity EJB customer.jar : Entity EJB
    5. 5. EJB-test <ul><li>Strategy: </li></ul><ul><ul><li>Create Java driver &quot;client&quot; for EJB under test </li></ul></ul><ul><ul><ul><li>Goal: time method requests on EJB's interface (business methods) </li></ul></ul></ul><ul><ul><ul><li>Automate code generation through Java Reflection API & EJB code patterns </li></ul></ul></ul><ul><ul><li>Simulate load using that client </li></ul></ul><ul><ul><ul><li>Run the client in multithreaded load generator </li></ul></ul></ul><ul><ul><ul><li>Map in data from tables (or use generated data) </li></ul></ul></ul><ul><ul><li>Aggregate log data </li></ul></ul><ul><ul><ul><li>Response times </li></ul></ul></ul><ul><ul><ul><li>Exceptions </li></ul></ul></ul><ul><ul><ul><li>Data: actual vs. expected </li></ul></ul></ul>
    6. 6. Select the EJB to be tested from the Jars in your classpath
    7. 7. EJB-test automatically generates a Java Test Client specific to the selected EJB and optimized for WebLogic or WebSphere
    8. 8. The automatically generated Java Test Client times the method calls to the selected EJB
    9. 9. Define the load to execute and run the test.
    10. 10. Select the results to view
    11. 11. Select the response time data to view
    12. 12. Compare 2 test executions
    13. 13. OEVendor vs. OELoad <ul><li>A simple response time comparison reveals which bean is the bottleneck </li></ul><ul><li>Potential sources of bottleneck: </li></ul><ul><ul><li>Design </li></ul></ul><ul><ul><li>Deployment </li></ul></ul><ul><ul><li>Environment </li></ul></ul>
    14. 14. Comparing EJB Deployments OEProduct ejb-jar.xml:37 <trans-attribute> Supports OEVendor ejb-jar.xml:37 <trans-attribute> Required weblogic-cmp-rdbms-jar.xml:29 <transaction-isolation> TRANSACTION_SERIALIZABLE
    15. 15. Strategies & Techniques <ul><li>Load Testing </li></ul><ul><li>Data-driven Load Testing </li></ul><ul><li>Multithreaded & Multi-JVM Loads </li></ul><ul><li>Distributed Load Testing </li></ul><ul><li>Scenario (Multi-bean) Testing </li></ul><ul><li>Other Interesting EJB Tests </li></ul>
    16. 16. EJB Load Testing <ul><li>Objective </li></ul><ul><ul><li>Measure EJB's ability to server increasing number of client requests </li></ul></ul><ul><ul><li>Most Common Metrics </li></ul></ul><ul><ul><ul><li>Transactions per Second (TPS)—throughput </li></ul></ul></ul><ul><ul><ul><li>Response time—client-side </li></ul></ul></ul><ul><ul><li>Other Interesting Metrics </li></ul></ul><ul><ul><ul><li>Error rate (exceptions) </li></ul></ul></ul><ul><ul><ul><li>Correctness (expected vs. actual values) </li></ul></ul></ul><ul><ul><ul><li>Method-level response times </li></ul></ul></ul>
    17. 17. Data-driven EJB Load Testing <ul><li>Objective </li></ul><ul><ul><li>Test EJBs with realistic data sets </li></ul></ul><ul><li>Approach </li></ul><ul><ul><li>Particular data combinations often comprise a &quot;use-case&quot; </li></ul></ul><ul><ul><li>Data set triggers business rules or call graphs of interest </li></ul></ul><ul><ul><li>Automation Leverage: Data from CSV &quot;maps&quot; into a static client driver </li></ul></ul><ul><li>Hurdles </li></ul><ul><ul><li>Marrying clients to data sets </li></ul></ul>
    18. 18. EJB Load Testing System Topology : client host B : test client Data tier Middle tier : EJB server A : EJB : database server Test client threads each time their calls to the EJB's methods B : client thread B : EJB
    19. 19. Multithreaded & Multi-JVM Load Generation <ul><li>Objective </li></ul><ul><ul><li>Better simulation of load </li></ul></ul><ul><li>Approach </li></ul><ul><ul><li>Multithreaded load generation simulates a multi-client load (concurrent requests) </li></ul></ul><ul><ul><li>Dividing load across JVMs creates multiple socket connections to server </li></ul></ul><ul><li>Hurdles </li></ul><ul><ul><li>Thread safety & execution coordination </li></ul></ul>
    20. 20. Distributed Load Testing <ul><li>Objective </li></ul><ul><ul><li>Generate a load simulation that is large enough </li></ul></ul><ul><li>Approach </li></ul><ul><ul><li>Distribute client JVMs across multiple machines </li></ul></ul><ul><li>Hurdles </li></ul><ul><ul><li>Still have thread safety and client coordination </li></ul></ul><ul><ul><li>Aggregating result logs </li></ul></ul><ul><ul><li>Client execution environment </li></ul></ul>
    21. 21. Distributed Load Testing Nirvana : EJB-test server EJB Servers : EJB server : EJB : EJB Client Hosts : client host : test client : test client : test client : client host : test client : test client : test client : client host : test client : test client : test client : EJB server : EJB : EJB EJB-test Servlet engine AutoGen ™ code generator SyncLoad ™ Desktops : NT host : browser : Solaris host : browser : NT host : browser
    22. 22. Other Interesting EJB Tests <ul><li>Stress Testing </li></ul><ul><li>Mixed/Randomized Loads </li></ul><ul><li>Scenario Testing </li></ul><ul><li>Security Testing </li></ul><ul><li>Configuration Testing </li></ul>
    23. 23. Anatomy of an EJB Test Client Driver 2 Lookup Home Interface in JNDI Tree java.lang.Object homeObject = jndi.lookup (&quot;OECustomer&quot;); com.testmybeans.customer.CustomerHome home = (com.testmybeans.customer.CustomerHome) javax.rmi.PortableRemoteObject.narrow ((org.omg.CORBA.Object) homeObject, com.testmybeans.customer.CustomerHome.class); 1 Get JNDI InitialContext //[WebSphere302 getInitialContext] public static Context getInitialContext(String urlName) throws javax.naming.NamingException { Hashtable env = new Hashtable(); env.put(Context.PROVIDER_URL, &quot; iiop:// &quot; + urlName); env.put(&quot;java.naming.factory.initial&quot;, &quot; com.ibm.ejs.ns.jndi.CNInitialContextFactory &quot;); env.put(&quot;javax.naming.Context.INITIAL_CONTEXT_FACTORY&quot;, &quot;com.ibm.ejs.ns.jndi.CNInitialContextFactory&quot;); InitialContext ctx = new InitialContext (env); return ctx; }
    24. 24. Anatomy of an EJB Test Client Driver 3 Get a Bean Instance if (m_ds.getRule().equals(&quot;Data table&quot;)) h = home. findByPrimaryKey (pkey0); else h = home. create (arg0); 5 Log Results timer.start (m_cSetters, &quot;setCustomerAddress&quot;, sValue); h.setCustomerAddress(sValue); timer.stopAndLog(); 4 timer.start(m_cSetters, &quot;setCustomerAddress&quot;, sValue); h.setCustomerAddress(sValue); timer.stopAndLog(); Exercise Bean's Business Methods