> For the complete documentation index, see [llms.txt](https://amartyushov.gitbook.io/tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://amartyushov.gitbook.io/tech/app-aspects/software-architecture/system-x-ability.md).

# System X-ability

## Scalability

Scalability - is an ability of the system to operate as the number of users or requests increase.

**Metrics**:

* *Is performance and responsiveness impacted?*
  * *average response times across users per context*
  * *max response times across users per context*
* *Is there an increase in timeouts?*
  * *number of timeouts across users per context*
* *Is there an increase in system crashes?*
  * *number of crashes across users or requests*
* Is there enough database capacity?
* Is there enough vm capacity?

![Scalable system](https://415484505-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LxtoAXZwwOc4XGto8vb%2Fuploads%2FJNROhPLNMG1yThn1apLQ%2FScreenshot%202022-05-03%20at%2009.11.56.png?alt=media\&token=99cfe303-ffa1-4213-8826-308d9705a89a)

![NON scalable system](https://415484505-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LxtoAXZwwOc4XGto8vb%2Fuploads%2F6u2xtA81hL52ictz9krc%2FScreenshot%202022-05-03%20at%2009.12.30.png?alt=media\&token=36a6a678-e54b-40be-ae47-d695ebd0d427)

![Not scalability issue](https://415484505-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LxtoAXZwwOc4XGto8vb%2Fuploads%2FWgUEbXbqMOpddRxEa396%2FScreenshot%202022-05-03%20at%2009.14.11.png?alt=media\&token=ac4f6320-1788-4a57-8faf-5254ec2986df)

### Fitness functions

Send an alert when the number of crashes (timeouts, response time duration) increases by 20% and the number of users increases by 8%. (Numbers are just an example)

### Scalability vs performance

Scalability - **CONSISTENT** response time when load increases. And this consistency may cost some performance of the system.

<img src="https://415484505-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LxtoAXZwwOc4XGto8vb%2Fuploads%2Fz6Yddt6jwDzoK8GSPm4x%2FScreenshot%202022-05-04%20at%2008.43.25.png?alt=media&amp;token=845d4e31-f7ed-4b71-8be2-83c1d8b7fc04" alt="" data-size="original"> In this example if the systems requires to scale a lot then DB connections are becoming a bottle neck. Solution:

* introduce caching of the data. This will decrease amount of connections and dramatically increase a scalability.

## Elasticity

Elasticity is the ability of a system to remain responsive during significantly high instantaneous spikes in user load

![](https://415484505-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LxtoAXZwwOc4XGto8vb%2Fuploads%2FIN5y7t5voOAeX3FGMOQd%2FScreenshot%202022-05-03%20at%2009.34.41.png?alt=media\&token=64b966d5-322c-4a84-a8e4-e4854b6a5da1)

![](https://415484505-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LxtoAXZwwOc4XGto8vb%2Fuploads%2FBteaqABNRwnLJgqvV1Jq%2FScreenshot%202022-05-03%20at%2009.35.13.png?alt=media\&token=128817c0-98f6-4815-8318-6e777e706e0d)

![](https://415484505-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LxtoAXZwwOc4XGto8vb%2Fuploads%2F256EFIEaqEVBd2g6wwMi%2FScreenshot%202022-05-03%20at%2009.35.53.png?alt=media\&token=79b65857-5824-4194-8391-1cd93b7c8a41)

![](https://415484505-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LxtoAXZwwOc4XGto8vb%2Fuploads%2F67pzy3B5WRkZMUoYAOhn%2FScreenshot%202022-05-03%20at%2009.36.27.png?alt=media\&token=2d83e0f4-85e4-405e-97c1-2588f07720f0)

![](https://415484505-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LxtoAXZwwOc4XGto8vb%2Fuploads%2FzGcfyXIDCRd2EttCyA52%2FScreenshot%202022-05-03%20at%2009.37.10.png?alt=media\&token=46cf5769-75d5-49d5-9095-bdcd94dfd467)

![](https://415484505-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LxtoAXZwwOc4XGto8vb%2Fuploads%2FYlfbUNoykOdbRG3GYZfT%2FScreenshot%202022-05-03%20at%2009.37.39.png?alt=media\&token=2712788d-5a3b-4207-ab78-53e7d047a104)
