> Markdown version of [/videos/69-slip-through-the-boundaries-of-legacy-systems-with-kotlin-and-spring-webflux](https://www.wearedevelopers.com/videos/69-slip-through-the-boundaries-of-legacy-systems-with-kotlin-and-spring-webflux). Every page supports `.md` or `Accept: text/markdown`. Links point to the HTML versions so they work for humans too. Agent guide: [/agents.md](https://www.wearedevelopers.com/agents.md). --- # Slip Through the Boundaries of Legacy Systems with Kotlin and Spring WebFlux Are legacy architectures choking your high-throughput services? Migrating to Kotlin and Spring WebFlux solves thread exhaustion. Learn to master reactive streams without triggering silent operational failures. - **Speakers:** Lukas Georgieff, Alberto Gisbert - **Event:** WeAreDevelopers LIVE - **Published:** November 12, 2020 - **Duration:** 52:24 - **URL:** https://www.wearedevelopers.com/videos/69-slip-through-the-boundaries-of-legacy-systems-with-kotlin-and-spring-webflux ## Summary Software engineering teams managing high-throughput services interfacing with slower legacy architectures face severe bottlenecks when using synchronous mechanisms like Spring MVC. Under heavy load and memory constraints, blocking systems quickly succumb to thread exhaustion and drop requests, while asynchronous alternatives remain remarkably resilient. Adopting Spring WebFlux and Kotlin shifts this paradigm to a highly efficient non-blocking architecture capable of handling exponentially larger concurrent loads with drastic reductions in RAM. However, this efficiency does not yield inherently faster response times; reactive services incur slight latency overhead, and inadvertently injecting blocking I/O libraries into the stream will instantly nullify all concurrency gains. The reactive model resolves network latency challenges by leveraging backpressure, a hybrid push-pull dynamic where the subscriber dictates data flow to prevent publishers from overwhelming system resources. Tools like Project Reactor provide essential abstractions like Mono and Flux to manage these streams, but implementation introduces steep learning curves surrounding execution lifecycles. Engineers must establish a rigorous mental model differentiating assembly time from subscription time. Operators like switchIfEmpty execute eagerly during assembly unless explicitly wrapped in deferred structures, potentially triggering unintended parallel database connections and logic errors. Transitioning an engineering team to a reactive paradigm requires constant vigilance against silent operational failures. Passing null values or an unexpected empty publisher into a stream will bypass standard mapping operations, quietly dropping execution chains and stalling logic without generating explicit stack traces. Common framework solutions also behave counterintuitively under reactive rules; applying standard caching annotations directly to a reactive method defaults to caching the unfinished publisher promise rather than the freshly evaluated data state. Successfully adapting synchronous microservices into WebFlux mandates robust technical awareness of these reactive behaviors to ensure endpoints function efficiently without cascading data failures. **Keywords:** spring webflux, kotlin reactive programming, spring MVC limitations, reactive streams backpressure, project reactor mono flux, legacy system integration, asynchronous non-blocking architecture, reactive assembly vs subscription time, caching reactive publishers, null handling in reactive streams, thread exhaustion prevention, high-throughput microservices, stepverifier reactive testing, managing slow network responses ## Chapters 1. **Backend architecture and legacy integrations at Porsche** (00:17) — How Porsche relies on synchronous monolithic architectures to support its growing digital backend services. 1. **Comparing Spring WebFlux and Spring MVC stacks** (03:34) — How threading architectures and request parsing structurally diverge between declarative and reactive web stacks. 1. **Load testing reactive versus imperative controllers** (04:48) — A side-by-side demonstration evaluating a deliberately lagging server handling competing load profiles concurrently. 1. **Analyzing load test results and thread efficiency** (06:42) — Why lower thread counts within WebFlux survive overwhelming operational loads avoiding traditional application crashes. 1. **Evaluating latency tradeoffs in reactive architectures** (09:45) — The hidden response speed penalties accumulating when inadvertently chaining asynchronous engines against synchronous dependencies. 1. **Transitioning from RestTemplate to WebClient publishers** (11:33) — How syntax demands differ completely when REST invocations generate abstract Mono publishers instead of simple strings. 1. **Creating a synchronous file reader simulation** (12:53) — How sequential processing methodologies create severe thread blockages via persistent memory starvation and idle times. 1. **Building an asynchronous pull model interface** (17:00) — How asynchronous callbacks connected to non-blocking files prevent primary application threads from stalling. 1. **Highlighting bottlenecks in naive push models** (20:08) — Why blasting internal messaging arrays blindly ultimately chokes slower subsystems struggling with concurrent intake limits. 1. **Balancing consumer limits using back pressure** (22:43) — How active publishers regulate throughput pacing by strictly waiting upon dynamic volume requests from subscribers. 1. **Outlining the standard Reactive Manifesto principles** (24:36) — Why scalable applications conceptually mandate responsive, resilient, elastic, and thoroughly message-driven behavior at their core. 1. **Examining reactive stream specification core types** (26:17) — How the agnostic cross-language standard binds disconnected modules firmly through strict declarative contract definitions. 1. **Implementing a custom publisher and subscription request** (28:34) — Applying manual iterating callbacks establishes discrete links feeding raw data arrays steadily into registered sinks. 1. **Processing collections using Flux and Mono** (33:17) — Utilizing Project Reactor building blocks accurately separates zero-or-one possibilities from unbound cascading streams. 1. **Validating structural reactive pipelines using StepVerifier** (35:54) — How dedicated verification suites manipulate virtual clocks testing signal logic deterministically before exiting unit loops. 1. **Handling unexpected crashes from null values** (39:35) — Why reactive type bindings detonate uncontrollably when functional map components return technically forbidden null objects. 1. **Troubleshooting silent failures in empty Mono operations** (42:44) — How silently discarding components directly halts downstream computations without emitting observable log traces. 1. **Distinguishing reactive assembly and subscription phases** (46:07) — Why decoupling compilation allocations stops redundant logic elements triggering instantly prior to eventual listener registration. 1. **Caching results effectively with hot Monos** (48:46) — How naive default annotations misinterpret objects retaining promises instead of locally persisting correctly resolved numbers. ## Related Moments - [Solving thread blocking with reactive frameworks and Kotlin](https://www.wearedevelopers.com/videos/993-java-s-project-loom-co-the-end-for-reactive-programming) (from "Java's Project Loom & Co - the end for reactive programming?") - [Adopting Spring WebFlux and the Reactor API](https://www.wearedevelopers.com/videos/440-back-end-to-the-future-embracing-the-continuous-evolution-of-infrastructure-and-code) (from "Back(end) to the Future: Embracing the continuous Evolution of Infrastructure and Code") - [Building scalable applications with reactive programming](https://www.wearedevelopers.com/videos/383-kubernetes-native-java) (from "Kubernetes Native Java") - [Resolving reactive stream errors in blocking applications](https://www.wearedevelopers.com/videos/100349-structured-concurrency-in-practice-coroutinescope-vs-structuredtaskscope) (from "Structured Concurrency in Practice: CoroutineScope vs StructuredTaskScope") - [Benchmarking concurrency models and throughput performance](https://www.wearedevelopers.com/videos/440-back-end-to-the-future-embracing-the-continuous-evolution-of-infrastructure-and-code) (from "Back(end) to the Future: Embracing the continuous Evolution of Infrastructure and Code") - [Contextual history of reactive programming in Java ecosystems](https://www.wearedevelopers.com/videos/1973-beyond-loom-practical-patterns-for-virtual-threads-structured-concurrency-and-reactive-interop) (from "Beyond Loom: Practical Patterns for Virtual Threads, Structured Concurrency and Reactive Interop") ## Related Articles - [Why Event-Driven Architecture Isn’t About Speed (and When You Actually Need It)](https://www.wearedevelopers.com/magazine/745-why-event-driven-architecture-isn-t-about-speed-and-when-you-actually-need-it) - [Why You Shouldn’t Build a Microservice Architecture](https://www.wearedevelopers.com/magazine/118-why-you-shouldn-t-build-a-microservice-architecture) - [Get Old, go Slow, Write Code!](https://www.wearedevelopers.com/magazine/81-get-old-go-slow-write-code) - [Dev Digest 120 - Apple and peers](https://www.wearedevelopers.com/magazine/455-dev-digest-120-apple-and-peers) ## Related Jobs - [Mid/Senior Full-Stack Engineer (Web-first)](https://www.wearedevelopers.com/jobs/ext/1210833-mid-senior-full-stack-engineer-web-first) at **SMG Swiss Marketplace Group** - [Senior Backend Engineer (Java)](https://www.wearedevelopers.com/jobs/ext/19369-senior-backend-engineer-java) at **Bonial International GmbH** - [Junior Frontend Engineer](https://www.wearedevelopers.com/jobs/ext/1532351-junior-frontend-engineer) at **Almedia** - [Software Engineer, React & Angular (Broker Web Platform](https://www.wearedevelopers.com/jobs/ext/1558399-software-engineer-react-angular-broker-web-platform) at **Bitpanda** - [Senior Software Engineer, Client Apps Platform](https://www.wearedevelopers.com/jobs/ext/1773893-senior-software-engineer-client-apps-platform) at **GitHub** - [Principal Software Engineer](https://www.wearedevelopers.com/jobs/ext/149130-principal-software-engineer) at **Twilio**