How does the Linx RESTHost perform under load?
Tags: api, backendautomation, devtools, rest
Published: 2020-10-28 08:25:56

---
title: How does the Linx RESTHost perform under load?
published: true
date: 2020-09-02 09:43:17 UTC
tags: API,BackendAutomation,DevTools,Rest
canonical_url: https://linx.software/rest-load/
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/4968czn0m5607h4rqdzy.jpg
---

REST is a software architecture style, commonly used for web services. Due to its popularity,  you will probably need to load test [RESTful APIs](https://dev.to/linxsoftware/how-to-build-a-mvp-rest-api-in-low-code-a-step-by-step-guide-je) at some point.   
  
We recently set out to test our RESTHost to see how it performs under load. In this performance test, the CPU load and memory were monitored under heavy load. This will give a brief idea of the REST API Request Limits of the different virtual machine in the Azure B-Series under different test scenarios.

### Method

Load testing was done using JMeter. A web service with four endpoints with empty tasks were tested to determine the behaviour of the system as the load increases from zero-load situation to a situation until the server`s CPU usage reached 100 % without the API returning any errors or timing out.

Four endpoints were tested for Load as described in the following table

<table>
<tbody>
<tr>
<td>Label</td>
<td>Method</td>
<td>Headers</td>
<td>Parameters</td>
<td>Body Data</td>
<td>Response</td>
</tr>

<tr>

<td>DummyGET</td>

<td>Get</td>

<td>None</td>

<td>None</td>

<td>None</td>

<td>None</td>

</tr>

<tr>

<td>DummyPOST</td>

<td>Post</td>

<td>Content-type and Accept</td>

<td>None</td>

<td>None</td>

<td>None</td>

</tr>

<tr>

<td>GetWithResponse</td>

<td>Get</td>

<td>None</td>

<td>None</td>

<td>None</td>

<td>String</td>

</tr>

<tr>

<td>PostWithResponseAndContetn</td>

<td>Post</td>

<td>Content-type and Accept</td>

<td>None</td>

<td>Yes</td>

<td>String</td>

</tr>

</tbody>

</table>

We started by trying to find the maximum throughput that our API can sustain. We define this metric as the number of requests per second that will bring our API server to the maximum CPU utilization. The test was carried out in 2 phases; first, requests were done consecutively on each of the four endpoints and then requests were done in parallel on four endpoints.

### Result

In order to find each endpoint limit on each machine, traffic was generated by increasing the number of users slowly until errors were noted in JMeter. In consecutive test, traffic was simulated on four different endpoints using linear injection of users for a fixed time period of sixty seconds (60 sec). Each user would send 10 requests on each endpoint consecutively.  
  
**Consecutive Test Results**

<table>

<tbody>

<tr>

<td></td>

<td>B1ms (1  
vcpus, 2 GiB  
memory)</td>

<td>B2ms (2  
vcpus, 4 GiB  
memory)</td>

<td>B2ms (2  
vcpus, 8 GiB  
memory)</td>

<td>B4ms (4  
vcpus, 16 GiB  
memory)</td>

<td>B8ms (8  
vcpus, 32 GiB  
memory)</td>

</tr>

<tr>

<td>No. of requests</td>

<td>80,000</td>

<td>120,000</td>

<td>120,000</td>

<td>320,000</td>

<td>320,000</td>

</tr>

<tr>

<td>Mean response time (ms)</td>

<td>15</td>

<td>5</td>

<td>5</td>

<td>6</td>

<td>6</td>

</tr>

<tr>

<td>Average requests/s</td>

<td>1250</td>

<td>2653</td>

<td>2823</td>

<td>4064</td>

<td>6524</td>

</tr>

</tbody>

</table>

In order to test how increasing the requests on the four endpoints simultaneously would affect performance, traffic was simulated on all four different endpoints at the same time. Requests were sent on all four endpoints at the same time using linear injection of users for a fixed time period of sixty seconds (60 sec). Each user would send 10 requests.  
  
**Parallel Test Results**

<table>

<tbody>

<tr>

<td></td>

<td>B1ms (1  
vcpus, 2 GiB  
memory)</td>

<td>B2ms (2  
vcpus, 4 GiB  
memory)</td>

<td>B2ms (2  
vcpus, 8 GiB  
memory)</td>

<td>B4ms (4  
vcpus, 16 GiB  
memory)</td>

<td>B8ms (8  
vcpus, 32 GiB  
memory)</td>

</tr>

<tr>

<td>No. of requests</td>

<td>48,000</td>

<td>140,000</td>

<td>120,000</td>

<td>240,000</td>

<td>240,000</td>

</tr>

<tr>

<td>Mean response time (ms)</td>

<td>9</td>

<td>17</td>

<td>18</td>

<td>351</td>

<td>2041</td>

</tr>

<tr>

<td>Average requests/s</td>

<td>811</td>

<td>1736</td>

<td>1848</td>

<td>3212</td>

<td>5510</td>

</tr>

</tbody>

</table>

### Conclusion

REST API requests of all types and to all endpoints are limited by the number of CPU of the virtual machines. As we increased the number of virtual CPU, we could see that Linx RESTHost performance increased to serve more requests and the mean response time was acceptable.  As the number of requests increased above approximately 5500 requests per second, we started having errors with 500/Internal Server Error.

* * *

### Challenges

- In parallel tests, the actual number of concurrent users and transactions per seconds depends on the server response time.
- In parallel tests, only four endpoints were tested. Result may vary with the number of endpoints.
- Users were added during a fixed period of time. 60 seconds was chosen as the ‘spread overtime’ in all tests, which is not a real-life case scenario.
- The example does not accurately reflect a normal user’s usage pattern as both the Linx server deployment and load injector were in the same data centre.

The post [How does the Linx RESTHost perform under load?](https://linx.software/rest-load/) appeared first on [Linx](https://linx.software).