# Assessing Database Contribution via Distributed Tracing for Microservice Systems
## 4 Experiments
### Main Results
#### 4.3.1 Sock-Shop  
**Step 1.** Determining the importance weight of business scenarios.  
By analyzing the main functions and processes of Sock-Shop, the hierarchy structure is illustrated in Figure 6.  
Then, we invited five related experts to score the business scenarios, and the pairwise comparison matrices are shown in Appendix A (Tables A1-A5). By hierarchical sorting and consistency test (Table A6 in Appendix A), the final importance weight of business scenarios in Sock-Shop can be calculated and are shown in Table 8.  
**Step 2.** Aggregating numbers of records of the same operation.  
Since aggregation matrices are sparse, we present the aggregation results of business scenarios in Sock-Shop in tabular form (Table 9).  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline  & \(\mathbf{BS_{1}}\) & \(\mathbf{BS_{2}}\) & \(\mathbf{BS_{3}}\) & \(\mathbf{BS_{4}}\) \\ \hline \(\bar{\mathbf{w}}\) & 0.5259 & 0.2337 & 0.1635 & 0.0769 \\ \hline \hline \end{tabular}
\end{table}
Table 8: The importance weight of business scenarios in Sock-Shop.  
Figure 6: The business scenarios hierarchy of Sock-Shop. We denote the four business scenarios of _Purchasing socks_, _Cart management_, _User information management_, and _Historical orders query_ as \(BS_{1}\), \(BS_{2}\), \(BS_{3}\), and \(BS_{4}\), respectively.  
**Step 3.** Calculating database contribution.  
By solving the three corresponding nonlinear programming problems (using the genetic algorithm in the MATLAB global optimization toolbox), the optimization results are shown in Table 10. The L2-Norm of DBCAMS is 0.1456, which is better than the other two baseline methods.  
The difference in optimization effects between DSCAMS and DBCAMS-MMD is caused by the difference between maximizing cosine similarity and minimizing MMD. Cosine similarity measures the consistency of the direction between vector dimensions, and pays more attention to the differences between dimensions than the differences in numerical values; MMD maps the two samples to be compared into a high-dimensional space (Reproducing Kernel Hilbert Space, RKHS) through a kernel function to find the distance between the two samples in RKHS. The reason for the better performance of DBCAMS is probably that **w** and **g** are more suitable for directional optimization in this situation; when the samples are mapped from low to high dimensions, the large dimension gap may cause noise generation.  
The difference in optimization effects between DSCAMS and DBCAMS-RN is caused by difference between the operators. The role of \(N_{i}\) is to reduce the influence of the gap between the number of operation records on calculating contribution, which not only ensures the positive correlation between the number of operation records and the database contribution, but also reduces the error in the optimization process.  
Meanwhile, according to the result from DBCAMS, _Catalogue_ has the highest contribution (close to 0.5), mainly because the importance of _Purchasing socks_ is high, and the invocations to _Catalogue_ account for a high proportion in _Purchasing socks_. The contributions of the _Cart_ and _User_ are close (both are about 0.25). The _Order_ has the lowest contribution, mainly because the importance of the _Historical order query_ is low (only 0.0769), and this business scenario only calls the _Order_.