ECS [Ramsons] Migrate/Update Large number BIB records

ECS [Ramsons] Migrate/Update Large number BIB records

Overview

In production when mapping rules are changed - there’s a need to run migration process using mod-marc-migration module API. The whole process consist of two stages: data mapping and data saving.

The goal of this round of testing is to observe and measure the marc-migration process duration in ECS environment from Central tenant and member tenants, and find any possible issues and or performance problems.

Tests were done with two parameter sets (CHUNK_FETCH_IDS_COUNT, RECORDS_CHUNK_SIZE). The first tests were with optimal parameters defined in report for authority migration (12000 and 4000 accordingly). The second tests were with default parameters (500, 500)

Original ticket: https://folio-org.atlassian.net/browse/PERF-1045

Summary

  • Tests performed on two tenants (central and member).

  • All data mapping processes finished successfully.

    • No issues or errors found during data mapping process.

    • It consumes up to 25% CPU on mod-marc-migration service and up to 20-22% of DB CPU.

  • All tests got different success rate on data saving, however tests for central and member tenant with parameters: “CHUNK_FETCH_IDS_COUNT = 500, RECORDS_CHUNK_SIZE = 500” got highest number of saved instances (89% for central tenant, 99% for member tenant).

    • Records failed to save because of issue found in DB logs - optimistic locking.

    • During data saving process runtime reindexing happening on the background (mod-search) causing high DB load for a long time (more than 1,5 hours) after data saving is completed.

    • Deadlocks is observed in DB, however they not causing any issues with marc-migration process as this deadlocks happens on mod-search schemas.

    • During data saving CPU usage on mod-marc-migration was 5% and 3% on mod-inventory-storage.

    • DB CPU reached 100% and stayed high even after process finished doe to mod-search runtime reindexing.

    • No signs of memory leaks found during all tests

  • It’s clearly visible in test results that there’s small success rate of data saving with high values for CHUNK_FETCH_IDS_COUNT and RECORDS_CHUNK_SIZE parameters. mod-marc-migration is probably failing to save data because of high load caused by mod-search on CPU during data saving, probably batch update transaction is taking to long to complete and issue Apparent connection leak detected happening. mod-marc-migration doing retry of the same batch and getting back optimistic lock for records, as some records already completed with current batch in previous try.

Recommendations & Jiras (Optional)

 

Test Runs/Results 

 

Test #

Test Conditions

Mapping

Saving

Notes

(Optional)

mapped records

Mapping duration  

Status

saved records

Saving duration

Status

 

1.

CHUNK_FETCH_IDS_COUNT = 12000

RECORDS_CHUNK_SIZE = 4000

1160063

10 min 10 s

success

4063

1 hr 30 min

failed

central tenant

2.

CHUNK_FETCH_IDS_COUNT = default 500

RECORDS_CHUNK_SIZE = default 500

1160063

17 min

success

1043563

3 hr 46 min

failed

central tenant

3.

CHUNK_FETCH_IDS_COUNT = default 500

RECORDS_CHUNK_SIZE = default 500

1460010*

23 min

success

1459010

2 hr 33 min

failed

member tenant

4.

CHUNK_FETCH_IDS_COUNT = 12000

RECORDS_CHUNK_SIZE = 4000

1460010*

18 min

success

8010

1 hr 31 min

failed

member tenant

 

Note: in test 3 and 4 different umber of instances mapped as in between tests few data import were performed.

Memory Utilization

Memory utilization across all modules was stable, with no memory leaks observed. The most heavily used module, mod-marc-migrations, experienced an increase in memory usage from 25% to approximately 80% during testing with 'Optimal configurations.' However, after the process was completed, memory usage stabilized and returned to normal levels

image-20250212-102117.png

 

CPU Utilization 

CPU utilization during the data-saving process was stable and returned to normal levels after the test was completed. The most utilized service was mod-consortia, with a peak usage of approximately 4.5%. The entire process, including reindexing by mod-search, took approximately 4 hours. With 'Optimal configurations,' the data-saving process was faster by about 1 hour and 30 minutes compared to the default configuration, where it took 2 hours and 40 minutes.

