惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

A
Arctic Wolf
T
The Blog of Author Tim Ferriss
月光博客
月光博客
Recent Announcements
Recent Announcements
V
V2EX
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 三生石上(FineUI控件)
P
Proofpoint News Feed
The Register - Security
The Register - Security
博客园 - 叶小钗
博客园 - Franky
The Cloudflare Blog
雷峰网
雷峰网
罗磊的独立博客
M
MIT News - Artificial intelligence
I
InfoQ
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 【当耐特】
Engineering at Meta
Engineering at Meta
N
Netflix TechBlog - Medium
爱范儿
爱范儿
博客园 - 司徒正美
Recorded Future
Recorded Future
酷 壳 – CoolShell
酷 壳 – CoolShell
Google DeepMind News
Google DeepMind News
Martin Fowler
Martin Fowler
Microsoft Security Blog
Microsoft Security Blog
F
Full Disclosure
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
B
Blog
大猫的无限游戏
大猫的无限游戏
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
腾讯CDC
WordPress大学
WordPress大学
小众软件
小众软件
K
Kaspersky official blog
Attack and Defense Labs
Attack and Defense Labs
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Forbes - Security
Forbes - Security
aimingoo的专栏
aimingoo的专栏
IT之家
IT之家
The Last Watchdog
The Last Watchdog
N
News and Events Feed by Topic
B
Blog RSS Feed
S
Security @ Cisco Blogs
美团技术团队
量子位
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Cloudbric
Cloudbric
Hacker News - Newest:
Hacker News - Newest: "LLM"

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
How We Keep Mobile Session Replay 17x Cheaper Than PostHog
Mohammad R. · 2026-05-18 · via DEV Community

How We Keep Mobile Session Replay 17× Cheaper Than PostHog

PostHog bills around $85/month for 25,000 sessions.

Rejourney bills $5/month.

At higher volumes, the gap gets even wider. At 350,000 sessions/month, Rejourney is roughly 20× cheaper.

This post is not about pricing strategy but why those numbers are technically sustainable.

The answer is not one trick. It is a stack of engineering decisions that each remove a unit of cost that would otherwise compound with volume.

Price Comparison

Sessions / Month Rejourney PostHog Cheaper By
25,000 $5/mo $85/mo 17×
100,000 $15/mo $272.50/mo 18×
350,000 $35/mo $712.50/mo 20×

1. SDK Bandwidth: Every Byte Has to Be Stored and Served

Most session replay tools capture at the device’s native resolution because it is the simplest implementation.

We do not.

The Rejourney SDK captures at 1.25× scale, meaning we read the framebuffer at roughly 80% of its linear dimension before compression.

Compared with 3× Retina, that reduces raw pixel count by about 5.8× before JPEG compression even begins.

That matters because every pixel captured by the SDK eventually becomes:

  • CPU work
  • memory pressure
  • upload bandwidth
  • object storage
  • replay egress

The frame rate is also intentionally conservative.

Our default is 1 frame per second. The capture timer runs in UIKit’s default run loop mode instead of .common, which means the timer naturally pauses while UIKit handles active scroll events.

We are not manually slowing down during scrolls. The run loop simply does not fire the timer.

A tool capturing at 10 FPS can easily generate around 10× more screenshot data per session before any other cost factor is considered.

Background Encoding and Backpressure

The main thread is only involved for the pixel read.

Everything else runs on a serial background OperationQueue at .utility QoS:

  • JPEG encoding
  • frame batching
  • gzip compression
  • HTTP upload

The encode queue also has hard backpressure limits:

  • 50 pending batches
  • 500 buffered frames

When either limit is reached, new frames are dropped instead of queued indefinitely.

That prevents a network outage from becoming unbounded memory growth.

On-Device Redaction

Redaction happens before encoding.

Text inputs, password fields, and camera previews are blacked out directly in the pixel buffer before the JPEG encoder runs.

That means sensitive pixels never leave the device and never enter the artifact.

It also removes the need for a server-side blurring pipeline, which means one less compute stage and one less storage operation per session.


2. Compression: Binary Frame Bundles + Gzip

Frames are not uploaded individually.

After JPEG encoding, frames are packed into a binary archive and gzip-compressed as a single unit.

The binary format is deliberately simple.

[ 8 bytes — uint64 BE ] timestamp offset from session epoch, in ms
[ 4 bytes — uint32 BE ] JPEG byte length
[ N bytes            ] raw JPEG data

...repeated for each frame in the batch...

→ entire archive passed to gzipCompress()

Enter fullscreen mode Exit fullscreen mode

There is no alignment padding and no unnecessary per-frame metadata.

The gzip pass uses zlib’s deflateInit2_ with compression level 9.

deflateInit2_(
    &stream,
    9,               // Z_BEST_COMPRESSION
    Z_DEFLATED,
    MAX_WBITS + 16,  // gzip container
    8,               // memLevel
    Z_DEFAULT_STRATEGY,
    ZLIB_VERSION,
    MemoryLayout<z_stream>.size
)

Enter fullscreen mode Exit fullscreen mode

Level 9 costs more CPU than level 6, but for our workload, the tradeoff is worth it.

The compression work runs at .utility QoS, so it happens on background CPU. The smaller payload wins later at the storage and egress layer every time the artifact is read back.

Flush Behavior

Batches flush when either condition is met:

  • The buffer reaches the upload batch size, defaulting to 3 frames.
  • The oldest buffered frame has waited longer than batchSize × snapshotInterval.

The time-based flush is specifically for short sessions.

Without it, a 2-second session could end before ever accumulating a full batch.

Hierarchy snapshots go through the same gzip compression path independently, so every artifact type leaving the device is compressed.


