Files
notifications-admin/package.json
Chris Hill-Scott a2929ad748 Delay AJAX calls if the server is slow to respond
By default our AJAX calls were 2 seconds. Then they were 5 seconds
because someone reckoned 2 seconds was putting too much load on the
system. Then we made them 10 seconds while we were having an incident.
Then we made them 20 seconds for the heaviest pages, but back to 5
seconds or 2 seconds for the rest of the pages.

This is not a good situation because:
- it slows all services down equally, no  matter how much traffic they
  have, or which features they have  switched on
- it slows everything down by the same amount, no matter how much load
  the platform is under
- the values are set based on our worst performance, until we manually
  remember to switch them back
- we spend time during incidents deploying changes to slow down the
  dashboard refresh time because it’s a nothing-to-lose change that
  might relieve some symptoms, when we could be spending time digging
  into the underlying cause

This pull request makes the Javascript smarter about how long it waits
until it makes another AJAX call. It bases the delay on how long the
server takes to respond (as a proxy for how much load the server is
under).

It’s based on the square root of the response time, so is more sensitive
to slow downs early on, and less sensitive to slow downs later on. This
helps us give a more pronounced difference in delay between an AJAX call
that is fast (for example the page for a single notification) and one
that is slow (for example a dashboard for a service with lots of
traffic).

*Some examples of what this would mean for various pages*

Page | Response time | Wait until next AJAX call
---|---|---
Check a reply to address | 130ms | 1,850ms
Brand new service dashboard | 229ms | 2,783ms
HM Passport Office dashboard | 634ms | 5,294ms
NHS Coronavirus Service dashboard | 779ms | 5,977ms
_Example of the kind of slowness we’ve seen during an incident_ | 6,000ms | 18,364ms
GOV.UK email dashboard | `HTTP 504` | 😬
2020-04-09 12:05:18 +01:00

61 lines
1.7 KiB
JSON

{
"name": "notifications-admin",
"version": "0.0.1",
"description": "Admin front end for GOV.UK Notify",
"engines": {
"node": "10.15.3"
},
"scripts": {
"test": "gulp lint && jest --config tests/javascripts/jest.config.js tests/javascripts",
"test-watch": "jest --watch --config tests/javascripts/jest.config.js tests/javascripts",
"build": "gulp",
"watch": "gulp watch"
},
"repository": {
"type": "git",
"url": "git+https://github.com/alphagov/notifications-admin.git"
},
"author": "Government Digital Service",
"license": "MIT",
"homepage": "https://github.com/alphagov/notifications-admin#readme",
"dependencies": {
"@babel/core": "7.4.0",
"@babel/preset-env": "7.4.2",
"del": "5.1.0",
"diff-dom": "2.5.1",
"govuk-elements-sass": "3.1.2",
"govuk-frontend": "2.13.0",
"govuk_frontend_toolkit": "8.1.0",
"gulp": "4.0.0",
"gulp-add-src": "1.0.0",
"gulp-babel": "8.0.0",
"gulp-base64-inline": "1.0.4",
"gulp-better-rollup": "4.0.1",
"gulp-clean-css": "4.2.0",
"gulp-concat": "2.6.1",
"gulp-include": "2.3.1",
"gulp-sass": "4.0.2",
"gulp-uglify": "3.0.2",
"hogan": "1.0.2",
"jquery": "3.4.1",
"query-command-supported": "1.0.0",
"rollup": "1.23.1",
"streamqueue": "1.1.2",
"textarea-caret": "3.1.0",
"timeago": "1.6.5"
},
"devDependencies": {
"gulp-css-url-adjuster": "0.2.3",
"gulp-jshint": "2.1.0",
"gulp-prettyerror": "1.2.1",
"gulp-sass-lint": "1.4.0",
"jest": "24.7.1",
"jest-date-mock": "^1.0.8",
"jest-each": "^25.3.0",
"jshint": "2.10.2",
"jshint-stylish": "2.2.1",
"rollup-plugin-commonjs": "10.1.0",
"rollup-plugin-node-resolve": "5.2.0"
}
}