image-20250212-102458.png

Here is the CPU usage of the mod-marc-migrations module during the data-mapping process. It is evident that mod-marc-migrations can handle high loads and return to normal resource usage after the process is completed.

Note: Once the data-mapping process is finished, the CPU usage of mod-marc-migrations becomes less noticeable, as most of the logic for the next step (data saving) occurs on the database side.

 

RDS CPU Utilization 

DB CPU usage reached 100% during data saving

NOTE: ater data saving finished (see the marks on screenshot) runtime reindexing did proceed and occupied more that 90% of DB CPU for additional time.

 

image-20250212-102939.png

During data saving process a lot of deadlock found. This deadlocks happening on mod-search side and does not affect data saving process.

image-20250212-104656.png

 

image-20250212-105212.png
image-20250212-105333.png

 

image-20250212-105527.png
image-20250212-105637.png
image-20250212-110424.png

Errors

mod-marc-migration error:

13:46:25 [] [] [] [] WARN ProxyLeakTask Connection leak detection triggered for org.postgresql.jdbc.PgConnection@7a388818 on thread chunksProcessingExecutor-5, stack trace follows java.lang.Exception: Apparent connection leak detected at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:127) ~[HikariCP-5.1.0.jar!/:?] at org.folio.spring.config.DataSourceFolioWrapper.getConnection(DataSourceFolioWrapper.java:46) ~[folio-spring-base-8.2.0.jar!/:8.2.0] at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) ~[hibernate-core-6.5.3.Final.jar!/:6.5.3.Final] at org.hibernate.internal.NonContextualJdbcConnectionAccess.obtainConnection(NonContextualJdbcConnectionAccess.java:46) ~[hibernate-core-6.5.3.Final.jar!/:6.5.3.Final] at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:126) ~[hibernate-core-6.5.3.Final.jar!/:6.5.3.Final] at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.getPhysicalConnection(LogicalConnectionManagedImpl.java:156) ~[hibernate-core-6.5.3.Final.jar!/:6.5.3.Final] at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.getConnectionForTransactionManagement(LogicalConnectionManagedImpl.java:286) ~[hibernate-core-6.5.3.Final.jar!/:6.5.3.Final] at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.begin(LogicalConnectionManagedImpl.java:294) ~[hibernate-core-6.5.3.Final.jar!/:6.5.3.Final] at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.begin(JdbcResourceLocalTransactionCoordinatorImpl.java:232) ~[hibernate-core-6.5.3.Final.jar!/:6.5.3.Final] at org.hibernate.engine.transaction.internal.TransactionImpl.begin(TransactionImpl.java:83) ~[hibernate-core-6.5.3.Final.jar!/:6.5.3.Final] at org.springframework.orm.jpa.vendor.HibernateJpaDialect.beginTransaction(HibernateJpaDialect.java:176) ~[spring-orm-6.1.14.jar!/:6.1.14] at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:420) ~[spring-orm-6.1.14.jar!/:6.1.14] at org.springframework.transaction.support.AbstractPlatformTransactionManager.startTransaction(AbstractPlatformTransactionManager.java:532) ~[spring-tx-6.1.14.jar!/:6.1.14] at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:405) ~[spring-tx-6.1.14.jar!/:6.1.14] at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:137) ~[spring-tx-6.1.14.jar!/:6.1.14] at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:255) ~[spring-batch-core-5.1.2.jar!/:5.1.2] at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:82) ~[spring-batch-core-5.1.2.jar!/:5.1.2] at org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate$ExecutingRunnable.run(TaskExecutorRepeatTemplate.java:261) ~[spring-batch-infrastructure-5.1.2.jar!/:5.1.2] at org.folio.spring.scope.FolioExecutionScopeExecutionContextManager.lambda$getRunnableWithFolioContext$0(FolioExecutionScopeExecutionContextManager.java:94) ~[folio-spring-base-8.2.0.jar!/:8.2.0] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?] at java.base/java.lang.Thread.run(Unknown Source) [?:?] 13:46:25 [] [] [] [] WARN BulkStorageService Failed to save entities with type INSTANCE specified with file path: operation/4db21b1f-2354-42ec-a78d-275515a37e42/f54f9418-dd94-48ef-91f5-15c1daf1d2df_entity 13:46:25 [] [] [] [] INFO ProxyLeakTask Previously reported leaked connection org.postgresql.jdbc.PgConnection@7a388818 on thread chunksProcessingExecutor-5 was returned to the pool (unleaked) 13:46:26 [184008/marc-migrations] [cs00000int_0001] [0f4eb7c2-05dd-4559-81ae-0c8e8cb95bc1] [mod-marc-migrations] WARN ProxyLeakTask Connection leak detection triggered for org.postgresql.jdbc.PgConnection@67906bca on thread chunksProcessingExecutor-6, stack trace follows

