...

Porting Redis to z/OS

April 25, 2025

By Benedetto Proietti

  • Redis,

  • Mainframe Modernization,

  • Enterprise Caching

...

“Wait… Redis? On z/OS?” If that was your reaction, you're not alone.

But before you scroll somewhere else, please note the policy that my client has:

No X86 in the building.

Oh boy. OK, I said. I don’t even want to know why.

Introduction

At first glance, porting an in-memory, high-performance caching system like Redis to a mainframe OS might seem like forcing a round peg into a square hole. Redis is known for its lightweight footprint, lightning-fast response times, and deep integration with modern stacks—Node.js, Python, containerized microservices. Meanwhile, z/OS is a platform synonymous with decades-old batch processing, COBOL applications, and regulated enterprise workloads.

But scratch the surface, and the ask isn’t so weird after all. In fact, it’s a compelling idea—especially for organizations modernizing their mainframe infrastructure or building hybrid systems. Redis on z/OS isn't just a science experiment. It could be a way to bring familiar, modern tooling closer to where the data lives, reduce operational complexity, and even bridge generational skill gaps.

In this blog series, we’ll explore what it would take to port Redis to z/OS. We’ll dive into the gritty systems-level challenges, architectural differences, and the potential ROI. But first, let’s unpack why this effort matters in the first place.

1. “A Weird Ask?” Not Really

Running Redis natively on z/OS may seem counterintuitive—until you consider what modern mainframe workloads actually look like.

Blending the Old and New

Today’s enterprises don’t treat mainframes as isolated silos anymore. They’re deeply embedded into hybrid architectures where z/OS systems coexist with cloud-native microservices, distributed databases, and REST APIs. In this context, Redis becomes a natural fit: an ultra-fast, lightweight cache or message broker to serve the needs of web apps, fraud detection engines, or data pipelines—all of which may already interface with the mainframe.

By running Redis natively on z/OS, you can bring these capabilities closer to the data without the overhead of off-platform integration. It reduces latency, simplifies security policies, and avoids network chokepoints.

Developer Experience

Let’s not underestimate the power of developer happiness. Many modern devs—especially those new to z/OS—are far more comfortable using tools like Redis, Git, or Node.js than navigating ISPF panels or writing JCL. Native Redis support (or any open-source tooling) makes the mainframe more welcoming and productive for hybrid teams.

Precedents Already Exist

This isn’t uncharted territory. HostBridge Technology has already introduced Redis for z/OS in 2015. HostBridge has been acquired by Broadcom in 2022 and that version of Redis is no longer available. I tried to reach out to Broadcom but got no reply so far.

IBM has also published Redis container builds for z/Linux systems. But it is not proper z/OS and doesn’t fit my client’s requirements.

Next, let’s talk about what makes this port hard—and why that’s part of the fun.

2. The Technical Gauntlet: Challenges in Porting Redis to z/OS

Redis itself is highly portable, written in ANSI C with relatively few hard dependencies, but it’s grounded in real use cases, real precedents, and real technical potential.

Porting Redis to z/OS presents a unique mix of low-level and architectural challenges that range from string encodings to process model mismatches. Here’s what’s on the table:

2.1 Memory Management

Redis is built for environments where memory allocation is fast, predictable, and cheap—typically Linux systems using malloc, mmap(), or custom allocators. z/OS, on the other hand, introduces different virtual memory models and storage management policies, especially when running under the Language Environment (LE).

You’ll need to revalidate all assumptions about address spaces, heap behavior, and possibly even consider segment boundaries. Memory pooling techniques may need to be re-implemented to avoid fragmentation or allocation failures.

2.2 The fork() Problem

One of Redis’s core features is its snapshotting mechanism for persistence, which relies on the fork() system call. This creates a copy-on-write clone of the process to safely write an RDB file without blocking the main thread. But fork() on z/OS USS is either limited or costly—and in many contexts, discouraged altogether.

A workaround may involve replacing fork() with a cooperative threading or multi-process model that emulates snapshot behavior, possibly leveraging z/OS’s own background job handling capabilities.

Janea has extensive understanding and experience on the “fork problem” since we tackled and solved this for Memurai on Windows many years ago.

2.3 ASCII vs EBCDIC

