Exercise 2: Refund calculation
The refund calculation is calculated on the checkout page. The intention is to give the users that have bought many movies already the refund so that they will be stimulated to continue buying on our DVD Store. Furthermore, the refund can increase if the movie has already been bought from the same user in past.
This example can show that executing the same use case in different situations can produce different performance results because the implementation is wrong. In this case, the performance decreases if the user has more movies in his shopping card and if he already bought many movies.
What do you need to do?
- Activate the performance problem Refund Calculation if you did not do it already
- Log in as user1 (username: user1, password: password
- Go to the Shop page and add several movies to your shopping card (at least 3 different)
- Go to the Shopping Card page
- Now log out and log in as user8 (username: user8, password: password), which has no orders yet
- Perform the steps 3 & 4 again
- Analyze the results of monitoring with the inspectIT User interface
Solution hints:
- The business service method that processes the request is getTotalRefund() in the ShoppingCartBean class.
- Compare the two different cases (user1 shopping and user8 shopping). Why is the first one slower?
- Is there something done wrong?
Optional
If you found out what is the source of the problem, what would be your proposal for speeding-up the refund calculation? In real life situations you often don’t get the solution only from monitoring, but you need to additionally check the source code of the application. Note that monitoring can guide to the direct
source code location to check (class and method information).