#Can I create a "non-edge" worker?

6 messages · Page 1 of 1 (latest)

opal bronze
#

Hi there, I've been experimenting with workers, but I'm realizing that, because they run "at the edge", their performance is really bad if they need to talk with a database. If you need to talk with a database, you want your application code to live next to the database to reduce latency, but because Workers live "on the edge" they introduce a ton of back-and-forth latency to the database (like, 20x+ slower than if they lived near the database). Is it possible to create a worker that always lives in a specific location (i.e. next to the database) and isn't "on the edge"?

For an application communicating with a database in a fixed location, being "on the edge" appears to only be a bad thing (i.e. in the best case, an edge worker will be as fast as a worker co-located next to the database but, in most cases, will be much slower).

primal valve
opal bronze
#

This won't work with TCP Connect()

I am connecting to Postgres via pg and responses cannot be stale. This isn't the answer I was hoping for but thanks for the information!

primal valve
# opal bronze > This won't work with TCP Connect() I am connecting to Postgres via `pg` and r...

Hyperdrive isn't just about caching. Connection pooling is its other main benefit, only opening a few connections per region: https://developers.cloudflare.com/hyperdrive/learning/how-hyperdrive-works/, and keeping tcp connections around, which can help a lot.
You can disable caching entirely: https://developers.cloudflare.com/hyperdrive/learning/query-caching/
Smart Placement plans to support TCP Connections one day, just not right now. Not sure how that'll play with hyperdrive though

Hyperdrive automatically caches the most popular queries executed against your database, reducing the need to go back to your database (incurring …