DB Errors:

2025-02-12 13:25:12 UTC:10.23.34.46(47780):cs00000int_0001_mod_inventory_storage@folio:[25207]:ERROR: Cannot update record 380e8ef5-1f80-465f-bebd-7e736c068329 because it has been changed (optimistic locking): Stored _version is 4, _version of request is 3 2025-02-12 13:25:12 UTC:10.23.34.46(47780):cs00000int_0001_mod_inventory_storage@folio:[25207]:CONTEXT: PL/pgSQL function instance_set_ol_version() line 15 at RAISE SQL statement "UPDATE cs00000int_0001_mod_inventory_storage.instance SET jsonb=$3 WHERE id=$2 RETURNING id" PL/pgSQL function upsert(text,uuid,anyelement) line 5 at EXECUTE
2025-02-12 16:12:50 UTC:10.23.34.21(54784):folio@folio:[22461]:ERROR: deadlock detected

Appendix

Infrastructure

PTF -environment rcon

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

  • db.r6.xlarge database instances, writer

  • MSK fse-test

    • 4 kafka.m7g.xlarge brokers in 2 zones

    • Apache Kafka version 3.7.x (KRaft mode)

    • EBS storage volume per broker 300 GiB

    • auto.create.topics.enable=true

    • log.retention.minutes=480

    • default.replication.factor=3

  • OpenSearch 2.13 ptf-test cluster

    • r6g.2xlarge.search 4 data nodes

    • r6g.large.search 3 dedicated master nodes