Redis, like most open-source software, assumes the world speaks ASCII. But z/OS natively uses EBCDIC. That breaks everything from command parsing (“SET mykey myvalue”) to AOF and RDB file encoding. Even subtle issues—like comparing byte arrays—can lead to disastrous bugs.

Every point where a string is stored, parsed, serialized, or compared needs to be reviewed. You’ll likely need transparent translation layers or enforce ASCII zones within memory.

2.4 File I/O and Filesystem Semantics

Redis reads and writes to the file system using familiar POSIX interfaces and expects a Linux-style path structure (/var/lib/redis). z/OS USS supports POSIX, but under the hood, it behaves differently—especially when it comes to file locking, permissions, and sync guarantees (fsync).

Persistent storage layers in Redis may need to be refactored to respect USS quirks or replaced entirely with dataset-based I/O if working outside USS.

Again, Janea can leverage its experience with porting Redis to Windows on this issue as well.

2.5 Networking Stack Differences

Redis is a networked server at heart, relying on low-latency TCP sockets. While z/OS USS does support BSD-like sockets, differences still exist—like how TCP options are handled, or how socket readiness is polled (select, poll, or epoll).

Testing is essential here. Behavior that’s reliable on Linux may degrade or fail silently under z/OS without tight validation.

Another plus for Janea and its experience with porting Redis to Windows.

2.6 Build Toolchain and Dependencies

Redis builds cleanly on Linux with make and gcc, but on z/OS, you’re looking at XL C/C++, Open XL, or even cross-compilation from a Linux host.

Makefiles might assume GNU extensions, certain flags, or linker behaviors not present on z/OS. Some dependencies Redis uses (e.g., jemalloc) may not even be compiled without modifications.

2.7 Endianness

IBM Z is big-endian. Redis assumes little-endian in many of its internal data formats, especially for RDB and protocol serialization. Without explicit endian handling, Redis on z/OS would generate data incompatible with Redis on every other platform.

This isn't just a performance footnote—it’s a compatibility landmine.

2.8 Debugging and Observability

On Linux, Redis developers use gdb, strace, /proc, and a range of lightweight tools for diagnostics. On z/OS, you enter a different world: LE stack traces, SMF records, and USS logs.

Understanding how to trace a malloc corruption or a deadlocked socket without familiar tools is half the battle. Even logging assumptions (stdout, stderr) might need redirection or patching.

Deep Dive: Memory Management on z/OS vs Redis Expectations

Memory management is one of the least visible yet most critical areas of Redis's performance. Redis thrives on predictable low-latency memory access patterns—it allocates, reallocates, and frees memory frequently, especially when dealing with variable-size data structures like hashes, lists, and sorted sets.

On Linux, Redis typically relies on malloc() (often from jemalloc), which in turn leverages the virtual memory system through brk() or mmap() behind the scenes. This model assumes:

  • Contiguous, flat memory address space.
  • Fast memory allocation and deallocation.
  • Lazy memory commitment and overcommit behavior.

Redis also benefits from memory overcommit settings and COW (copy-on-write) behaviors during fork(), which aren't guaranteed on z/OS.

z/OS Realities

z/OS introduces different assumptions:

  • Memory is divided into 24-bit, 31-bit, and 64-bit addressable regions.
  • The Language Environment (LE) manages heap and stack via runtime options that govern size, reuse, and growth policies.
  • Memory allocation APIs like __malloc31() and __heap_alloc() may be necessary depending on the addressing mode.
  • mmap() may not behave like Linux, limiting use of memory-mapped files for performance optimization.

Redis-Specific Considerations

jemalloc Portability: jemalloc may require significant changes to build and function correctly on z/OS. Alternative strategies include:

  • Using the system allocator.
  • Porting a simpler custom allocator.
  • Refactoring Redis’s internal usage of jemalloc interfaces.
  • Memory Fragmentation: z/OS environments—especially long-running tasks—may be more susceptible to heap fragmentation. Redis’s active memory churn (especially for small strings and key metadata) could trigger fragmentation more quickly than expected.
  • Concurrency and Memory Races: Threaded memory access in Redis extensions or modules must be revisited under LE’s constraints. Synchronization primitives must align with z/OS threading models.
  • Addressing Modes: If the Redis port is limited to 31-bit addressing (for compatibility), the memory ceiling (~2 GB usable) could throttle performance in large datasets. Native 64-bit support would be preferable but adds porting complexity.

