Efficiency Requirements

The Efficiency requirements define the constraints on the system regarding resource utilisation: disk, CPU, RAM, network, and other similar resources. Additionally, this section defines how the system should behave under load and during periods of traffic spikes (whether organic or attack in nature).

Definitions

CPU core
CPU core utilisation is dependent on many factors, such as architecture, microarchitecture, cache size and utilisation, shared workload, and more. We intend to measure CPU core utilisation by using the docker ps utility on our staging application server.
Normal conditions
We define "normal conditions" as one request per second, which is just over 2.5 M monthly requests.
Peak load
We define "peak load" as one hundred (100) requests per second.
"The system"
For the purposes of CPU and RAM resource consumption, we define the system as being the container running Ruby application code (Rails and Sidekiq) and the container running Redis. We do not include the database container (Postgres) in CPU and RAM resource requirements.
For the purposes of disk resource consumption, we define the system as being all containers related to a single MoR instance.
The front-end load balancer is never counted towards resource consumption. If the load balancer becomes a significant factor in scaling, the team have collectively decided we will need to investigate an alternative load balancer.

Goals

  1. To ensure that Mall on Rails has reasonable usage limits, even under what is considered a significant load (take only what you need from it).
  2. To ensure customers have a pleasant experience shopping with storefronts using the Mall on Rails system by not wasting their time, bandwidth, or data caps on unnecessary overhead.
  3. To allow multiple Mall on Rails deployments to live on a single application server, effectuating decent scaling for hosts of multiple storefronts.

Exclusions

  1. The system shall not paginate the Collections#index page.

Requirements

  1. The system shall utilise a maximum of 512 MB RAM under normal conditions, and 768 MB RAM under peak load.
  2. The system shall utilise a maximum of 20% of one CPU core under normal conditions, and 100% of two CPU cores under peak load.
  3. The system shall ensure that customer browsers are instructed to cache assets (item photos, collection thumbnails) for a period of seven days.
  4. The system shall set generated assets (such as CSS, JavaScript) to have a cache time of at least one year.
    1. We allow this because the Rails asset pipeline changes the filename of generated assets when the contents themselves change. If this were to change in a future release of Rails, this requirement will need to be re-evaluated.
  5. The system shall process all photo assets uploaded by the store owner into the JPEG format. The files shall be stored with a quality level of 80, and a maximum resolution of 2000x2000 pixels.
  6. The system shall paginate the Collections#show page with a count of 20 items per page.
  7. The system shall paginate admin collection and item indexes with a count of either 15, 30, 45, or 60 items, with a user-settable default of 15.