Cluster Resources - rcon

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 11 mod-remote-storage:3.3.4 2 4920 4472 0 3960 512 512 mod-finance-storage 8 mod-finance-storage:8.7.3 2 1024 896 0 700 88 128 mod-ncip 8 mod-ncip:1.15.6 2 1024 896 0 768 88 128 mod-agreements 11 mod-agreements:7.1.5 2 1592 1488 0 0 0 0 mod-ebsconet 9 mod-ebsconet:2.3.1 2 1248 1024 0 700 128 256 mod-organizations 8 mod-organizations:2.0.0 2 1024 896 0 700 88 128 mod-consortia 10 mod-consortia:1.2.2 2 5136 4776 0 2048 512 1024 edge-sip2 10 edge-sip2:3.3.1 2 1024 896 0 768 88 128 mod-serials-management 11 mod-serials-management:1.1.3 2 2480 2312 0 1792 384 512 mod-settings 8 mod-settings:1.1.0 2 1024 896 0 768 88 128 mod-data-import 11 mod-data-import:3.2.4 1 2048 1844 0 1292 384 512 mod-search 21 mod-search:4.0.8 2 2592 2480 0 1440 512 1024 edge-dematic 8 edge-dematic:2.3.1 1 1024 896 0 768 88 128 mod-inn-reach 4 mod-inn-reach:3.2.1-SNAPSHOT.102 2 3600 3240 0 2880 512 1024 mod-record-specifications 8 mod-record-specifications:1.0.2 2 1024 896 0 768 88 128 mod-tags 8 mod-tags:2.3.0 2 1024 896 0 768 88 128 mod-authtoken 10 mod-authtoken:2.16.1 2 1440 1152 1024 922 88 128 edge-courses 9 edge-courses:1.5.1 2 1024 896 0 768 88 128 mod-notify 8 mod-notify:3.3.0 2 1024 896 0 768 88 128 mod-inventory-update 8 mod-inventory-update:4.0.0 2 1024 896 0 768 88 128 mod-configuration 8 mod-configuration:5.11.0 2 1024 896 0 768 88 128 mod-orders-storage 8 mod-orders-storage:13.8.3 2 1024 896 0 700 88 128 edge-caiasoft 8 edge-caiasoft:2.3.2 2 1024 896 0 768 88 128 mod-login-saml 8 mod-login-saml:2.9.3 2 1024 896 0 768 88 128 mod-erm-usage-harvester 10 mod-erm-usage-harvester:5.0.2 2 1024 896 0 768 88 128 mod-gobi 8 mod-gobi:2.9.0 2 1024 896 0 700 88 128 mod-licenses 8 mod-licenses:6.1.2 2 2480 2312 0 1792 384 512 mod-password-validator 8 mod-password-validator:3.3.0 2 1440 1298 0 768 384 512 edge-dcb 11 edge-dcb:1.2.2 2 1024 896 0 768 88 128 mod-bulk-operations 9 mod-bulk-operations:2.1.11 2 3072 2600 0 1536 384 512 mod-fqm-manager 11 mod-fqm-manager:3.0.10 2 3000 2600 0 768 88 128 mod-graphql 10 mod-graphql:1.13.1 2 1024 896 0 768 88 128 mod-finance 9 mod-finance:5.0.1 2 1024 896 0 700 88 128 mod-erm-usage 8 mod-erm-usage:5.0.0 2 2800 2550 0 1800 384 512 mod-batch-print 8 mod-batch-print:1.2.0 2 1024 896 0 768 88 128 mod-tlr 4 mod-tlr:1.0.0-SNAPSHOT.8 2 1024 896 0 768 88 128 mod-lists 15 mod-lists:3.0.8 2 6000 2600 0 768 88 128 mod-copycat 8 mod-copycat:1.7.0 2 1024 512 0 768 88 128 mod-entities-links 12 mod-entities-links:3.1.3 2 2592 2480 0 1440 0 1024 mod-permissions 16 mod-permissions:6.6.1 2 1684 1544 512 1024 384 512 pub-edge 7 pub-edge:2023.06.14 2 1024 896 0 768 0 0 mod-orders 12 mod-orders:12.9.10 2 2048 1740 0 1024 384 512 edge-patron 9 edge-patron:5.2.1 2 1024 896 0 768 88 128 mod-marc-migrations 27 mod-marc-migrations:1.0.1 2 1024 896 0 768 88 128 edge-ncip 9 edge-ncip:1.10.1 2 1024 896 0 768 88 128 edge-inn-reach 5 edge-inn-reach:3.3.0-SNAPSHOT.69 2 1024 896 0 768 88 128 mod-users-bl 8 mod-users-bl:7.9.3 2 1440 1152 0 922 88 128 mod-oa 4 mod-oa:2.1.0-SNAPSHOT.66 2 1024 896 0 768 88 128 mod-inventory-storage 17 mod-inventory-storage:28.1.0-SNAPSHOT.792 8 4096 3690 0 3076 512 1024 mod-invoice 9 mod-invoice:5.9.2 2 1440 1152 0 922 88 128 mod-user-import 8 mod-user-import:3.9.0 2 1024 896 0 768 88 128 mod-sender 8 mod-sender:1.13.0 2 1024 896 0 768 88 128 edge-oai-pmh 8 edge-oai-pmh:2.10.0 2 1512 1360 0 1440 384 512 mod-data-export-worker 11 mod-data-export-worker:3.3.8 2 3072 2048 0 2048 384 512 mod-rtac 8 mod-rtac:3.7.0 2 1024 896 0 768 88 128 mod-circulation-storage 11 mod-circulation-storage:17.3.5 2 2880 2592 0 1814 384 512 mod-source-record-storage 17 mod-source-record-storage:5.9.7 2 5600 5000 0 3500 384 512 mod-calendar 8 mod-calendar:3.2.0 2 1024 896 0 768 88 128 mod-event-config 8 mod-event-config:2.8.0 2 1024 896 0 768 88 128 mod-courses 9 mod-courses:1.4.11 2 1024 896 0 768 88 128 mod-circulation-item 8 mod-circulation-item:1.1.0 2 1024 896 0 0 0 0 mod-inventory 12 mod-inventory:21.0.9 2 2880 2592 0 1814 384 512 mod-email 9 mod-email:1.18.1 2 2800 2550 0 1800 384 512 mod-requests-mediated 4 mod-requests-mediated:1.0.0-SNAPSHOT.4 2 1024 896 0 768 88 128 mod-circulation 11 mod-circulation:24.3.11 2 2880 2592 0 1814 384 512 mod-pubsub 11 mod-pubsub:2.15.4 2 1536 1440 0 922 384 512 mod-di-converter-storage 10 mod-di-converter-storage:2.3.1 2 1024 896 0 768 88 128 edge-rtac 8 edge-rtac:2.8.0 2 1024 896 0 768 88 128 edge-orders 8 edge-orders:3.1.0 2 1024 896 0 768 88 128 mod-users 9 mod-users:19.4.5 2 1024 896 0 768 88 128 mod-template-engine 8 mod-template-engine:1.21.0 2 1024 896 0 768 88 128 mod-patron-blocks 8 mod-patron-blocks:1.11.1 2 1024 896 0 768 88 128 mod-audit 9 mod-audit:2.10.2 2 1024 896 0 768 88 128 edge-fqm 10 edge-fqm:3.0.2 2 1024 896 0 768 88 128 mod-source-record-manager 11 mod-source-record-manager:3.9.7 2 5600 5000 0 3500 384 512 nginx-edge 7 nginx-edge:2023.06.14 2 1024 896 0 0 0 0 mod-quick-marc 8 mod-quick-marc:6.0.0 1 2288 2176 0 1664 384 512 nginx-okapi 7 nginx-okapi:2023.06.14 2 1024 896 0 0 0 0 okapi-b 9 okapi:6.1.1 3 1684 1440 0 922 384 512 mod-feesfines 10 mod-feesfines:19.2.2 2 1024 896 0 768 88 128 mod-invoice-storage 8 mod-invoice-storage:5.9.1 2 1872 1536 0 1024 384 512 mod-reading-room 8 mod-reading-room:1.0.0 2 1024 896 0 768 88 128 mod-dcb 11 mod-dcb:1.2.6 2 1024 896 0 768 88 128 mod-service-interaction 8 mod-service-interaction:4.1.1 2 2048 1844 0 1290 384 512 mod-patron 11 mod-patron:6.2.6 2 1024 896 0 768 88 128 mod-data-export 16 mod-data-export:5.1.6 1 2048 1844 0 0 0 0 mod-oai-pmh 10 mod-oai-pmh:3.14.4 2 4096 3690 0 3076 384 512 edge-connexion 8 edge-connexion:1.3.1 2 1024 896 0 768 88 128 mod-notes 8 mod-notes:6.0.0 2 1024 896 0 952 384 512 mod-kb-ebsco-java 9 mod-kb-ebsco-java:5.0.0 2 1024 896 0 768 88 128 mod-organizations-storage 8 mod-organizations-storage:4.8.1 2 1024 896 0 700 88 128 mod-data-export-spring 9 mod-data-export-spring:3.4.3 1 2048 1844 0 1536 384 512 mod-login 8 mod-login:7.12.1 2 1440 1298 0 768 384 512 pub-okapi 7 pub-okapi:2023.06.14 2 1024 896 0 768 0 0 edge-erm 6 edge-erm:1.3.0 2 1024 896 0 768 88 128 mod-eusage-reports 8 mod-eusage-reports:3.0.0 2 1024 896 0 768 88 128

 

