The coupling facility and data sharing
The coupling facility is a special LPAR that holds shared lock, cache and list structures in fast memory. Db2, IMS, VSAM RLS and MQ use those structures so that programs on several systems can update the same data at once without corrupting it.
What a coupling facility is
A coupling facility (CF) is an LPAR that runs Coupling Facility Control Code (CFCC), IBM licensed internal code, instead of z/OS. It usually runs on processors configured as ICFs (internal coupling facility engines). z/OS systems reach it over coupling links; on current machines these include short-reach ICA SR links, long-reach Coupling Express links and internal (IC) links inside one CPC. The exact link types depend on the machine generation.
A CF runs no application code. It holds structures: areas of memory that z/OS components and subsystems use to share state. Requests to it take microseconds, which is what makes sharing data across systems practical.
Keeping caches honest
Each Db2 member keeps pages in its own local buffer pool. If two systems hold a copy of the same page and one updates it, the other copy is now wrong. The cache structure solves this with cross-invalidation: it records which systems hold each page and, when one system writes a changed page, the CF marks every other copy invalid. The next time another system needs the page, it rereads the current version from the group buffer pool or from disk.
Data sharing in the real products
Data sharing means several systems read and update the same data at the same time with full integrity. Each major subsystem does it in its own way:
| Product | What is shared | CF structures used |
|---|---|---|
| Db2 data sharing | Several Db2 members, one set of databases and one catalog | Lock (through IRLM), group buffer pools (cache), shared communications area (list) |
| IMS data sharing and shared queues | IMS databases; with shared queues, the input messages too | IRLM lock, OSAM and VSAM cache structures, list structures for message queues |
| VSAM RLS | VSAM datasets opened by CICS regions on many systems, locked at record level | A lock structure (IGWLOCK00) and cache structures, managed by the SMSVSAM address space |
| IBM MQ shared queues | Queues shared by every queue manager in a queue-sharing group | List structures, plus an administration structure; large messages are offloaded to shared message data sets or Db2 |
See RLS for the VSAM side and Db2 for the database side. Applications usually need little or no code change to run in a data sharing group, but they must avoid affinities, such as state kept in one region's memory, or the workload cannot move freely.
Defining structures: the CFRM policy
Structures are described in the CFRM policy, created with the administrative data utility IXCMIAPU and activated with SETXCF START,POLICY,TYPE=CFRM,POLNAME=name. IBM's CFSizer tool helps estimate sizes.
STRUCTURE NAME(DSNDB0G_LOCK1)INITSIZE(65536) SIZE(131072)PREFLIST(CF01,CF02)DUPLEX(ENABLED)D XCF,STR STRNAME STATUS DSNDB0G_LOCK1 ALLOCATED DSNDB0G_GBP0 ALLOCATED (DUPLEXED) IGWLOCK00 ALLOCATED ISGLOCK ALLOCATED QSG1CSQ_ADMIN ALLOCATED
Surviving a CF failure
- Every Parallel Sysplex in production should have at least two CFs, so structures can be rebuilt or kept as duplexed copies in the other one.
- CFs holding lock structures should be failure-isolated from the z/OS systems using them, or the structure should be duplexed. If one machine holds both the CF and a connected z/OS, a single failure loses the lock data and the system that needs to recover it.
D CFshows CF hardware, storage and links;D XCF,CFshows which systems are connected and which structures each CF holds.
Which of the three CF structure types (one word) holds IBM MQ shared queues?
Show a hint
Messages are ordered entries on a queue.
Show the solution
List. MQ shared queues are held in CF list structures.
Common mistakes
Affinities such as region-local temporary storage or single-system file access stop work moving. Find and remove them before relying on data sharing.
If that CF fails there is nowhere to rebuild structures. Production needs two or more CFs, sized so either can hold the critical structures.
Volumes grow. An undersized lock structure causes false contention and an undersized cache causes extra I/O. Review sizes with the RMF CF reports and CFSizer as workload changes.
What you will see at work
- Db2, IMS and MQ systems programmers agree CF structure sizes with the sysplex team and review them before big volume changes.
- Capacity planners watch RMF Coupling Facility Activity reports for service times and CF processor use.
- Developers notice data sharing when a design review asks whether a CICS transaction has affinities that stop it running on every system.
Key terms
Check your understanding.
Take this lesson's quiz and save your progress. Free.