3. Ingest Pipeline: Object Storage Is Not in the SDK Request Path

A common session replay ingest pattern looks like this:

SDK upload
→ server presigns PUT URL
→ SDK uploads to object storage
→ server records artifact metadata

Enter fullscreen mode Exit fullscreen mode

That makes object storage latency part of the SDK upload path.

If S3 is slow, the ingest service is slow.

We separate those concerns.

When the SDK uploads an artifact body, the ingest relay writes it into Redis under:

artifact:buf:{artifactId}

Enter fullscreen mode Exit fullscreen mode

with a 30-minute TTL, then immediately returns 204.

The SDK is done in under 50ms regardless of what object storage is doing.

Actual object storage writes happen asynchronously through a BullMQ worker on the rj-artifact-flush queue.

Why This Works

BullMQ deduplicates flush jobs by artifactId.

If a worker crashes mid-flush, the job becomes stalled and is automatically requeued after 30 seconds for up to three attempts.

The flush operation is idempotent. Writing the same artifact to object storage twice is safe.

Redis TTL acts as a circuit breaker. If the artifact is not flushed within 30 minutes, it is dropped rather than left orphaned.

In practice, flush jobs complete in seconds. The TTL exists for pathological failure, not normal operation.

The result is that the ingest relay pod stays stateless and cheap.

It never waits on object storage latency and scales horizontally with upload volume.


4. Storage Routing: No Hard-Coded Buckets

Every artifact is pinned to the endpoint that received it through a storage_endpoints table in Postgres.

At write time, the flush worker resolves an endpoint:

  • project-specific override, or
  • global default selected by weight

It writes the artifact, then stores the endpoint ID with the artifact metadata.

Reads always look up the endpoint from the artifact record instead of assuming one global bucket.

That makes bucket migration operational instead of architectural.

We can add a new endpoint, shift its weight to 100%, and drain the old bucket without changing application code or breaking old artifacts.

Every artifact knows where it lives.

Current Storage Strategy

Our current provider is OVH.

The main reasons are:

  • cheap storage
  • free egress
  • free ingress
  • no API operation costs
  • mature object storage platform
  • high object-count tolerance

After the primary write, shadow endpoints receive async copies for durability without slowing down the hot path.

Postgres WAL archiving and compressed database backups go to Cloudflare R2, where zero-egress reads are useful for rare backup and archival access.


5. Database: CloudNativePG Instead of Managed Databases

Managed database services like RDS, Cloud SQL, and Supabase charge a premium for operations.

We run Postgres using CloudNativePG, the CNCF-graduated Kubernetes operator for Postgres.

Our setup:

  • primary Postgres instance in one datacenter
  • synchronous standby in a second datacenter
  • synchronous_commit = remote_write
  • pgbouncer in front of Postgres

With remote_write, the standby has the write before the primary acknowledges it. If the primary fails, auto-promotion takes roughly 30 seconds, and pgbouncer follows the new primary.

Why pgbouncer Matters

Session replay ingest creates many short-lived database interactions.

Each worker job may open and release a database connection.

Without pooling, Postgres would waste CPU on connection setup and teardown.

pgbouncer keeps around 180 connections to Postgres while exposing a higher connection limit to the application layer.

That keeps Postgres focused on query work instead of connection churn.

Redis HA

Redis runs as a three-node Sentinel cluster.

Sentinel requires a quorum of 2 out of 3 nodes to elect a new master.

One important configuration choice:

maxmemory-policy = noeviction

Enter fullscreen mode Exit fullscreen mode

For BullMQ job state, silent eviction would be dangerous. It could make jobs disappear without processing.

Instead, Redis returns an error when memory is full, and we treat that as a backpressure signal.


6. Compute: k3s on European VPS Instead of Managed Kubernetes

Managed Kubernetes on AWS, GCP, or Azure has two major costs:

  • the worker nodes
  • the managed control plane

The control plane fee is fixed regardless of load, and full Kubernetes distributions can consume several gigabytes of RAM per node before application pods even run.

We use k3s.

k3s ships as a single binary, embeds etcd, and has a much smaller memory footprint.

That means more of the machine’s RAM goes to actual workloads.

We run the cluster on Hetzner across two EU datacenters.

Worker workloads that process bulk session artifacts run in the second datacenter, keeping the primary node’s CPU available for lower-latency API traffic.

These workers are mostly I/O-bound, so they autoscale on BullMQ queue depth instead of CPU utilization.


7. GDPR Data Residency

The infrastructure is designed around EU data residency.

The ingest path is:

SDK
→ Cloudflare WAF
→ load balancer
→ Rejourney API
→ Redis / Postgres / object storage

Enter fullscreen mode Exit fullscreen mode

All compute runs in the EU, primarily Germany and Finland.

Cloudflare is used for TLS termination and WAF behavior, not persistent session replay storage.

The iOS SDK also ships with PrivacyInfo.xcprivacy, so App Store privacy API usage declarations are handled automatically.


Conclusion

The cost difference comes from reducing cost at every layer:

  • fewer pixels captured
  • lower frame rate
  • background compression
  • strict SDK backpressure
  • on-device redaction
  • binary frame bundles
  • Redis-buffered ingest
  • async object storage flushing
  • endpoint-aware storage routing
  • self-operated Postgres with CloudNativePG
  • k3s instead of managed Kubernetes
  • EU VPS infrastructure
  • storage providers selected for low egress and operational flexibility

Session replay is expensive when every session creates too much data and every request touches too many expensive systems.

Rejourney stays cheap because the expensive parts are avoided, compressed, delayed, or moved out of the hot path.