R - Ramsons release

Record type

Number of records

Record type

Number of records

Instances

1 160 063

Holdings

1 348 036

Items

2 091 901

Methodology/Approach

  1. Initiate the migration operation for instances by sending a POST request to the /marc-migrations endpoint with the following request body:

    { "entityType": "instance", "operationType": "remapping" }
  2. Track the status of the data mapping phase by sending GET requests to the /marc-migrations/{operationId} endpoint, where {operationId} is the id of the migration job received in response from the 1-st step. During the ongoing data mapping, the "status" field in the response will be data_mapping. Upon completing the data mapping step successfully the job status changes to data_saving_completed. If errors occur, the status will be data_saving_failed. Also, when data mapping is completed successfully the mappedNumOfRecords field should be equal to the totalNumOfRecords field value. The duration of the data mapping process can be measured using startTimeMapping and endTimeMapping fields from the endpoint response.

  3. Once the data mapping process has been successfully completed, initiate the data saving step by sending a PUT request to the /marc-migrations/{operationId} endpoint with the following request body:

    { "status": "data_saving" }

    Receiving 204 status code in a response indicates that the data saving step has initiated. Track the status of this step using the GET endpoint described in 2-nd step. The status in the response will display data_saving when the job is in progress and will change to data_saving_completed or data_saving_failed upon completion. Similar to data mapping, savedNumOfRecords field should be equal to totalNumOfRecords field when the data saving step is completed successfully. The duration of the data saving step can be measured using startTimeSaving and endTimeSaving fields from response of the endpoint described in the 2-nd step

  4. Adjust needed parameters in task definition of mod-marc-migration CHUNK_FETCH_IDS_COUNT = X, RECORDS_CHUNK_SIZE = Y and repeat tests.