Tuning and Tooling on z/OS

  • Use LE heap reporting tools (HEAPCHK, RPTSTG) to detect leaks, fragmentation, and unusual allocation patterns.
  • Set LE runtime options (HEAP, STACK, ALL31, ANYHEAP) to fit Redis’s workload profile.
  • Avoid implicit assumptions about lazy memory availability—explicitly test allocation failures and handle out-of-memory cases.

Summary

To make Redis run well on z/OS, memory assumptions must be challenged and re-engineered:

  • Use z/OS-native allocators or simplify jemalloc.
  • Validate every pointer size, offset, and arithmetic operation.
  • Monitor memory actively in production.

If done right, Redis can still be fast and efficient—even in an environment with a completely different philosophy around memory.

Deep Dive: Fork() and Snapshotting — A Structural Mismatch

One of the hardest problems in porting Redis to z/OS lies in how Redis handles persistence. More specifically: its reliance on fork() to create background snapshots.

On Linux and other Unix-like systems, fork() is a well-understood primitive. It creates a copy-on-write duplicate of the current process. Redis uses this to write RDB snapshots or rewrite the AOF file without pausing command processing. It’s elegant, efficient—and tightly coupled to how Unix handles memory.

Why This Breaks on z/OS

z/OS UNIX System Services (USS) does support fork(), but not always in the way Redis expects:

  • The implementation is heavier and slower.
  • Copy-on-write may not be available or efficient.
  • Forking a memory-heavy process like Redis could lead to performance degradation or memory contention.
  • z/OS might not guarantee the same memory isolation characteristics expected by Redis’s snapshotting logic.

In short, even if fork() compiles and runs, the runtime characteristics are very different. Redis’s assumption of cheap, fast background snapshots doesn’t hold.

Redis Alternatives to Fork()

The Redis community has explored alternatives to fork() for years—especially for environments like embedded systems and Windows:

  • rdbSaveRio() with threads: Using threads instead of forking a child process, this approach requires a carefully synchronized copy of the dataset.
  • Replica-based durability: Offloading persistence to a secondary Redis replica can eliminate snapshot pressure on the main instance.
  • Append-only file with minimal fsync: Using AOF for durability with less emphasis on snapshotting. This trades snapshot complexity for I/O tuning.

What You’d Need to Do on z/OS

  1. Intercept and replace all fork() calls: Modify the Redis source to use a background thread or external helper process instead.
  2. Create a shadow copy mechanism: Implement a mechanism to safely duplicate the dataset in memory before serialization. This could involve memory-mapped segments, shared memory, or serialized object trees.
  3. Redesign signal handling: Redis relies on POSIX signals for child process communication. This would need to be restructured around threads or IPC mechanisms.
  4. Integrate with z/OS services: Use native z/OS facilities for background job scheduling or offload snapshotting to a detached batch process.

Considerations and Risks

  • Concurrency bugs: Threads share memory. Without a true memory fork, Redis must ensure no writes occur during snapshot serialization.
  • Performance regressions: Thread-based snapshotting may increase GC pauses or latency under load.
  • Compatibility with upstream Redis: Forkless Redis variants diverge from the mainstream Redis design, increasing long-term maintenance effort.

Inspiration from Memurai, an enterprise-grade Windows Port of Redis

As briefly said above, Janea Systems has solved this problem with Memurai. And although Memurai is closed source, Janea Systems can surely leverage its knowledge should it attempt to port Redis to z/OS.

Summary

fork() is central to Redis’s persistence model, but it’s not sacred. With careful engineering, we can replace it on z/OS with a thread-based or helper-process model. This will require deep changes to Redis internals, but could ultimately yield a Redis that’s more portable, scalable, and cloud-friendly.

3. Redis on z/OS: Hypothetical ROI

Porting Redis to z/OS is not a weekend hack. It’s a systems-level project with serious complexity. So why would anyone take it on?

