Zum Hauptinhalt springen
YouTube Security VideosTechLinked: MapQuest is tracking mass surveillance cameras(21.10.2026 um 02:00 Uhr)
•
YouTube Security VideosPC-WELT: Die RTX 5090 kostet jetzt 20.000 €?! 🤯💸(21.10.2026 um 09:38 Uhr)
•
Windows Tipps & SecurityMW4's camo grind can be sped up in the early stages, here's how(21.10.2026 um 11:22 Uhr)
•••
Windows Tipps & SecurityBericht: EU lässt Benzin- und Diesel-Pkw auch nach 2035 zu(21.10.2026 um 09:18 Uhr)
•
Windows Tipps & SecurityGoogle schließt über 350 Lücken mit Update auf Chrome 156(21.10.2026 um 09:28 Uhr)
•
Windows Tipps & SecurityJava Runtime Environment (JRE)(21.10.2026 um 09:30 Uhr)
•
Windows Tipps & SecurityAvast Ultimate für zehn Geräte: Zwei Jahre Schutz für 29,99 Euro(21.10.2026 um 09:57 Uhr)
•
Windows Tipps & SecurityFirefox 158.0.1: Update behebt gefährliches Zertifikatsproblem(21.10.2026 um 10:06 Uhr)
•
YouTube Security VideosTechLinked: MapQuest is tracking mass surveillance cameras(21.10.2026 um 02:00 Uhr)
•
YouTube Security VideosPC-WELT: Die RTX 5090 kostet jetzt 20.000 €?! 🤯💸(21.10.2026 um 09:38 Uhr)
•
Windows Tipps & SecurityMW4's camo grind can be sped up in the early stages, here's how(21.10.2026 um 11:22 Uhr)
•••
Windows Tipps & SecurityBericht: EU lässt Benzin- und Diesel-Pkw auch nach 2035 zu(21.10.2026 um 09:18 Uhr)
•
Windows Tipps & SecurityGoogle schließt über 350 Lücken mit Update auf Chrome 156(21.10.2026 um 09:28 Uhr)
•
Windows Tipps & SecurityJava Runtime Environment (JRE)(21.10.2026 um 09:30 Uhr)
•
Windows Tipps & SecurityAvast Ultimate für zehn Geräte: Zwei Jahre Schutz für 29,99 Euro(21.10.2026 um 09:57 Uhr)
•
Windows Tipps & SecurityFirefox 158.0.1: Update behebt gefährliches Zertifikatsproblem(21.10.2026 um 10:06 Uhr)
•
Intelligence View
⚡ tsecurity.de Intelligence

Making Redis Optional: Why I’m pivoting to a 'Postgres-First' Architecture and why chose Valkey as alternative

I've spent the last few weeks rethinking the dependency graph of Logtide. Currently, if you want to run Logtide, you must spin up a Redis instance. Don't get…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!

I've spent the last few weeks rethinking the dependency graph of Logtide.



Currently, if you want to run Logtide, you must spin up a Redis instance. Don't get me wrong - Redis is incredible. But for many self-hosted users running on a $20/month VPS, adding a 200MB RAM sidecar just to handle a few thousand background jobs a day feels... unnecessary.



So I'm making Redis optional. Here's the "why" and the "how" behind the move to a pluggable architecture.






The "Dependency Tax"



Logtide is designed for simplicity. For a typical deployment handling around 50k logs/day, our current stack (Postgres + Redis + SvelteKit + Fastify) works perfectly, but Redis is only doing three things:




  1. Managing background jobs (via BullMQ)

  2. Session caching

  3. Rate limiting



At scale, Redis is the right tool. But for a single-node VPS? It's an extra service to monitor, secure, and feed with RAM. I realized that for many of our users, PostgreSQL is more than enough.






Three Paths, One Interface



Instead of forcing a "one size fits all" approach, I've refactored the backend to support three different scenarios:






1. The "Zero-Dependency" Path (Postgres Only)



This is now the default for small-to-medium deployments. We're leveraging PostgreSQL SKIP LOCKED for the job queue and UNLOGGED tables for caching.



The benefit: One database. One backup strategy. Zero extra RAM overhead.



The trade-off: Slightly higher latency, but negligible for most background tasks.






2. The Valkey Path (The Open Source Alternative)



With Redis changing its license, many are looking at Valkey. It's a Linux Foundation project, fully open-source (BSD-3), and backed by AWS.



It's a drop-in replacement. We didn't even have to change our BullMQ logic just pointed the connection URL to the Valkey container.



Why Valkey instead of Redis? Redis switched to RSALv2/SSPL licensing in March 2024. Not OSI-approved. Valkey forked from Redis 7.2.4 and kept the BSD-3 license. Same performance, actual open source.






3. The Legacy Path (Redis)



If you already have a managed Redis instance or a complex cluster, nothing changes. You can keep using it exactly as before.






Under the Hood: The Postgres Queue



The hardest part was detaching from BullMQ, which is tightly coupled to Redis. I abstracted the logic into a provider-based system.



For the Postgres implementation, the "magic" happens with FOR UPDATE SKIP LOCKED. This allows multiple workers to grab jobs without race conditions:




WITH next_job AS (
SELECT id FROM jobs
WHERE queue = $1
AND attempts < max_attempts
AND scheduled_at <= NOW()
ORDER BY scheduled_at
LIMIT 1
FOR UPDATE SKIP LOCKED
)
UPDATE jobs SET attempts = attempts + 1
FROM next_job WHERE jobs.id = next_job.id
RETURNING *;






It's an elegant way to turn a relational database into a reliable queue without the complexity of a dedicated message broker.






