API S3P documentation
[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' behaviours.
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 Nordix 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.5/bin/jmeter -n -t policy_api_stability.jmx -l stabilityTestResultsPolicyApi.jtl &
37
38 The test was run in the background via “nohup” and “&”, 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 behaviours (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 - Create a new Monitoring Policy Type with Version 6.0.#
59 - Create a new Monitoring Policy Type with Version 7.0.#
60 - Create a new Optimization Policy Type with Version 6.0.#
61 - Create a new Guard Policy Type with Version 6.0.#
62 - Create a new Native APEX Policy Type with Version 6.0.#
63 - Create a new Native Drools Policy Type with Version 6.0.#
64 - Create a new Native XACML Policy Type with Version 6.0.#
65 - Get All Policy Types
66 - Get All Versions of the new Monitoring Policy Type
67 - Get Version 6.0.# of the new Monitoring Policy Type
68 - Get Version 6.0.# of the new Optimization Policy Type
69 - Get Version 6.0.# of the new Guard Policy Type
70 - Get Version 6.0.# of the new Native APEX Policy Type
71 - Get Version 6.0.# of the new Native Drools Policy Type
72 - Get Version 6.0.# of the new Native XACML Policy Type
73 - Get the Latest Version of the New Monitoring Policy Type
74 - Create Version 6.0.# of Node Template
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 - Create Version 6.0.# of PNF Example Policy with Metadata
83 - Get Node Template
84 - Get All TCA Policies
85 - Get All Versions of Monitoring Policy Type
86 - Get Version 6.0.# of the new Monitoring Policy
87 - Get Version 6.0.# of the new Optimization Policy
88 - Get Version 6.0.# of the new Guard Policy
89 - Get Version 6.0.# of the new Native APEX Policy
90 - Get Version 6.0.# of the new Native Drools Policy
91 - Get Version 6.0.# of the new Native XACML Policy
92 - Get the Latest Version of the new Monitoring Policy
93 - Delete Version 6.0.# of the new Monitoring Policy
94 - Delete Version 7.0.# of the new Monitoring Policy
95 - Delete Version 6.0.# of the new OptimizationPolicy
96 - Delete Version 6.0.# of the new Guard Policy
97 - Delete Version 6.0.# of the new Native APEX Policy
98 - Delete Version 6.0.# of PNF Example Policy having Metadata
99 - Delete Version 6.0.# of the new Native Drools Policy
100 - Delete Version 6.0.# of the new Native XACML Policy
101 - Delete Monitoring Policy Type with Version 6.0.#
102 - Delete Monitoring Policy Type with Version 7.0.#
103 - Delete Optimization Policy Type with Version 6.0.#
104 - Delete Guard Policy Type with Version 6.0.#
105 - Delete Native APEX Policy Type with Version 6.0.#
106 - Delete Native Drools Policy Type with Version 6.0.#
107 - Delete Native XACML Policy Type with Version 6.0.#
108 - Delete Node Template
109 - Get Policy Metrics
110
111 **TearDown Thread (will only be running after API Test Flow is completed)**
112
113 - Get policy-api Healthcheck
114 - Get Preloaded Policy Types
115
116
117 Test Results
118 ------------
119
120 **Summary**
121
122 No errors were found during the 72 hours of the Policy API stability run.
123 The load was performed against a non-tweaked ONAP OOM installation.
124
125 **Test Statistics**
126
127 =======================  =============  ===========  ===============================  ===============================  ===============================
128 **Total # of requests**  **Success %**    **TPS**    **Avg. time taken per request**  **Min. time taken per request**  **Max. time taken per request**
129 =======================  =============  ===========  ===============================  ===============================  ===============================
130     950839                    100%         3.67              1351 ms                               126 ms                          16324 ms
131 =======================  =============  ===========  ===============================  ===============================  ===============================
132
133 .. image:: api-s3p-results/api-s3p-jm-1_J.png
134
135 **JMeter Results**
136
137 The following graphs show the response time distributions.   The "Get Policy Types" API calls are the most expensive calls that
138 average a 13 seconds plus response time.
139
140 .. image:: api-s3p-results/api-response-time-distribution_J.png
141 .. image:: api-s3p-results/api-response-time-overtime_J.png
142
143 **Memory and CPU usage**
144
145 The memory and CPU usage can be monitored by running "top" command in the policy-api pod.
146 A snapshot is taken before and after test execution to monitor the changes in resource utilization.
147
148 Memory and CPU usage before test execution:
149
150 .. image:: api-s3p-results/api_top_before_72h.png
151
152 Memory and CPU usage after test execution:
153
154 .. image:: api-s3p-results/api_top_after_72h.png
155
156
157 Performance Test of Policy API
158 ++++++++++++++++++++++++++++++
159
160 Introduction
161 ------------
162
163 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.
164
165 Setup Details
166 -------------
167
168 The performance test was performed on a default ONAP OOM installation in the Nordix Lab environment.
169 JMeter was installed on a separate VM to inject the traffic defined in the
170 `API performance script
171 <https://git.onap.org/policy/api/tree/testsuites/performance/src/main/resources/testplans/policy_api_performance.jmx>`_
172 with the following command:
173
174 .. code-block:: bash
175
176     nohup apache-jmeter-5.5/bin/jmeter -n -t policy_api_performance.jmx -l performanceTestResultsPolicyApi.jtl &
177
178 The test was run in the background via “nohup” and “&”, to prevent it from being interrupted.
179
180 Test Plan
181 ---------
182
183 Performance test plan is the same as stability test plan above.
184 Only differences are, in performance test, we increase the number of threads up to 20 (simulating 20 users' behaviours at the same time) whereas reducing the test time down to 2.5 hours.
185
186 Run Test
187 --------
188
189 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*.
190
191 **Test Statistics**
192
193 =======================  =============  ===========  ===============================  ===============================  ===============================
194 **Total # of requests**  **Success %**    **TPS**    **Avg. time taken per request**  **Min. time taken per request**  **Max. time taken per request**
195 =======================  =============  ===========  ===============================  ===============================  ===============================
196     16212                     100%           1.8              11109 ms                              162 ms                          237265 ms
197 =======================  =============  ===========  ===============================  ===============================  ===============================
198
199 .. image:: api-s3p-results/api-s3p-jm-2_J.png
200
201 Test Results
202 ------------
203
204 The following graphs show the response time distributions.
205
206 .. image:: api-s3p-results/api-response-time-distribution_performance_J.png
207 .. image:: api-s3p-results/api-response-time-overtime_performance_J.png
208
209
210
211