Limitations of Chrome DevTools Throttle Network feature & An Alternative to throttle specific network requests
Tags: webdev, api, devtools, chrome
Published: 2021-07-10 03:40:44

---
title: Limitations of Chrome DevTools Throttle Network feature & An Alternative to throttle specific network requests
published: true
date: 2021-07-04 08:07:09 UTC
tags: Webdev, APIs, DevTools, Chrome
canonical_url: https://requestly.com/blog/adding-delay-to-network-requests/
---

As a frontend developer or QA, testing certain parts of web applications require you to simulate delay in one or more components of the web app.

Here are some scenarios where you would like to delay the network requests.

- Test performance of your web app on a slower condition
- Test behaviour of your app when one or more APIs respond slow (API Latency has gone up)
- Check if any race conditions exists when some resource X gets loaded after/before another resource Y.
- Test the impact of slow loading of external resources impact on your app.
- Test your loading experience in the app.

It is important for a developer to test the website performance in poor network conditions. This article focuses on the different methods which could enable developers to simulate network conditions.

### Approach 1: Network throttling feature of DevTools. Available in Chrome, Firefox and Edge.

The network tab in DevTools provides an option to [throttle network requests](https://css-tricks.com/throttling-the-network/). With this you can experience the same network conditions what one might face when using slow 3G, 2G connections or offline.

#### Steps to use the throttler:

- Open DevTools (Ctrl + Shift + I)
- Switch to the Network Tab.
- By default, the throttler is set to ‘No Throttle’.
- From the dropdown menu, you can select the type of network to simulate.
- Long Press the reload icon while the DevTools panel is open.

![Long press the reload icon to see advanced reload options](https://cdn-images-1.medium.com/max/1024/0*FY0_M_jFeAPM1cYW.png)<figcaption>Long press the reload icon to see advanced reload options</figcaption>

- Select ‘Empty Cache and Hard Reload’ from the advanced reload options.

> _It is important to empty cache to examine the page as a first time visitor._

#### Limitations

- It throttles the entire network. It is not possible to delay a particular network request.
- It might not be helpful in cases where you want to selectively delay network requests.

For more information, refer the documentation: [https://developer.chrome.com/docs/devtools/network/reference/](https://developer.chrome.com/docs/devtools/network/reference/)

### Approach 2: Server Side Delay — Using public APIs to add delay in requests

APIs like [deelay.me](https://deelay.me/) and [https://app.requestly.io/delay](https://app.requestly.io/delay) allow selectively delaying a network request. This kind of delay does not impact the browser.

#### How to use the API:

Change the link to be delayed as:

```
https://app.requestly.io/delay/<delay_in_millisecods>/<URL_to_delay>
```

For example — Suppose you want to delay [https://code.jquery.com/jquery-3.6.0.slim.js](https://code.jquery.com/jquery-3.6.0.slim.js) by 4000 ms and see the impact on your app as your libraries heavily depend on jQuery. This url has to be changed to :

[https://app.requestly.io/delay/4000/](https://app.requestly.io/delay/4000/https://example.com?c=1)[https://code.jquery.com/jquery-3.6.0.slim.js](https://code.jquery.com/jquery-3.6.0.slim.js) [https://deelay.me/4000/](https://deelay.me/4000/https://exampleapi.com?c=1)[https://code.jquery.com/jquery-3.6.0.slim.js](https://code.jquery.com/jquery-3.6.0.slim.js)

or

You can configure a Redirect Rule in Requestly to redirect jQuery CDN URL [https://code.jquery.com/jquery-3.6.0.slim.js](https://code.jquery.com/jquery-3.6.0.slim.js) to above >mentioned URL like [https://app.requestly.io/delay/4000/https://code.jquery.com/jquery-3.6.0.slim.js](https://app.requestly.io/delay/4000/https://code.jquery.com/jquery-3.6.0.slim.js)

### Method 3: ClientSide Delay — Using Requestly browser extension (Chrome, Firefox, Edge, Opera, Brave)

Using [Requestly](https://requestly.com/), you can Modify Headers, Redirect URLs, Switch hosts, Mock API response, Delay network requests, Insert custom scripts and much more.

![Delay HTTP(s) Requests using Requestly](https://cdn-images-1.medium.com/max/1024/1*ZyyaNEkQm_N3twwaGIWoNg.png)<figcaption>Delay HTTP(s) Requests using Requestly</figcaption>

Requestly delay rule works primarily on client side. This is how you can create a Delay Request Rule.

![Selecting Delay rule in Requestly App](https://cdn-images-1.medium.com/max/1024/1*MJ-UWDW2Cv-h55mW6_5oDQ.png)<figcaption>Selecting Delay rule in Requestly App</figcaption>

![Requestly Editor](https://cdn-images-1.medium.com/max/1024/1*z4sz42LtAxQUjXmAxCthVg.png)

- It supports delaying multiple requests which contain a certain keyword or match against the regex.
- It also works with AJAX requests.

You can also combine this with other rules of requestly, which is helpful in many situations, like somewhere you want to modify the headers of the request after delaying it. It could be easily solved using requestly.

#### Limitations

- The Requestly extension actually adds the delay in the browser.
- Adding the delay in browser could lead to poor browsing experience when delay is applied to too many requests or it is applied for a large duration.

#### Conclusion

- To test your entire application on a slower network, prefer using browser’s network throttling feature.
- To add delays to external resources like CSS, JS etc prefer using Server Side delay.
- To add delays to API requests (& AJAX requests) prefer using Client Side delay.

Hope this article gives you clarity on how you can test your applications on slower network or simulate API latency in your app.

We share news about developer tools. Follow us on [Twitter](https://twitter.com/requestlyIO) to learn more about devtools. We are also reachable on email at contact@requestly.io

_Originally published at_ [_https://requestly.com_](https://requestly.com/blog/adding-delay-to-network-requests/)