[Ramsons] Migrate/Update large number of Marc Authority records [NON-ECS]


Overview

This document contains the results of testing marc-migration for over 16 mln records in the Ramsons release. https://folio-org.atlassian.net/browse/PERF-929

Summary

  • The duration for marc-migration is up to 9,5 hours (7 hours mapping, 2.5 hours saving ) for default configurations with background jobs (e.g. Deleting old records from marc_indexers).
  • The best results are for test #9 with CHUNK_FETCH_IDS_COUNT=12000 and RECORDS_CHUNK_SIZE=4000 - total duration 4 hours 2 min (3 hours 35 minutes for data mapping and 27 minutes for data saving).
  • Memory utilization increased for mod-entities-links up to 75%, mod-search -62%, and mod-marc-migrations - 60% due to previous module restarting and everyday cluster shutdown processes - no memory leak is suspected for all modules.
  • CPU utilization was for mod-entities-links up to 453%, mod-search -20%, mod-marc-migrations - 15%. Average CPU usage did not exceed 10 % for all other modules. But the CPU for mod-marc-migrations is set to 0 and actual CPU usage was about 30% for the AWS instance where mod-marc-migrations was located.
  • For all tests, approximate DB CPU usage is up to 70%.

Additional tests

Test with 2 containers (tasks) for mod-marc-migrations and 2 tenants in parallel:

  • It does not work for 2 tenants in parallel, even with 2 containers for mod-marc-migrations. The 2nd job will queued with the status - "new" while the 1st is running. The 2nd job will be started and finished successfully after the 1st one.

Test with 1 container (task) for mod-marc-migrations:

  • There is no reason to use 2 containers for mod-marc-migrations because the duration for 1 container is the same as for 2 (the process uses only one mod-marc-migrations container of 2 allocated).

Recommendations and Jiras

  • Increase default CPU allocation for mod-entities-links service or set it to 0.
  • Use CHUNK_FETCH_IDS_COUNT=12000 and RECORDS_CHUNK_SIZE=4000 to decrease migration time, but mod-entities-links will use 25% more CPU.
  • Use only 1 container (task) for mod-marc-migrations.
  • While the data mapping is running, files with data will be stored directly in the working mod-marc-migrations container. Further, all files will be deleted from the container and relocated to the S3 bucket (if the S3 bucket is not provided - data mapping fails).
    If the container falls during the data mapping process - all files will be lost and data mapping will hang forever.

Results

Migrated and saved 16 462 866 records.


Configurations

Duration
Test #

CHUNK_FETCH_IDS_COUNT

RECORDS_CHUNK_SIZE

data mappingdata saving
1 *defaultdefault07:09:3102:27:48
2*50050006:00:5101:47:44
350050004:48:0701:21:40
42000100004:14:2500:45:15
4a2000100004:10:5400:46:32
54000200003:42:5400:30:56
65000250004:05:1800:35:02
6a5000250003:58:1000:34:02
77000350003:40:2300:38:46
810000500003:34:1600:33:35
912000400003:35:1500:27:19

 * - Tests were performed with enabled "Deleting old records from marc_indexers" jobs
4a - repeat of test 4

Additional testing 

Tested with 1 container for mod-marc-migrations.


Configurations

Duration
Test #

CHUNK_FETCH_IDS_COUNT

RECORDS_CHUNK_SIZE

data mappingdata saving
1012000400003:48:1100:29:12


Test with 2 containers for mod-marc-migrations and 2 tenants in parallel.



Configurations

Duration
Test # 11Records number

CHUNK_FETCH_IDS_COUNT

RECORDS_CHUNK_SIZE

Started Finisheddata mappingdata saving
Tenant 1 16 462 8661200040002024-09-17 09:372024-09-17 13:1503:38:1600:28:18
Tenant 23 514 9571200040002024-09-17 09:38 (actual mapping start 2024-09-17 13:15)2024-09-17 13:4900:34:01 (actual running time)00:06:01

Resource utilization for Test #9

Memory Utilization

  • Memory utilization increased for mod-entities-links up to 75%, mod-search -62%, and mod-marc-migrations - 60% due to previous module restarting and everyday cluster shutdown processes - no memory leak is suspected for all modules.

mod-entities-links, mod-search, mod-marc-migrations

Instance CPU Utilization

Instance CPU Utilization was up to 32%. The red line on the graph is the instance i-063e3abc2c04eb056, where one of the containers of mod-marc-migration is located.

Service CPU Utilization 

  • CPU utilization was for mod-entities-links up to453%, mod-search -20%, mod-marc-migrations - 15% (It is set to 0 in the configurations). Average CPU usage did not exceed 10 % for all other modules.


mod-entities-links, mod-search, mod-marc-migrations


RDS CPU Utilization 

  • Approximate DB CPU usage is up to 70%.

RDS Database Connections


Cluster metrics



Appendix

Infrastructure

Records count :

  • mod_entities_links.authority = 16462866

PTF -environment rcp1 

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

    NameAPI NameMemory GIBvCPUsmax_connections
    R6G Extra Largedb.r6g.xlarge32 GiB4 vCPUs2731
  • MSK fse-tenant
    • 4 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