The Pluggable Interface



The abstraction is simple. Two interfaces:




interface CacheProvider {
get(key: string): Promise<string | null>;
set(key: string, value: string, ttl?: number): Promise<void>;
del(key: string): Promise<void>;
}

interface QueueProvider {
enqueue(job: Job): Promise<void>;
dequeue(): Promise<Job | null>;
complete(jobId: string): Promise<void>;
}






Three implementations: PostgresCacheProvider, ValkeyCacheProvider, RedisCacheProvider.



Configure via environment variables:




services:
backend:
environment:
CACHE_PROVIDER: valkey
QUEUE_PROVIDER: postgres






You can mix them. Cache on PostgreSQL, queue on Valkey. Whatever fits your deployment.






Switching to Valkey (If You Want)



For existing Redis users curious about Valkey, the migration is trivial.



Add Valkey to your docker-compose.yml:




services:
valkey:
image: valkey/valkey:7.2-alpine
ports:
- "6379:6379"
volumes:
- valkey-data:/data






Update the connection URL:




# Old
REDIS_URL=redis://redis:6379

# New
VALKEY_URL=redis://valkey:6379 # same protocol






Restart:




docker compose down
docker compose up -d






That's it. Valkey uses the Redis protocol. Same commands, same client libraries. ioredis, BullMQ, redis-py, they all work without changes.






Performance: Does It Matter?



I benchmarked all three approaches. Test: 10,000 background jobs.
























Provider Time
PostgreSQL 2,050ms
Valkey 770ms
Redis 770ms


Valkey is 2.7x faster than PostgreSQL.



But here's the thing: does a background log-rotation job care if it takes 2 seconds instead of 0.7? Probably not.



Cache performance was similar. Valkey wins, but the difference is milliseconds.



For most self-hosted deployments, the simplicity of PostgreSQL-only outweighs the performance gain.






Postgres Cache: UNLOGGED Tables



For those curious about the Postgres cache implementation:




CREATE UNLOGGED TABLE cache (
key TEXT PRIMARY KEY,
value JSONB NOT NULL,
expires_at TIMESTAMPTZ NOT NULL
);






UNLOGGED means:




  • Skip Write-Ahead Log (faster writes)

  • Data doesn't survive crashes (fine for cache)

  • 2-3x faster than regular tables



A periodic job cleans up expired entries:




DELETE FROM cache WHERE expires_at < NOW();






Simple. Effective. No extra service.






The Licensing Question



This whole thing started when Redis changed licenses. March 2024, they switched to dual RSALv2/SSPL licensing.



Not OSI-approved. Restricts cloud providers from offering "Redis as a Service" without releasing source code.



Valkey forked from Redis 7.2.4 and kept BSD-3. Linux Foundation governance. AWS, Google, Oracle backing it.























Project License OSI-Approved
Redis RSALv2/SSPL No
Valkey BSD-3 Yes


For self-hosted users, the licensing doesn't directly affect you. But it signals where the projects are headed.






Real-World Usage



Current Logtide (v0.4.0): Redis required.



Next release: Redis optional. PostgreSQL default. Valkey supported.



If you're already using Logtide with Redis:




  1. Keep Redis, it still works

  2. Switch to Valkey, change the image, restart



Your choice.






Technical Challenges



The main challenge was BullMQ. It's built for Redis/Valkey. Abstracting it required wrapping the entire queue interface.



For atomic operations (like rate limiting), PostgreSQL needs transactions where Redis has INCR:




BEGIN;
UPDATE rate_limits SET count = count + 1 WHERE key = $1;
SELECT count FROM rate_limits WHERE key = $1;
COMMIT;






Slightly slower. Still fast enough.



For pub/sub, we already use PostgreSQL LISTEN/NOTIFY for live log streaming. It works fine.






When to Use What



PostgreSQL-only:




  • Small deployment (< 100k logs/day)

  • Single VPS

  • Want minimal dependencies



Valkey:




  • Higher throughput (> 100k logs/day)

  • Need sub-millisecond cache

  • Already familiar with Redis



Redis:




  • Existing Redis infrastructure

  • Don't care about licensing






My Takeaway



Yes, Valkey/Redis is 3x faster for job queues. But does it matter for background tasks? For most self-hosted users, no.



The simplicity of a single database, one backup, one service to monitor, one point of failure, usually coff coff wins.



But having the choice matters. Some users need the performance. Some want the licensing clarity of Valkey. Some already have Redis.



So we support all three.



PostgreSQL-first. Valkey as an optional boost. Redis if you want it.






Repo: https://github.com/logtide-dev/logtide

🔍 CTI & Forensik

Cyber Threat Intelligence & Forensik

ATT&CK-Navigator · IoC-Radar · Exploit-Belege
CTI Threat Relationship Graph
Akteure · Techniken · Beziehungen
5 Knoten · 4 Relationen
CVE / Incident Threat Actor Software MITRE ATT&CK CWE Weakness IoC
Intelligence Digest — kostenlos Täglich die wichtigsten Security-News · jederzeit abbestellbar
Community Rating & Social Proof
⭐ Leser-Wertung
–
Ø / 5.0
Noch keine Leser-Bewertungen
War diese Seite hilfreich?
0
Jetzt Bewertung abgeben
🟢 Niedrig (1-3.9) 🟡 Mittel (4.0-6.9) 🔴 Hoch (7.0-8.9) Kritisch (9.0-10.0)
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Making Redis Optional: Why I’m pivoting to a 'Postgres-First' Architecture and why chose Valkey as alternative

Thematisch verwandte Begriffe: Making, Redis, Optional, pivoting · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
Nächster Beitrag