Strategic Value

  • Data locality: Redis brings computation closer to where the core transactional data lives—on the mainframe. That can reduce latency dramatically and improve response times for applications like fraud detection, authentication, and pricing engines.
  • Architecture simplification: Keeping Redis on-platform avoids the need to manage redundant, off-platform Redis clusters, which introduces security, compliance, and operational overhead.
  • Consolidation: Hosting Redis alongside CICS, IMS, and DB2 enables tighter integration and reduces the need for intermediate messaging systems or ETL pipelines.
  • Innovation catalyst: Native Redis enables new application patterns on z/OS—API caching, event buffering, ML inference prep—all without moving data off the mainframe.

Use Case Scenarios

ScenarioRedis on z/OS Advantage
Fraud detectionCache user behavior data next to CICS transaction state for real-time scoring.
Session stateStore session tokens and user profiles for secure APIs or login flows.
Hybrid cloud syncUse Redis as a lightweight message or state buffer between z/OS and cloud-based systems.
Response cachingCache expensive or high-volume DB2 queries locally, reducing CPU and I/O load.
In-memory analyticsPre-aggregate data for batch reports or ad-hoc dashboards without impacting OLTP systems.

Developer and Team Productivity

  • Lower learning curve: Developers familiar with Redis can apply their skills directly, without learning legacy caching systems.
  • Tooling compatibility: Integrate Redis with modern DevOps pipelines, observability platforms, and CI/CD flows.
  • Reusable code: Many open-source libraries and services already support Redis out of the box. This reduces custom development.

Talent Strategy and Platform Modernization

  • Attract and retain engineers: Making z/OS friendlier to modern devs helps solve the aging workforce problem.
  • Upskill existing teams: Exposing Redis to COBOL or PL/I developers enables hybrid patterns where legacy and modern tools coexist.
  • Future-proof investments: Shows commitment to evolving z/OS into a modern, open platform instead of a closed, legacy silo.

Cost Efficiency Hypotheses

  • Reduced network I/O: Avoid sending repetitive queries over TCP/IP or MQ middleware.
  • Lower MIPS consumption: By caching high-cost computation results, Redis can help offload frequent lookups.
  • Streamlined architecture: Fewer moving parts means fewer licenses, integration bugs, and maintenance hours.
  • Elastic resource usage: Redis can be sized appropriately per LPAR or WLM policy, aligning with chargeback models.

Summary

While speculative, the ROI of Redis on z/OS could be significant across operational efficiency, developer productivity, and long-term platform strategy. It’s not just about porting a database. It’s about unlocking new patterns of performance, scale, and modernization—right where the enterprise’s most critical data already lives.


Conclusion: From Curious Idea to Practical Engineering

Porting Redis to z/OS is not for the faint of heart—but it’s far from impossible. If anything, it’s the kind of challenge that z/OS engineers were born to tackle: one that blends systems thinking, cross-platform understanding, and a bold vision for modernization.

We’ve laid out the rationale, dissected the technical hurdles, and explored the possible upside. From memory models to fork workarounds, from encoding mismatches to ROI scenarios—this journey is both technical and strategic.

Yes, Redis on z/OS would be a significant engineering lift. But it would also be a statement: that mainframes can evolve, integrate, and innovate right alongside modern distributed systems. It’s about redefining what belongs on z/OS—not by lowering standards, but by raising the ceiling of what’s possible.

This blog isn’t a blueprint. It’s an invitation. To experiment. To collaborate. To prototype. To question assumptions. Because great ideas often start as weird ones.

👇 What You Can Do Next:

  • Engineers: Try compiling a minimal Redis build in USS. See where it breaks.
  • Architects: Consider use cases where Redis could reduce coupling or latency.
  • Teams: Reach out to colleagues in both mainframe and cloud groups. Ask: “Where would Redis help us meet in the middle?”
  • Open source folks: Help sketch out patches. Explore what a forkless Redis mode might look like.

Redis on z/OS may not be mainstream—but every good idea starts out that way.

Are you also interested in having Redis in z/OS?

Keep in touch.

Related Blogs

Let's talk about your project

600 1st Ave Ste 330 #11630

Seattle, WA 98104

Janea Systems © 2025

  • Memurai

  • Privacy Policy

  • Cookies

Let's talk about your project

Ready to discuss your software engineering needs with our team of experts?