Fix image suffix to resolve errors
[policy/parent.git] / docs / development / devtools / api-s3p.rst
1 .. This work is licensed under a
2 .. Creative Commons Attribution 4.0 International License.
3 .. http://creativecommons.org/licenses/by/4.0
4
5 .. _api-s3p-label:
6
7 .. toctree::
8    :maxdepth: 2
9
10 Policy API S3P Tests
11 ####################
12
13
14 72 Hours Stability Test of Policy API
15 +++++++++++++++++++++++++++++++++++++
16
17 Introduction
18 ------------
19
20 The 72 hour stability test of policy API has the goal of verifying the stability of running policy design API REST
21 service by ingesting a steady flow of transactions in a multi-threaded fashion to
22 simulate multiple clients' behaviors.
23 All the transaction flows are initiated from a test client server running JMeter for the duration of 72 hours.
24
25 Setup Details
26 -------------
27
28 The stability test was performed on a default ONAP OOM installation in the Intel Wind River Lab environment.
29 JMeter was installed on a separate VM to inject the traffic defined in the
30 `API stability script
31 <https://git.onap.org/policy/api/tree/testsuites/stability/src/main/resources/testplans/policy_api_stability.jmx>`_
32 with the following command:
33
34 .. code-block:: bash
35
36     nohup ./apache-jmeter-5.4.1/bin/jmeter.sh -n -t policy_api_stability.jmx -l stabilityTestResultsPolicyApi.jtl
37
38 The test was run in the background via “nohup”, to prevent it from being interrupted.
39
40 Test Plan
41 ---------
42
43 The 72+ hours stability test will be running the following steps sequentially
44 in multi-threaded loops. Thread number is set to 5 to simulate 5 API clients'
45 behaviors (they can be calling the same policy CRUD API simultaneously).
46 Each thread creates a different version of the policy types and policies to not
47 interfere with one another while operating simultaneously.  The point version
48 of each entity is set to the running thread number.
49
50 **Setup Thread (will be running only once)**
51
52 - Get policy-api Healthcheck
53 - Get API Counter Statistics
54 - Get Preloaded Policy Types
55
56 **API Test Flow (5 threads running the same steps in the same loop)**
57
58 - Get Policy Metrics
59 - Create a new Monitoring Policy Type with Version 6.0.#
60 - Create a new Monitoring Policy Type with Version 7.0.#
61 - Create a new Optimization Policy Type with Version 6.0.#
62 - Create a new Guard Policy Type with Version 6.0.#
63 - Create a new Native APEX Policy Type with Version 6.0.#
64 - Create a new Native Drools Policy Type with Version 6.0.#
65 - Create a new Native XACML Policy Type with Version 6.0.#
66 - Get All Policy Types
67 - Get All Versions of the new Monitoring Policy Type
68 - Get Version 6.0.# of the new Monitoring Policy Type
69 - Get Version 6.0.# of the new Optimzation Policy Type
70 - Get Version 6.0.# of the new Guard Policy Type
71 - Get Version 6.0.# of the new Native APEX Policy Type
72 - Get Version 6.0.# of the new Native Drools Policy Type
73 - Get Version 6.0.# of the new Native XACML Policy Type
74 - Get the Latest Version of the New Monitoring Policy Type
75 - Create Monitoring Policy Ver 6.0.# w/Monitoring Policy Type Ver 6.0.#
76 - Create Monitoring Policy Ver 7.0.# w/Monitoring Policy Type Ver 7.0.#
77 - Create Optimization Policy Ver 6.0.# w/Optimization Policy Type Ver 6.0.#
78 - Create Guard Policy Ver 6.0.# w/Guard Policy Type Ver 6.0.#
79 - Create Native APEX Policy Ver 6.0.# w/Native APEX Policy Type Ver 6.0.#
80 - Create Native Drools Policy Ver 6.0.# w/Native Drools Policy Type Ver 6.0.#
81 - Create Native XACML Policy Ver 6.0.# w/Native XACML Policy Type Ver 6.0.#
82 - Get Version 6.0.# of the new Monitoring Policy
83 - Get Version 6.0.# of the new Optimzation Policy
84 - Get Version 6.0.# of the new Guard Policy
85 - Get Version 6.0.# of the new Native APEX Policy
86 - Get Version 6.0.# of the new Native Drools Policy
87 - Get Version 6.0.# of the new Native XACML Policy
88 - Get the Latest Version of the new Monitoring Policy
89 - Delete Version 6.0.# of the new Monitoring Policy
90 - Delete Version 7.0.# of the new Monitoring Policy
91 - Delete Version 6.0.# of the new Optimzation Policy
92 - Delete Version 6.0.# of the new Guard Policy
93 - Delete Version 6.0.# of the new Native APEX Policy
94 - Delete Version 6.0.# of the new Native Drools Policy
95 - Delete Version 6.0.# of the new Native XACML Policy
96 - Delete Monitoring Policy Type with Version 6.0.#
97 - Delete Monitoring Policy Type with Version 7.0.#
98 - Delete Optimization Policy Type with Version 6.0.#
99 - Delete Guard Policy Type with Version 6.0.#
100 - Delete Native APEX Policy Type with Version 6.0.#
101 - Delete Native Drools Policy Type with Version 6.0.#
102 - Delete Native XACML Policy Type with Version 6.0.#
103
104 **TearDown Thread (will only be running after API Test Flow is completed)**
105
106 - Get policy-api Healthcheck
107 - Get Preloaded Policy Types
108
109
110 Test Results
111 ------------
112
113 **Summary**
114
115 No errors were found during the 72 hours of the Policy API stability run.
116 The load was performed against a non-tweaked ONAP OOM installation.
117
118 **Test Statistics**
119
120 =======================  =============  ===========  ===============================  ===============================  ===============================
121 **Total # of requests**  **Success %**    **TPS**    **Avg. time taken per request**  **Min. time taken per request**  **Max. time taken per request**
122 =======================  =============  ===========  ===============================  ===============================  ===============================
123     242277                    100%         0.935              5340 ms                               1 ms                          736976 ms
124 =======================  =============  ===========  ===============================  ===============================  ===============================
125
126 .. image:: api-s3p-results/api-s3p-jm-1_I.png
127
128 **JMeter Results**
129
130 The following graphs show the response time distributions.   The "Get Policy Types" API calls are the most expensive calls that
131 average a 7 seconds plus response time.
132
133 .. image:: api-s3p-results/api-response-time-distribution_I.png
134 .. image:: api-s3p-results/api-response-time-overtime_I.png
135
136 **Memory and CPU usage**
137
138 The memory and CPU usage can be monitored by running "top" command in the policy-api pod.
139 A snapshot is taken before and after test execution to monitor the changes in resource utilization.
140
141 Memory and CPU usage before test execution:
142
143 .. image:: api-s3p-results/api_top_before_72h.jpg
144
145 Memory and CPU usage after test execution:
146
147 .. image:: api-s3p-results/api_top_after_72h.jpg
148
149
150 Performance Test of Policy API
151 ++++++++++++++++++++++++++++++
152
153 Introduction
154 ------------
155
156 Performance test of policy-api has the goal of testing the min/avg/max processing time and rest call throughput for all the requests when the number of requests are large enough to saturate the resource and find the bottleneck.
157
158 Setup Details
159 -------------
160
161 The performance test was performed on a default ONAP OOM installation in the Intel Wind River Lab environment.
162 JMeter was installed on a separate VM to inject the traffic defined in the
163 `API performace script
164 <https://git.onap.org/policy/api/tree/testsuites/performance/src/main/resources/testplans/policy_api_performance.jmx>`_
165 with the following command:
166
167 .. code-block:: bash
168
169     nohup ./apache-jmeter-5.4.1/bin/jmeter.sh -n -t policy_api_performance.jmx -l performanceTestResultsPolicyApi.jtl
170
171 The test was run in the background via “nohup”, to prevent it from being interrupted.
172
173 Test Plan
174 ---------
175
176 Performance test plan is the same as stability test plan above.
177 Only differences are, in performance test, we increase the number of threads up to 20 (simulating 20 users' behaviors at the same time) whereas reducing the test time down to 2.5 hours.
178
179 Run Test
180 --------
181
182 Running/Triggering performance test will be the same as stability test. That is, launch JMeter pointing to corresponding *.jmx* test plan. The *API_HOST* and *API_PORT* are already set up in *.jmx*.
183
184 **Test Statistics**
185
186 =======================  =============  ===========  ===============================  ===============================  ===============================
187 **Total # of requests**  **Success %**    **TPS**    **Avg. time taken per request**  **Min. time taken per request**  **Max. time taken per request**
188 =======================  =============  ===========  ===============================  ===============================  ===============================
189     2822                     100%           0.31              63794 ms                              2 ms                          1183376 ms
190 =======================  =============  ===========  ===============================  ===============================  ===============================
191
192 .. image:: api-s3p-results/api-s3p-jm-2_I.png
193
194 Test Results
195 ------------
196
197 The following graphs show the response time distributions.
198
199 .. image:: api-s3p-results/api-response-time-distribution_performance_I.png
200 .. image:: api-s3p-results/api-response-time-overtime_performance_I.png
201
202
203
204