Additional Screenshots of graphs or charts

Client-side logs:

Test 1

{"id":"3cece4e4-2c6a-48f9-aa0a-4d2e92b4b25c","userId":"9f9d1c46-52e1-4bb7-9c6c-56e6bb945c42","entityType":"instance","operationType":"remapping","status":"data_saving_failed","totalNumOfRecords":1160063,"mappedNumOfRecords":1160063,"savedNumOfRecords":4063,"startTimeMapping":"2025-02-10T13:11:55.919082Z","endTimeMapping":"2025-02-10T13:22:11.999588Z","startTimeSaving":"2025-02-10T13:28:32.416862Z","endTimeSaving":"2025-02-10T14:41:11.265436Z"}

Test 2

{"id":"e6480683-9130-4a6c-bc11-983aba886375","userId":"9f9d1c46-52e1-4bb7-9c6c-56e6bb945c42","entityType":"instance","operationType":"remapping","status":"data_saving_failed","totalNumOfRecords":1160063,"mappedNumOfRecords":1160063,"savedNumOfRecords":1043563,"startTimeMapping":"2025-02-10T19:08:11.806591Z","endTimeMapping":"2025-02-10T19:25:02.508308Z","startTimeSaving":"2025-02-10T19:38:07.026149Z","endTimeSaving":"2025-02-10T23:24:19.756021Z"}

Additional Re-testing

Purpose

As defined in report above each test failed with a different % of completion on data saving part of Marc-migration process. It’s reported from different teams that they faced with same issues in production cluster as well. The primary issue is DB that leaks connections during data saving process - leading to fail of whole batch. The purpose of additional testing is to define recommendations for Marc-migrations process when it has a higher chances to complete successfully data saving.

Test #

conditions

records mapping

records saving

status

full log

number of records

duration

number of records

duration

1

Default parameters + 8 inventory-storage tasks. + mod-search 0 tasks

1160063

13 min

1159563

1 hr 8 min

data_saving_failed

{"id":"36fd726b-d9ad-49ca-847b-39fbf817ed96","userId":"9f9d1c46-52e1-4bb7-9c6c-56e6bb945c42","entityType":"instance","operationType":"remapping","status":"data_saving_failed","totalNumOfRecords":1160063,"mappedNumOfRecords":1160063,"savedNumOfRecords":1159563,"startTimeMapping":"2025-03-18T16:38:19.055146Z","endTimeMapping":"2025-03-18T16:51:18.980482Z","startTimeSaving":"2025-03-18T16:53:26.910386Z","endTimeSaving":"2025-03-18T18:01:59.873977Z"}

