Skip to content

feat(world-postgres-redis): add PostgreSQL + Redis world implementation#155

Closed
kschmelter13 wants to merge 0 commit intovercel:mainfrom
kschmelter13:main
Closed

feat(world-postgres-redis): add PostgreSQL + Redis world implementation#155
kschmelter13 wants to merge 0 commit intovercel:mainfrom
kschmelter13:main

Conversation

@kschmelter13
Copy link
Contributor

@kschmelter13 kschmelter13 commented Oct 31, 2025

Implement workflow world using PostgreSQL for durable storage and Redis for queue processing and streaming. Uses Redis Lists with Pub/Sub for job queues and Redis Streams for real-time data streaming, providing 3-6x faster performance than pg-boss while maintaining the same guarantees. #106

@changeset-bot
Copy link

changeset-bot bot commented Oct 31, 2025

⚠️ No Changeset found

Latest commit: f63a944

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Contributor

vercel bot commented Oct 31, 2025

@kschmelter13 is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@socket-security
Copy link

socket-security bot commented Oct 31, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​testcontainers/​redis@​11.7.21001007695100
Addednpm/​redis@​4.7.110010010097100

View full report

@VaguelySerious
Copy link
Member

@kschmelter13 Thanks for contributing! We love supporting community-created worlds as much as we can, while also making sure the community isn't bottlenecked by us reviewing/maintaining all the worlds.

Since a world is just an npm package, do you want to take a stab at publishing your world as an npm package yourself? If you provide us with a link, we'll add your package to the list of community worlds on useworkflow.dev

If you think this should be part of the main workflow repository instead, please let us know your reasoning. Thanks!

@arielweinberger
Copy link
Contributor

arielweinberger commented Dec 1, 2025

@VaguelySerious This should be an official World. The pg-boss package is extremely slow for queueing, and can only poll every 0.5s min. I saw on another topic that two other teammates agreed that pg-boss doesn't seem to be fit for purpose.

Whereas Redis is a battletested for realtime/near realtime streaming. I understand the ask for reasoning, but this one is so obviously needed.

@VaguelySerious
Copy link
Member

I'm happy to replace world-postgres with this world entirely, if that's the intention. My goal is just to ensure we only have one postgres-backed first-party world (which can include Redis).

To do this, we'd need to ensure this world passes all relevant e2e tests and can replace the Postgres world. How about this:

  • Since the PR might be outdated (my bad for taking time to follow-up), please merge main and ensure everything is working as you envisioned it
  • Also please ensure the DCO CI check passes on this PR
  • I'll merge this PR and add this world to the e2e test suite, but we won't publish the npm package for this yet
  • We can iterate on getting full parity and test coverage
  • Once done, we can replace world-postgres entirely with this code (same package), or keep both worlds around. In the meantime, I'll loop in the team

@VaguelySerious
Copy link
Member

Also note that if the intention is to make this a first-party package, it's in competition with #467, which does not depend on Redis and similarly solves the performance issues of pg-boss

@arielweinberger
Copy link
Contributor

arielweinberger commented Dec 8, 2025

@VaguelySerious We're working off of our own fork of the postgres world where we implemented Graphile Worker. The performance is excellent, so FWIW, I fully support that.

Redis performance will likely be better, but it's not suitable for storing workflow state for historical purposes. We'll likely end up with a fork that uses Redis for queues/workers, and Postgres for state.

Happy to try and contribute a PR, but I'm seeing you already have a team member who's working on it.

@VaguelySerious
Copy link
Member

Great - if Graphile workers work well, then it'll be nice to stick to a pg-only solution for simplicity, with an optional world-redis that can be added for streaming. The redis-world won't be first-party (in this repo), but we do plan on creating a list of community packages and a way to benchmark and e2e test them, to broadcast community efforts.

@arielweinberger Also, we don't have anyone working on the Graphile implementation right now - #467 is a community PR. If you want to give a simple migration of the postgres world to Graphile a shot, that'd be awesome

@rovo89
Copy link
Contributor

rovo89 commented Feb 12, 2026

@arielweinberger How stable is your Graphile implementation? Do you think it's production-ready? For a chatbot, having pg-boss delay each step (and there are a few of them) adds quite some latency. From what I understood in this and other discussions, the the team seems to be more than willing to switch the queue implementation in world-postgres, and the fact that Graphile doesn't require additional infrastructure is definitely a plus.

@kschmelter13
Copy link
Contributor Author

kschmelter13 commented Feb 12, 2026

@VaguelySerious If there is still interest in moving this forward I would love to help and talk with anyone needed to get it done!

p.s. doesnt have to be redis, I would be happy to work on a production ready Graphile worker implementation. Just anything better than pg-boss lol

@VaguelySerious
Copy link
Member

VaguelySerious commented Feb 13, 2026

@kschmelter13 We'd be happy to accept a PR changing the world-postgres implementation to use Graphile workers (without using Redis). The main criteria are:

  • Passes e2e tests
  • Still serves as a simple reference implementation for workflows
  • Docs for setup are adjusted if necessary

Separately, if you do end up publishing your world with Graphile workers as its own package, or Graphile+Redis, you can also add your world to this json file, which adds it to https://useworkflow.dev/worlds

@rovo89
Copy link
Contributor

rovo89 commented Feb 13, 2026

@VaguelySerious What about a migration path for existing users? Must queued items be transferred from the pgboss tables or is that not necessary?

@VaguelySerious
Copy link
Member

VaguelySerious commented Feb 13, 2026

@rovo89 Existing users of world-postgres would not be affected until they manually upgrade. We would ship this as a minor version to indicate breaking changes.

It would be nice, but not required, if the PR came with migrations from the old postgres table schema to the new, or if that's too difficult, with a script that pulls the old data and re-ingests it into a new table.AI should be able to do this pretty well given the old/new schema definitions. I'll probably add something like that and double check it against an existing deploy before we release the world-postgres package.

@kschmelter13
Copy link
Contributor Author

@VaguelySerious sounds good ill work on the Graphile implementation. might need authorization for deployment

@VaguelySerious
Copy link
Member

@kschmelter13 Awesome!

Deployment authorization is for world-vercel only so you shouldn't need it. You can run the full e2e tests against postgres locally

@rovo89
Copy link
Contributor

rovo89 commented Feb 18, 2026

@kschmelter13 Thanks for working on this! Latency improvements are very welcome, especially for chatbots.

I asked @arielweinberger about his integration of Graphile Worker, which is at https://github.com/appwrite-labs/vercel-workflow-fork/pull/1/changes. Wasn't used in production, but stress tests were promising. They have moved on since, so don't expect a PR from his side, but maybe you can use it as inspiration. He is fine with that.

@kschmelter13
Copy link
Contributor Author

@VaguelySerious @rovo89 I opened up a PR for the replacement of pg-boss with graphile worker. I am going to continue with the postgres redis world as a community npm package and create a PR to add it to the worlds site. Thanks for your help! #1124

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants