PTF - Performance testing of CPU=0 for Services (QCP1)

PTF - Performance testing of CPU=0 for Services (QCP1)

Overview

  • In this report, PTF tries to reproduce a bug where one of the modules fails with 500 response code possibly due to resource starvation. The theory was that a few high-usage modules were possibly placed on the same instance with the CPU=0 parameter, leading to resource contention and failure in one of the modules.  Setting CPU=0 doesn't set any limit or declare any required CPU resources at services' startup, so theoretically a service may use up as much CPU as it needs. But also theoretically ECS should do a fair job of limiting the CPU usage of a running service if other services are running at the same time.  The experiments performed in this ticket are designed to see if ECS does it job, that is, fairly regulate CPU utilization of all modules and if not, would it lead to resource starvation and 500 errors. 

https://folio-org.atlassian.net/browse/PERF-1010 

Summary

  • In Test №4, the following services were grouped per instance:

    • Instance 1: mod-circulation, mod-source-record-storage (2 tasks), okapi tasks

    • Instance 2: mod-circulation-storage (2 tasks), mod-circulation tasks

    • Instance 3: mod-source-record-manager, nginx-okapi, mod-inventory-storage, okapi, mod-inventory, mod-authorization tasks

    • Instance 4: mod-authorization, okapi, mod-inventory, mod-source-record-manager, pub-okapi, nginx-okapi, mod-inventory-storage tasks

  • During the tests, we observed that when Data Import began without CICO (Check-In Check-Out), some modules, such as mod-inventory, consumed a significant amount of CPU. However, when CICO started concurrently, mod-inventory's CPU usage decreased. Once CICO was completed, mod-inventory resumed its higher CPU usage.  This means that ECS regulates the CPU utilizations of the services and does not allow any one service to use up all CPU resources in the ec2 instance.  In all tests, there were no 500 errors observed, so the cause of the HTTP 500 bug is not due to CPU starvation, and definitely not because of setting CPU = 0. 

Test Runs

Test #

Description

Status

Test #

Description

Status

Test 1

The QCP1 Environment configuration was applied. Check In\Check Out with 30 users for one tenant on 30 minutes and Data Import - Create with 50k records files tests were run.

Completed

Test 2

The QCP1 Environment configuration was applied. Check In\Check Out with 30 users for one tenant on 30 minutes and Data Import - Create with 50k records files tests were run.

Completed

Test 3

The QCP1 Environment configuration was applied. Check In\Check Out with 30 users for one tenant on 30 minutes and Data Import - Create with 50k records files tests were run.

Completed

Test 4

The QCP1 Environment configuration was applied. Check In\Check Out with 30 users for one tenant on 30 minutes and Data Import - Create with 50k records files tests were run.

Completed

Test Results

This table contains response time for Check In\Check Out and durations for Data Import tests. 

Requests

Test №1

Test №2

Test №3

Test №4

 

Error %

Average

95th pct

Error %

Average

95th pct

Error %

Average

95th pct

Error %

Average

95th pct

Check-In Controller

1.01%

1868

2388

0.87%

1936

2308

0%

1614

2044

0%

2524

3413

Check-Out Controller

1.46%

3250

4320

1.24%

3347

3978

0.03%

2819

3551

0.06%

4548

6088

Data Import
(PTF - Create 2)

0%

Duration

1 record
failed

Duration

0%

Duration

0%

Duration

0:50:25

0:49:54

0:46:04

0:45:46

 

 

Test №1

The Baseline QCP1 Environment configuration was applied, and CPU=0 was set for all modules, ECS infrastructure was configured according to requested steps.

Results: Results had errors for authorization service.

Service CPU Utilization

Here we can see that mod-inventory module used 36% Instances CPU power before CICO started, than mod-inventory module used 27% Instances CPU power during CICO and 24% Instances CPU power after CICO.

Service Memory Utilization

Here we can see that mod-permissions used 80% memory.

 

Kafka metrics

 

DB CPU Utilization

DB CPU was 99% average with ERW: Exporting Receiving Information

DB Connections

Max number of DB connections was 900.

DB load

Top SQL-queries

Test №2

The Baseline QCP1 Environment configuration was applied, and CPU=0 was set for all modules, ECS infrastructure was configured according to requested steps.

Results: Results had errors for authorization service, problem was in Rump up periods.

Service CPU Utilization

Here we can see that mod-inventory module used 35% Instances CPU power before CICO started, than mod-inventory module used 24% Instances CPU power during CICO and 27% Instances CPU power after CICO.

Service Memory Utilization

