Jacques Le Roux created OFBIZ-5843:
--------------------------------------

             Summary: Improve storeOrder service performance and reliability
                 Key: OFBIZ-5843
                 URL: https://issues.apache.org/jira/browse/OFBIZ-5843
             Project: OFBiz
          Issue Type: Improvement
          Components: order
    Affects Versions: Trunk
            Reporter: Jacques Le Roux
            Assignee: Jacques Le Roux
            Priority: Minor
             Fix For: Upcoming Branch


The storeOrder service, implemented by the OrderService.createOrder() method, 
synchronously calls the countProductQuantityOrdered service implemented in 
Minilang. OOTB, the countProductQuantityOrdered service is only called by the 
storeOrder service implementation. It's called inside a loop on orderItems.

While intentionally load testing a custom project with JMeter on a weak 
m1.small AWS machine, I noticed the overhead of the service call for each order 
item iteration was significant on this slow machine. With only 30 concurrent 
users the process was blocked by  a timeout on the countProductQuantityOrdered 
service.

I then decided to transform the Minilang code into an 
OrderService.countProductQuantityOrdered() method that can be directly called 
inside OrderService.createOrder() and also implements the 
countProductQuantityOrdered service. Hence it avoids the overhead of the  
Minilang service calls in loop while still providing a 
countProductQuantityOrdered service for possible external uses. For that I 
moved the definition from Product component to Order component to avoid the 
hard coded dependency of Order to Product. I then did not cross issues with the 
same load test.

I also added a test for the countProductQuantityOrdered service by adding an 
order item of a virtual product (GZ-1006-1) in SalesOrderTest.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to