Class: QaServer::PerformancePerByteCalculatorService

Inherits:
Object
  • Object
show all
Includes:
PerformanceHistoryDataKeys
Defined in:
app/services/qa_server/performance_per_byte_calculator_service.rb

Constant Summary collapse

TIME =
0
BYTES =
1

Constants included from PerformanceHistoryDataKeys

QaServer::PerformanceHistoryDataKeys::ALL_ACTIONS, QaServer::PerformanceHistoryDataKeys::ALL_AUTH, QaServer::PerformanceHistoryDataKeys::AVG_ACTN, QaServer::PerformanceHistoryDataKeys::AVG_FULL, QaServer::PerformanceHistoryDataKeys::AVG_GRPH, QaServer::PerformanceHistoryDataKeys::AVG_LOAD, QaServer::PerformanceHistoryDataKeys::AVG_NORM, QaServer::PerformanceHistoryDataKeys::AVG_RETR, QaServer::PerformanceHistoryDataKeys::BPMS_GRPH, QaServer::PerformanceHistoryDataKeys::BPMS_NORM, QaServer::PerformanceHistoryDataKeys::BPMS_RETR, QaServer::PerformanceHistoryDataKeys::BY_DAY, QaServer::PerformanceHistoryDataKeys::BY_HOUR, QaServer::PerformanceHistoryDataKeys::BY_MONTH, QaServer::PerformanceHistoryDataKeys::FETCH, QaServer::PerformanceHistoryDataKeys::FOR_DATATABLE, QaServer::PerformanceHistoryDataKeys::FOR_DAY, QaServer::PerformanceHistoryDataKeys::FOR_MONTH, QaServer::PerformanceHistoryDataKeys::FOR_YEAR, QaServer::PerformanceHistoryDataKeys::HIGH_ACTN, QaServer::PerformanceHistoryDataKeys::HIGH_FULL, QaServer::PerformanceHistoryDataKeys::HIGH_GRPH, QaServer::PerformanceHistoryDataKeys::HIGH_LOAD, QaServer::PerformanceHistoryDataKeys::HIGH_NORM, QaServer::PerformanceHistoryDataKeys::HIGH_RETR, QaServer::PerformanceHistoryDataKeys::LOW_ACTN, QaServer::PerformanceHistoryDataKeys::LOW_FULL, QaServer::PerformanceHistoryDataKeys::LOW_GRPH, QaServer::PerformanceHistoryDataKeys::LOW_LOAD, QaServer::PerformanceHistoryDataKeys::LOW_NORM, QaServer::PerformanceHistoryDataKeys::LOW_RETR, QaServer::PerformanceHistoryDataKeys::MSPB_GRPH, QaServer::PerformanceHistoryDataKeys::MSPB_NORM, QaServer::PerformanceHistoryDataKeys::MSPB_RETR, QaServer::PerformanceHistoryDataKeys::SEARCH, QaServer::PerformanceHistoryDataKeys::SRC_BYTES, QaServer::PerformanceHistoryDataKeys::STATS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(records:, n:) ⇒ PerformancePerByteCalculatorService

Returns a new instance of PerformancePerByteCalculatorService.

Parameters:

  • records (Array <Qa::PerformanceHistory>)

    set of records used to calculate the statistics



14
15
16
17
18
# File 'app/services/qa_server/performance_per_byte_calculator_service.rb', line 14

def initialize(records:, n:)
  @records = records
  @n = n
  @stats = {}
end

Instance Attribute Details

#nObject (readonly)

Returns the value of attribute n.



11
12
13
# File 'app/services/qa_server/performance_per_byte_calculator_service.rb', line 11

def n
  @n
end

#recordsObject (readonly)

Returns the value of attribute records.



11
12
13
# File 'app/services/qa_server/performance_per_byte_calculator_service.rb', line 11

def records
  @records
end

#statsObject (readonly)

Returns the value of attribute stats.



11
12
13
# File 'app/services/qa_server/performance_per_byte_calculator_service.rb', line 11

def stats
  @stats
end

Instance Method Details

#calculateHash

Calculate performance statistics with percentiles. Min is at the 10th percentile. Max is at the 90th percentile.

Examples:

{ data_raw_bytes_from_source: [16271, 16271],
  retrieve_bytes_per_ms: [67.24433786890475, 55.51210410757532],
  retrieve_ms_per_byte: [0.014871140555351083, 0.018014089288745542]
  graph_load_bytes_per_ms_ms: [86.74089418722461, 54.97464153778724],
  graph_load_ms_per_byte: [0.011528587632974647, 0.018190205011389522],
  normalization_bytes_per_ms: [64.70169466560836, 89.25337465693322],
  normalization_ms_per_byte: [0.01530700843338457, 0.015455545718983178]
}

Returns:

  • (Hash)

    hash of the statistics



31
32
33
34
35
36
37
# File 'app/services/qa_server/performance_per_byte_calculator_service.rb', line 31

def calculate
  extract_bytes
  calculate_retrieve_stats
  calculate_graph_load_stats
  calculate_normalization_stats
  stats
end