Here we can't see any sign of memory leaks on every module. Memory shows stable trend.

 

Kafka metrics

 

 

DB CPU Utilization

DB CPU was 89%

DB Connections

Max number of DB connections was 975.

DB load

Top SQL-queries

 

Test №3

The Baseline QCP1 Environment configuration was applied, and CPU=0 was set for all modules, ECS infrastructure was configured according to requested steps, Rump up set 120 for avoid errors with authorization.

Results: Result did not have errors for authorization service, only one error with data preparation "Item is already checked out".

Service CPU Utilization

Here we can see that mod-inventory module used 34% Instances CPU power before CICO started, than mod-inventory module used 26% Instances CPU power during CICO and 25% Instances CPU power after CICO.

Service Memory Utilization

Here we can't see any sign of memory leaks on every module. Memory shows stable trend.

 

Kafka metrics

 

 

DB CPU Utilization

DB CPU was 90% maximum.

DB Connections

Max number of DB connections was 2112.

DB load

Top SQL-queries

Test №4

The Baseline QCP1 Environment configuration was applied, and CPU=0 was set for all modules, ECS infrastructure was configured according to requested steps, Rump up set 120 for avoid errors with authorization.

Results: Result did not have errors for authorization service, only two errors with data preparation "Item is already checked out".

Instance CPU Utilization

 

Tasks placement

 

Service CPU Utilization

Here we can see that mod-inventory module used 36% Instances CPU power before CICO started, than mod-inventory module used 26% Instances CPU power during CICO and 44% Instances CPU power after CICO.

Service Memory Utilization

Here we can't see any sign of memory leaks on every module. Memory shows stable trend.

Kafka metrics

 

 

DB CPU Utilization

DB CPU was 81%.

DB Connections

Max number of DB connections was 925.

DB load

Top SQL-queries

 

 

Appendix

Infrastructure

PTF - Baseline QCP1 environment configuration (was changed during testing)

  • 10 m6g.2xlarge EC2 instances located in US East (N. Virginia)us-east-1

  • 1 database  instance, writer

    Name

    Memory GIB

    vCPUs

    db.r6g.xlarge

    32 GB

    4 vCPUs

  • Open Search ptf-test 

    • Data nodes

      • Instance type - r6g.2xlarge.search

      • Number of nodes - 4

      • Version: OpenSearch_2_7_R20240502

    • Dedicated master nodes

      • Instance type - r6g.large.search

      • Number of nodes - 3

  • MSK fse-tenant

    • 2 brokers, kafka.m7g.xlarge brokers in 2 zones

    • Apache Kafka version 3.7.x 

    • EBS storage volume per broker 300 GiB

    • auto.create.topics.enable=true

    • log.retention.minutes=480

    • default.replication.factor=3

 