2

Default parameters + 8 inventory-storage tasks. + mod-search 0 tasks

1160063

16 min

1134563

2 hr 35 min

data_saving_failed

{"id":"b42c0192-5567-4f2e-88da-514e07be1d65","userId":"9f9d1c46-52e1-4bb7-9c6c-56e6bb945c42","entityType":"instance","operationType":"remapping","status":"data_saving_failed","totalNumOfRecords":1160063,"mappedNumOfRecords":1160063,"savedNumOfRecords":1134563,"startTimeMapping":"2025-03-18T18:53:06.383838Z","endTimeMapping":"2025-03-18T19:09:32.368308Z","startTimeSaving":"2025-03-18T19:12:18.676413Z","endTimeSaving":"2025-03-18T21:47:41.654557Z"}

3

Max. parameters + 8 inventory-storage tasks. + mod-search 0 tasks

1160063

12 min

948063

1 hr 5 min

data_saving_failed

{"id":"942638d0-7f0a-4a2b-90e2-4797b143659e","userId":"9f9d1c46-52e1-4bb7-9c6c-56e6bb945c42","entityType":"instance","operationType":"remapping","status":"data_saving_failed","totalNumOfRecords":1160063,"mappedNumOfRecords":1160063,"savedNumOfRecords":948063,"startTimeMapping":"2025-03-19T08:42:51.133618Z","endTimeMapping":"2025-03-19T08:55:26.476859Z","startTimeSaving":"2025-03-19T09:00:05.251451Z","endTimeSaving":"2025-03-19T10:05:53.990689Z"}

4

Max. parameters + 8 inventory-storage tasks. + mod-search 0 tasks

1160063

12 min

1004063

1 hr 5 min

data_saving_failed

{"id":"231ff8ee-b156-4437-9b01-cd3808baf5e3","userId":"9f9d1c46-52e1-4bb7-9c6c-56e6bb945c42","entityType":"instance","operationType":"remapping","status":"data_saving_failed","totalNumOfRecords":1160063,"mappedNumOfRecords":1160063,"savedNumOfRecords":1004063,"startTimeMapping":"2025-03-19T10:23:25.612313Z","endTimeMapping":"2025-03-19T10:35:58.560171Z","startTimeSaving":"2025-03-19T10:38:53.360296Z","endTimeSaving":"2025-03-19T11:44:36.38642Z"}

5

Max. parameters + 8 inventory-storage tasks. + mod-search 0 tasks+ 2x DB

1160063

12 min

1076063

27 min

data_saving_failed

{"id":"9e223f6b-064b-470b-b6d2-baa5f01403d7","userId":"9f9d1c46-52e1-4bb7-9c6c-56e6bb945c42","entityType":"instance","operationType":"remapping","status":"data_saving_failed","totalNumOfRecords":1160063,"mappedNumOfRecords":1160063,"savedNumOfRecords":1076063,"startTimeMapping":"2025-03-19T12:23:27.587224Z","endTimeMapping":"2025-03-19T12:36:17.00795Z","startTimeSaving":"2025-03-19T12:58:00.215716Z","endTimeSaving":"2025-03-19T13:25:30.475634Z"}

6

Max. parameters + 8 inventory-storage tasks. + mod-search 0 tasks + 2x DB

1160063

11 min

1160063

25 min

data_saving_completed

{"id":"3e482183-1f69-4aad-bea1-c56d069b914f","userId":"9f9d1c46-52e1-4bb7-9c6c-56e6bb945c42","entityType":"instance","operationType":"remapping","status":"data_saving_completed","totalNumOfRecords":1160063,"mappedNumOfRecords":1160063,"savedNumOfRecords":1160063,"startTimeMapping":"2025-03-19T13:54:36.720515Z","endTimeMapping":"2025-03-19T14:06:15.434284Z","startTimeSaving":"2025-03-19T14:14:45.278894Z","endTimeSaving":"2025-03-19T14:39:46.047422Z"}

7

Default parameters+ 8 inventory-storage tasks. + mod-search 0 tasks + 2x DB