Modules memory and CPU parameters

Cluster Resources - rcp1-pvt (Wed Sep 11 11:00:51 UTC 2024)




ModuleTask Definition RevisionModule VersionTask CountMem Hard LimitMem Soft LimitCPU UnitsXmxMetaspace SizeMax Metaspace Size
mod-remote-storage1mod-remote-storage:3.2.1-SNAPSHOT.17124920447210243960512512
mod-ncip1mod-ncip:1.14.6-SNAPSHOT.23321024896076888128
mod-finance-storage1mod-finance-storage:8.7.0-SNAPSHOT.18121024896102470088128
mod-agreements1mod-agreements:7.1.0-SNAPSHOT.2372159214880000
mod-ebsconet1mod-ebsconet:2.3.0-SNAPSHOT.80212481024128700128256
mod-organizations1mod-organizations:2.0.0-SNAPSHOT.9321024896070088128
edge-sip21edge-sip2:3.3.0-SNAPSHOT.26421024896076888128
mod-settings1mod-settings:1.0.4-SNAPSHOT.672102489620076888128
mod-serials-management1mod-serials-management:1.1.0-SNAPSHOT.4622480231201792384512
edge-dematic1edge-dematic:2.3.0-SNAPSHOT.14311024896076888128
mod-data-import1mod-data-import:3.2.0-SNAPSHOT.1891204818442561292384512
mod-search1mod-search:3.3.0-SNAPSHOT.261225922480204814405121024
mod-inn-reach1mod-inn-reach:3.2.1-SNAPSHOT.102236003240102428805121024
mod-record-specifications10mod-record-specifications:1.0.0-SNAPSHOT.421024896076888128
mod-tags1mod-tags:2.2.1-SNAPSHOT.13821024896076888128
mod-authtoken1mod-authtoken:2.16.0-SNAPSHOT.30321440115251292288128
edge-courses1edge-courses:1.5.0-SNAPSHOT.116021024896076888128
mod-notify1mod-notify:3.2.1-SNAPSHOT.26821024896076888128
mod-inventory-update1mod-inventory-update:3.4.2-SNAPSHOT.10021024896076888128
mod-configuration1mod-configuration:5.11.0-SNAPSHOT.35521024896076888128
mod-orders-storage1mod-orders-storage:13.8.0-SNAPSHOT.2432102489651270088128
edge-caiasoft1edge-caiasoft:2.3.0-SNAPSHOT.10521024896076888128
mod-login-saml1mod-login-saml:2.9.0-SNAPSHOT.29121024896076888128
mod-erm-usage-harvester1mod-erm-usage-harvester:5.0.0-SNAPSHOT.13321024896076888128
mod-password-validator1mod-password-validator:3.2.2-SNAPSHOT.1492144012980768384512
mod-gobi1mod-gobi:2.9.0-SNAPSHOT.25921024896070088128
mod-licenses1mod-licenses:6.1.0-SNAPSHOT.16322480231201792384512
edge-dcb1edge-dcb:1.2.0-SNAPSHOT.3921024896076888128
mod-bulk-operations1mod-bulk-operations:2.1.0-SNAPSHOT.11923072260010241536384512
mod-fqm-manager3mod-fqm-manager:2.1.0-SNAPSHOT.11852300026001282048384512
mod-graphql1mod-graphql:1.12.1.41221024896076888128
mod-finance1mod-finance:5.0.0-SNAPSHOT.17421024896070088128
mod-erm-usage1mod-erm-usage:5.0.0-SNAPSHOT.10921024896076888128
mod-batch-print1mod-batch-print:1.2.0-SNAPSHOT.1521024896076888128
mod-tlr2mod-tlr:1.0.0-SNAPSHOT.821024896076888128
mod-lists2mod-lists:2.1.0-SNAPSHOT.130021024896076888128
mod-copycat1mod-copycat:1.6.1-SNAPSHOT.20821024512076888128
mod-entities-links4mod-entities-links:3.1.0-SNAPSHOT.113225922480400144001024
mod-permissions2mod-permissions:6.6.0-SNAPSHOT.3852168415445121024384512
pub-edge1pub-edge:2023.06.1421024896076800
mod-orders1mod-orders:12.9.0-SNAPSHOT.39822048144010241024384512
edge-patron1edge-patron:5.2.0-SNAPSHOT.1742102489625676888128
edge-ncip1edge-ncip:1.10.2-SNAPSHOT.11621024896076888128
mod-marc-migrations22mod-marc-migrations:1.0.0-SNAPSHOT.821024896076888128
edge-inn-reach1edge-inn-reach:3.3.0-SNAPSHOT.6921024896076888128
mod-users-bl1mod-users-bl:7.9.0-SNAPSHOT.31821440115251292288128
mod-oa1mod-oa:2.1.0-SNAPSHOT.6621024896076888128
mod-invoice1mod-invoice:5.9.0-SNAPSHOT.20521440115251292288128
mod-inventory-storage2mod-inventory-storage:27.2.0-SNAPSHOT.76424096369020483076384512
mod-user-import1mod-user-import:3.9.0-SNAPSHOT.19721024896076888128
mod-sender1mod-sender:1.12.1-SNAPSHOT.10021024896076888128
edge-oai-pmh1edge-oai-pmh:2.10.0-SNAPSHOT.17421512136010241440384512
mod-data-export-worker1mod-data-export-worker:3.3.0-SNAPSHOT.23323072204810242048384512
mod-rtac1mod-rtac:3.7.0-SNAPSHOT.20321024896076888128
mod-circulation-storage1mod-circulation-storage:17.3.0-SNAPSHOT.40522880259215361814384512
mod-source-record-storage2mod-source-record-storage:5.9.0-SNAPSHOT.40525600500020483500384512
mod-calendar2mod-calendar:3.2.0-SNAPSHOT.22921024896076888128
mod-event-config1mod-event-config:2.7.2-SNAPSHOT.11021024896076888128
mod-courses1mod-courses:1.4.11-SNAPSHOT.15521024896076888128
mod-circulation-item1mod-circulation-item:1.0.1-SNAPSHOT.26210248960000
mod-inventory1mod-inventory:20.3.0-SNAPSHOT.54622880259210241814384512
mod-email1mod-email:1.17.1-SNAPSHOT.12821024896076888128
mod-requests-mediated10mod-requests-mediated:1.0.0-SNAPSHOT.421024896076888128
mod-di-converter-storage1mod-di-converter-storage:2.3.0-SNAPSHOT.12421024896076888128
mod-pubsub1mod-pubsub:2.15.0-SNAPSHOT.2242153614401024922384512
mod-circulation1mod-circulation:24.3.0-SNAPSHOT.68122880259215361814384512
edge-orders1edge-orders:3.1.0-SNAPSHOT.15621024896076888128
edge-rtac1edge-rtac:2.7.3-SNAPSHOT.23421024896076888128
mod-template-engine1mod-template-engine:1.20.1-SNAPSHOT.11821024896076888128
mod-users1mod-users:19.3.2-SNAPSHOT.69621024896076888128
mod-patron-blocks1mod-patron-blocks:1.11.0-SNAPSHOT.16321024896102476888128
mod-audit1mod-audit:2.9.1-SNAPSHOT.21621024896076888128
edge-fqm1edge-fqm:2.1.0-SNAPSHOT.10021024896076888128
mod-source-record-manager1mod-source-record-manager:3.9.0-SNAPSHOT.35325600500020483500384512
nginx-edge1nginx-edge:2023.06.14210248960000
mod-quick-marc1mod-quick-marc:5.2.0-SNAPSHOT.15312288217601664384512
nginx-okapi1nginx-okapi:2023.06.14210248960000
okapi-b1okapi:5.3.03168414401024922384512
mod-feesfines1mod-feesfines:19.2.0-SNAPSHOT.19821024896076888128
mod-invoice-storage1mod-invoice-storage:5.9.0-SNAPSHOT.13821872153610241024384512
mod-reading-room2mod-reading-room:1.0.0-SNAPSHOT.1221024896076888128
mod-service-interaction1mod-service-interaction:4.1.0-SNAPSHOT.1262204818442561290384512
mod-dcb1mod-dcb:1.1.3-SNAPSHOT.4021024896076888128
mod-data-export1mod-data-export:5.1.0-SNAPSHOT.2401204815241024000
mod-patron1mod-patron:6.2.0-SNAPSHOT.16521024896076888128
mod-oai-pmh1mod-oai-pmh:3.14.0-SNAPSHOT.40224096369020483076384512
edge-connexion1edge-connexion:1.4.0-SNAPSHOT.8821024896076888128
mod-notes1mod-notes:5.3.0-SNAPSHOT.325210248960952384512
mod-kb-ebsco-java1mod-kb-ebsco-java:4.2.0-SNAPSHOT.17821024896076888128
mod-login1mod-login:7.12.0-SNAPSHOT.3242144012981024768384512
mod-organizations-storage1mod-organizations-storage:4.8.0-SNAPSHOT.13121024896070088128
mod-data-export-spring1mod-data-export-spring:3.3.1-SNAPSHOT.1671204818442561536384512
pub-okapi1pub-okapi:2023.06.1421024896076800
mod-eusage-reports1mod-eusage-reports:3.0.0-SNAPSHOT.7321024896076888128

Methodology/Approach

To test Baseline for marc-migration JMeter scripts were used.

Test preparation: 

  • Background 'Deleting old records from marc_indexers' jobs were disabled:
    added configuration to mod-source-record-storage
                    {
                        "name": "srs.marcIndexers.delete.interval.seconds",
                        "value": "86400"
                    },
  • 16 mln Marc Authority records added to the database

Check Migration Operation from the database:
- select end_time_mapping - start_time_mapping as mapping_duration,end_time_saving - start_time_saving as saving_duration,* from {tenant}_mod_marc_migrations.operation order by start_time_mapping desc

More info workflows-scripts/marc-migration/readme.md