Cluster Resources - qcp1-pvt Wed Oct 09 08:32:57 UTC 2024 Module Task Definition Revision Module Version Task Count Mem Hard Limit Mem Soft Limit CPU Units Xmx Metaspace Size Max Metaspace Size mod-remote-storage 9 mod-remote-storage:3.2.0 2 4920 4472 1024 3960 512 512 mod-ncip 9 mod-ncip:1.14.4 2 1024 896 0 768 88 128 mod-finance-storage 9 mod-finance-storage:8.6.0 2 1024 896 1024 700 88 128 mod-sudoc 3 mod-sudoc:1.0 2 1024 896 0 768 88 128 mod-agreements 9 mod-agreements:7.0.0 2 1592 1488 0 0 0 0 mod-ebsconet 9 mod-ebsconet:2.2.0 2 1248 1024 128 700 128 256 mod-organizations 9 mod-organizations:1.9.0 2 1024 896 0 768 88 128 mod-consortia 7 mod-consortia:1.1.0 2 5136 4776 1024 4416 384 512 edge-sip2 7 edge-sip2:3.2.0-SNAPSHOT.209 2 1024 896 0 768 88 128 mod-serials-management 9 mod-serials-management:1.0.0 2 2480 2312 0 1792 384 512 mod-settings 9 mod-settings:1.0.3 2 1024 896 200 768 88 128 mod-data-import 12 mod-data-import:3.1.0 1 2048 1844 256 1292 384 512 edge-dematic 9 edge-dematic:2.2.0 1 1024 896 0 768 88 128 mod-search 9 mod-search:3.2.0 2 2592 2480 2048 1440 512 1024 mod-inn-reach 7 mod-inn-reach:3.2.0-SNAPSHOT.86 2 3600 3240 1024 2880 512 1024 mod-tags 9 mod-tags:2.2.0 2 1024 896 0 768 88 128 edge-courses 9 edge-courses:1.4.0 2 1024 896 0 768 88 128 mod-authtoken 13 mod-authtoken:2.15.1 2 1440 1152 512 922 88 128 mod-inventory-update 9 mod-inventory-update:3.3.0 2 1024 896 0 768 88 128 mod-notify 9 mod-notify:3.2.0 2 1024 896 0 768 88 128 mod-configuration 9 mod-configuration:5.10.0 2 1024 896 0 768 88 128 mod-orders-storage 9 mod-orders-storage:13.7.0 2 1024 896 512 700 88 128 edge-caiasoft 9 edge-caiasoft:2.2.0 2 1024 896 0 768 88 128 mod-login-saml 9 mod-login-saml:2.8.0 2 1024 896 0 768 88 128 mod-erm-usage-harvester 9 mod-erm-usage-harvester:4.5.0 2 1024 896 0 768 88 128 mod-licenses 9 mod-licenses:6.0.0 2 2480 2312 512 1792 384 512 mod-gobi 9 mod-gobi:2.8.0 2 1024 896 0 768 88 128 mod-password-validator 9 mod-password-validator:3.2.0 2 1440 1298 0 768 384 512 mod-bulk-operations 9 mod-bulk-operations:2.0.0 2 3072 2600 0 1536 384 512 mod-fqm-manager 9 mod-fqm-manager:2.0.1 2 1024 896 0 768 88 128 edge-dcb 9 edge-dcb:1.1.0 2 1024 896 0 768 88 128 mod-graphql 10 mod-graphql:1.12.1 2 1024 896 0 768 88 128 mod-finance 9 mod-finance:4.9.0 2 1024 896 0 768 88 128 mod-erm-usage 9 mod-erm-usage:4.7.0 2 2800 2550 1024 1800 384 512 mod-batch-print 10 mod-batch-print:1.1.0 2 1024 896 0 768 88 128 mod-copycat 9 mod-copycat:1.6.0 2 1024 896 0 768 88 128 mod-lists 9 mod-lists:2.0.0 2 1024 896 0 768 88 128 mod-entities-links 10 mod-entities-links:3.0.0 2 2592 2480 400 1440 0 1024 mod-permissions 16 mod-permissions:6.5.0 2 1684 1544 512 1024 384 512 pub-edge 5 pub-edge:2023.06.14 2 1024 896 2 768 0 0 mod-orders 9 mod-orders:12.8.0 2 2048 1740 1024 1024 384 512 edge-patron 10 edge-patron:5.1.0 2 1024 896 256 768 88 128 edge-ncip 9 edge-ncip:1.9.2 2 1024 896 0 768 88 128 mod-marc-migrations 7 mod-marc-migrations:1.0.0-SNAPSHOT.5 2 1024 896 0 768 88 128 edge-inn-reach 7 edge-inn-reach:3.1.1-SNAPSHOT.45 2 1024 896 0 768 88 128 mod-users-bl 9 mod-users-bl:7.7.0 2 1440 1152 512 922 88 128 mod-oa 8 mod-oa:2.1.0-SNAPSHOT.62 2 1024 896 0 768 88 128 mod-inventory-storage 12 mod-inventory-storage:27.1.0 2 4096 3690 2048 3076 384 512 mod-invoice 11 mod-invoice:5.8.1 2 1440 1152 512 922 88 128 mod-user-import 9 mod-user-import:3.8.0 2 1024 896 0 768 88 128 mod-sender 10 mod-sender:1.12.0 2 1024 896 0 768 88 128 edge-oai-pmh 9 edge-oai-pmh:2.9.0 2 1512 1360 1024 1440 384 512 mod-data-export-worker 9 mod-data-export-worker:3.2.1 2 3072 2800 1024 2048 384 512 mod-rtac 10 mod-rtac:3.6.0 2 1024 896 0 768 88 128 mod-circulation-storage 10 mod-circulation-storage:17.2.0 2 2880 2592 1536 1814 384 512 mod-calendar 9 mod-calendar:3.1.0 2 1024 896 0 768 88 128 mod-source-record-storage 21 mod-source-record-storage:5.8.7 2 5600 5000 2048 3500 384 512 mod-event-config 9 mod-event-config:2.7.0 2 1024 896 0 768 88 128 mod-courses 9 mod-courses:1.4.10 2 1024 896 0 768 88 128 mod-circulation-item 9 mod-circulation-item:1.0.0 2 1024 896 0 768 88 128 mod-inventory 11 mod-inventory:20.2.0 2 2880 2592 1024 1814 384 512 mod-email 9 mod-email:1.17.0 2 2800 2550 512 1800 384 512 mod-pubsub 9 mod-pubsub:2.13.0 2 1536 1440 1024 922 384 512 mod-circulation 10 mod-circulation:24.2.0 2 2880 2592 1536 1814 384 512 mod-di-converter-storage 9 mod-di-converter-storage:2.2.0 2 1024 896 0 768 88 128 edge-rtac 9 edge-rtac:2.7.1 2 1024 896 0 768 88 128 edge-orders 9 edge-orders:3.0.0 2 1024 896 0 768 88 128 mod-users 10 mod-users:19.3.1 2 1024 896 0 768 88 128 mod-template-engine 9 mod-template-engine:1.20.0 2 1024 896 0 768 88 128 mod-patron-blocks 9 mod-patron-blocks:1.10.0 2 1024 896 1024 768 88 128 mod-audit 9 mod-audit:2.9.0 2 1024 896 0 768 88 128 edge-fqm 9 edge-fqm:2.0.0 2 1024 896 0 768 88 128 mod-source-record-manager 10 mod-source-record-manager:3.9.0-SNAPSHOT.330 2 5600 5000 2048 3500 384 512 nginx-edge 5 nginx-edge:2023.06.14 2 1024 896 2 0 0 0 mod-quick-marc 11 mod-quick-marc:5.1.0 1 2288 2176 0 1664 384 512 nginx-okapi 5 nginx-okapi:2023.06.14 2 1024 896 2 0 0 0 okapi-b 8 okapi:5.3.0 3 1684 1440 2 922 384 512 mod-feesfines 9 mod-feesfines:19.1.0 2 1024 896 0 768 88 128 mod-invoice-storage 9 mod-invoice-storage:5.8.0 2 1872 1536 1024 1024 384 512 mod-dcb 10 mod-dcb:1.1.0 2 1024 896 0 768 88 128 mod-service-interaction 9 mod-service-interaction:4.0.1 2 2048 1844 256 1290 384 512 mod-data-export 22 mod-data-export:5.0.4 1 2592 2480 1024 1440 88 1024 mod-patron 10 mod-patron:6.1.0 2 1024 896 0 768 88 128 mod-oai-pmh 9 mod-oai-pmh:3.13.0 2 4096 3690 2048 3076 384 512 edge-connexion 9 edge-connexion:1.2.0 2 1024 896 0 768 88 128 mod-kb-ebsco-java 9 mod-kb-ebsco-java:4.0.0 2 1024 896 0 768 88 128 mod-notes 9 mod-notes:5.2.0 2 1024 896 0 952 384 512 mod-data-export-spring 9 mod-data-export-spring:3.2.0 1 2048 1844 256 1536 384 512 mod-organizations-storage 9 mod-organizations-storage:4.7.0 2 1024 896 0 768 88 128 mod-login 9 mod-login:7.11.0 2 1440 1298 1024 768 384 512 pub-okapi 5 pub-okapi:2023.06.14 2 1024 896 2 768 0 0 mod-eusage-reports 9 mod-eusage-reports:2.1.1 2 1024 896 0 768 88 128

 