1160063

14 min

1158063

26 min

data_saving_failed

{"id":"e9bcaddb-e19c-4709-b077-4d1249a7228b","userId":"9f9d1c46-52e1-4bb7-9c6c-56e6bb945c42","entityType":"instance","operationType":"remapping","status":"data_saving_failed","totalNumOfRecords":1160063,"mappedNumOfRecords":1160063,"savedNumOfRecords":1158063,"startTimeMapping":"2025-03-19T14:56:25.391714Z","endTimeMapping":"2025-03-19T15:11:09.00628Z","startTimeSaving":"2025-03-19T15:49:23.976856Z","endTimeSaving":"2025-03-19T16:16:02.36157Z"}

8

Default parameters+ 8 inventory-storage tasks. + mod-search 0 tasks + 2x DB

1160063

13 min

1160063

26 min

data_saving_completed

{"id":"57b92972-bd37-40a0-b103-d4f707df6c7b","userId":"9f9d1c46-52e1-4bb7-9c6c-56e6bb945c42","entityType":"instance","operationType":"remapping","status":"data_saving_completed","totalNumOfRecords":1160063,"mappedNumOfRecords":1160063,"savedNumOfRecords":1160063,"startTimeMapping":"2025-03-19T16:26:41.537539Z","endTimeMapping":"2025-03-19T16:40:35.574722Z","startTimeSaving":"2025-03-19T16:47:22.551104Z","endTimeSaving":"2025-03-19T17:13:45.975379Z"}

9

Default parameters + 8 inventory-storage tasks. + mod-search 0 tasks + 2x DB

1160063

13 min

1160063

26 min

data_saving_completed

{"id":"77911057-4939-46d2-9e0d-5f5daebbd47d","userId":"9f9d1c46-52e1-4bb7-9c6c-56e6bb945c42","entityType":"instance","operationType":"remapping","status":"data_saving_completed","totalNumOfRecords":1160063,"mappedNumOfRecords":1160063,"savedNumOfRecords":1160063,"startTimeMapping":"2025-03-19T17:23:57.990726Z","endTimeMapping":"2025-03-19T17:37:57.180033Z","startTimeSaving":"2025-03-19T17:43:59.02782Z","endTimeSaving":"2025-03-19T18:10:30.057546Z"}

10

Default parameters + 8 inventory-storage tasks. + mod-search 2 tasks+ 2x DB

1160063

14 min

1160063

39 min

data_saving_completed

{"id":"ae672900-a342-4de5-8fde-b7a7d1813413","userId":"9f9d1c46-52e1-4bb7-9c6c-56e6bb945c42","entityType":"instance","operationType":"remapping","status":"data_saving_completed","totalNumOfRecords":1160063,"mappedNumOfRecords":1160063,"savedNumOfRecords":1160063,"startTimeMapping":"2025-03-19T18:18:58.855291Z","endTimeMapping":"2025-03-19T18:33:11.903985Z","startTimeSaving":"2025-03-19T18:41:46.860359Z","endTimeSaving":"2025-03-19T19:21:38.877673Z"}

Recommendations

As defined in report above and in https://folio-org.atlassian.net/browse/MODINVSTOR-1369 the main reason of data saving failure is DB often leaking connections due to high load. So in order to achieve better percentage of success recommendations is following

  • Scale DB to at least 2xLarge shape (tested with 1.2 M records);

  • Disable mod-search. (set task count equal to '0'). After migration it may be enabled again to complete reindexing of edited records otherwise Kafka topic inventory.instances should be cleaned up and additional reindex done separately.

  • Set task count for mod-inventory storage to 8. In order to use all 8 tasks properly set property in mod-marc-migrations task definition.

    {"name": "CHUNK_PROCESSING_MAX_PARALLELISM","value": "8"},
  • Use as low as possible parameters "RECORDS_CHUNK_SIZE" and "CHUNK_FETCH_IDS_COUNT" or leave them as default (by not specifying them at all). Default values if 500 for both parameters. This parameters regulate chunk sizes. Taking into account that DB is a bottleneck here smaller chunk size means more stability.