Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[minor] Increase Manage sequence caches #223

Merged
merged 21 commits into from
Nov 15, 2024
Merged

[minor] Increase Manage sequence caches #223

merged 21 commits into from
Nov 15, 2024

Conversation

tomklapiscak
Copy link
Contributor

@tomklapiscak tomklapiscak commented Nov 13, 2024

https://jsw.ibm.com/browse/MASCORE-3761

Description

Adds Job(s) that run once Manage is configured and healthy that execute into the db2u pods and increase the cache value of sequences created in DB2 by Manage. This is to improve performance when loading large amounts of data into Manage.

A separate Job is created for each DB2 instance reserved for use my Manage. Most likely there will only ever be a single DB2 reserved for use by Manage; i.e. exactly 1 entry in ibm-db2u-databases.yaml with mas_application_id: "manage". But as our config model (in theory) permits more than one, it seems prudent to ensure this post Manage-sync DB2 maintenance Job is executed against all.

Roles permitting pod/exec access are created in the db2 namespaces and bound to a ServiceAccount in the manage namespace. This service account is used by the Job(s) in the Manage namespace to execute the necessary commands on the db2u pod.

Testing

  • Test Job in an existing fvtsaastran cluster:

In Manage config ArgoCD app (masdev.manage.fvtsaastran.fvtsaastran) manifest:

            manage_db2u_databases:
              - db2_namespace: db2u-fvtsaastran
                db2_instance_name: db2wh-fvtsaastran-manage
                db2_dbname: BLUDB

Job and associated sources are successful created, Job executes successfully:
image

Before Job:

db2 => SELECT SEQNAME, CACHE FROM SYSCAT.SEQUENCES WHERE SEQNAME in ('ACCOUNTDEFAULTSSEQ', 'ACTCIRELATIONSEQ', 'MAXSEQ')

SEQNAME                                                                                  CACHE      
---------------------------------------------------------------------------------------- -----------
ACCOUNTDEFAULTSSEQ                                                                                 0
ACTCIRELATIONSEQ                                                                                   0
MAXSEQ                                                                                             0

  3 record(s) selected.

Job runs:


================================================================================
Settings
================================================================================
DB2_INSTANCE_ID ..................... db2wh-fvtsaastran-manage
DB2_DBNAME .......................... BLUDB
AVP_TYPE ............................ aws
DB2_NAMESPACE ....................... db2u-fvtsaastran
DB2_POD_NAME ........................ c-db2wh-fvtsaastran-manage-db2u-0

Create /tmp/alterseq.sh
--------------------------------------------------------------------------------
  #!/bin/bash
  db2 connect to BLUDB
  if [ $? != 0 ]; then
    echo "Failed to connect to database!"
    exit 1
  fi

  db2 "select 'alter sequence maximo.' || sequencename || ' cache 500;' from maximo.maxsequence" | grep "alter sequence" > "/tmp/alterseq.sh.sql"
  echo "alter sequence maximo.maxseq cache 2000;" >> "/tmp/alterseq.sh.sql"

  db2 -tvf "/tmp/alterseq.sh.sql" | tee "/tmp/alterseq.sh.sql.log" || exit $?

Copy /tmp/alterseq.sh to db2u-fvtsaastran/c-db2wh-fvtsaastran-manage-db2u-0
--------------------------------------------------------------------------------
... done

Executing /tmp/alterseq.sh file on db2u-fvtsaastran/c-db2wh-fvtsaastran-manage-db2u-0
--------------------------------------------------------------------------------
Defaulted container "db2u" out of: db2u, instdb (init), init-labels (init), init-kernel (init)

   Database Connection Information

 Database server        = DB2/LINUXX8664 11.5.9.0
 SQL authorization ID   = DB2INST1
 Local database alias   = BLUDB

alter sequence maximo.ACCOUNTDEFAULTSSEQ cache 500
DB20000I  The SQL command completed successfully.

alter sequence maximo.ACTCIRELATIONSEQ cache 500
DB20000I  The SQL command completed successfully.

...

alter sequence maximo.maxseq cache 2000
DB20000I  The SQL command completed successfully.

After Job:

db2 => SELECT SEQNAME, CACHE FROM SYSCAT.SEQUENCES WHERE SEQNAME in ('ACCOUNTDEFAULTSSEQ', 'ACTCIRELATIONSEQ', 'MAXSEQ')

SEQNAME                                                                                  CACHE      
---------------------------------------------------------------------------------------- -----------
ACCOUNTDEFAULTSSEQ                                                                               500
ACTCIRELATIONSEQ                                                                                 500
MAXSEQ                                                                                          2000

  3 record(s) selected.

@tomklapiscak tomklapiscak marked this pull request as draft November 13, 2024 16:35
@tomklapiscak tomklapiscak marked this pull request as ready for review November 15, 2024 13:37
@tomklapiscak tomklapiscak changed the title [patch] (WIP) Increase Manage sequence caches [patch] Increase Manage sequence caches Nov 15, 2024
@whitfiea whitfiea changed the title [patch] Increase Manage sequence caches [minor] Increase Manage sequence caches Nov 15, 2024
@whitfiea whitfiea merged commit 7ce5926 into main Nov 15, 2024
2 checks passed
@whitfiea whitfiea deleted the mascore3761 branch November 15, 2024 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants