---
title: "3 (More) Tips for Optimizing Apache Flink Applications"
description: "Three practices for tuning large stateful Apache Flink jobs, drawn from Shopify's streaming platform."
url: "https://swe.quest/articles/3-more-tips-for-optimizing-apache-flink-applications-9c796b6721a565fb"
canonical: "https://shopify.engineering/optimizing-apache-flink-tips-part-two"
source: "Shopify Engineering"
published: "2022-12-13"
difficulty: "medium"
kind: "How-to"
reading_minutes: 7
tags: ["stream-processing","performance","messaging"]
---

# 3 (More) Tips for Optimizing Apache Flink Applications

A post on [Shopify Engineering](https://swe.quest/sources/shopify.md), published 2022-12-13, 7 min read, How-to. Original: [https://shopify.engineering/optimizing-apache-flink-tips-part-two](https://shopify.engineering/optimizing-apache-flink-tips-part-two)

## Summary

Three practices for tuning large stateful Apache Flink jobs, drawn from Shopify's streaming platform. Size parallelism so task managers × slots per task manager is equal to or slightly above the highest operator parallelism (e.g. 25 TMs × 4 slots for parallelism 100), starting with a single environment-level value. Prevent sink backpressure with batched writes (Kafka batch.size, Bigtable bulk mutations) and fix keyBy skew by appending a random bucket to hot or low-cardinality keys, then re-aggregating. Use HybridSource to present archived object-storage data and live Kafka topics as one ordered DataStream, which also speeds backfills because the archives have far more partitions.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Stream processing](https://swe.quest/tags/stream-processing.md) (Data & databases)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Queues & messaging](https://swe.quest/tags/messaging.md) (Backend & APIs)

## Prerequisites

- Apache Flink basics ([easy posts on Stream processing](https://swe.quest/tags/stream-processing.md?difficulty=easy))
- Kafka topics and partitions ([easy posts on Queues & messaging](https://swe.quest/tags/messaging.md?difficulty=easy))
- stream processing concepts ([easy posts on Stream processing](https://swe.quest/tags/stream-processing.md?difficulty=easy))

## Keywords

Apache Flink, HybridSource, Apache Kafka, Bigtable, keyBy, Shopify

## Related posts

- [7 Tips For Optimizing Apache Flink Applications](https://swe.quest/articles/7-tips-for-optimizing-apache-flink-applications-be2dbc2fd7e74cd5.md): Shopify Engineering · 2022-03-08 · Medium · 14 min read · Stream processing, Performance engineering, Java & JVM, Debugging
  Lessons from running large stateful Apache Flink jobs (up to 13 TB of state) on GKE with the RocksDB state backend and checkpoints on GCS.
- [From Homegrown to Flink: Migrating a Stateful Ad Event Join at Scale](https://swe.quest/articles/from-homegrown-to-flink-migrating-a-stateful-ad-event-join-at-scale-34697efa4030f6e1.md): Zalando Engineering · 2026-07-23 · Hard · 12 min read · Stream processing, Storage engines, Performance engineering, Kubernetes, Ads
  Zalando's Ad Platform team replaced a 7-year-old homegrown Java service that joins ad auction (bid) events with user interaction events within a 15-minute window with an Apache Flink pipeline using RocksDB state and incremental checkpoints.
- [Scaling Shopify's BFCM Live Map: An Apache Flink Redesign](https://swe.quest/articles/scaling-shopify-s-bfcm-live-map-an-apache-flink-redesign-bcbe156fa7990bd0.md): Shopify Engineering · 2021-12-10 · Medium · 9 min read · Stream processing, Scaling, System design, Real-time systems
  Shopify scaled its Black Friday/Cyber Monday live sales map by putting Apache Flink in front of Cricket, its home-grown Go stateful streaming service.
- [Why We Ditched Flink Table API Joins: Cutting State by 75% with DataStream Unions](https://swe.quest/articles/why-we-ditched-flink-table-api-joins-cutting-state-by-75-with-datastream-unions-939c1fa5429761f5.md): Zalando Engineering · 2026-03-03 · Hard · 9 min read · Stream processing, Performance engineering, Cost optimization, Cloud platforms
  Chained Flink 1.20 Table API/SQL joins amplified state because each join operator keeps its own copy of upstream records in RocksDB, pushing Zalando's Product Offer Enrichment jobs to about 240GB of state.
- [Rerouting the Stream: How Lyft Moved to the Apache Flink Kubernetes Operator](https://swe.quest/articles/rerouting-the-stream-how-lyft-moved-to-the-apache-flink-kubernetes-operator-54f95160e73c8a70.md): Lyft Engineering · 2026-08-31 · Medium · 12 min read · Stream processing, Kubernetes, Deployment, Capacity planning, Cost optimization
  Lyft retired its homegrown Flink Kubernetes operator and moved hundreds of streaming jobs to the open-source Apache Flink Kubernetes Operator.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