Methodology/Approach

CICO Tests: scenarios were started for 30 users by JMeter script from load generator and concurrently run manually DI 50k records from UI. 

Baseline QCP1 Environment configuration

and steps to configure ECS infrastructure:

  • Having one ASG (auto scaling group) change instance type to be r7g.large to accelerate resource starvation for modules (baseline has r7g.2xlarge)

  • Manually unpause environment. (Not using FSE-Unpause folio job)

    • Unpause okapi, okapi-nginx, pub-okapi, mod-authtoken

    • Unpause mod-SRS, mod-SRM, mod-inventory, inventory-storage, mod-circulation, mod-circulation storage. Taking into account order of unpausing - it will place them all on instances that available now.

    • Unpause everything else by FSE-Unpause folio job (doesn’t matter placing here).

  • Test 1: The Baseline QCP1 Environment configuration was applied, and CPU=2 was set for all modules, ECS infrastructure was configured according to steps above. Check In\Check Out with 30 users for one tenant on 30 minutes and Data Import - Create with 50k records files tests were run.

  • Test 2: Repeat Test 1.

  • Test 3: Changed Rump-up period from 30 to 120 in JMeter script and run test for the same configuration like for Test 1.

  • Test 4: Restart environment and configure the same ECS infrastructure again like for Test 1 and run tests.