Zeri
Zeri
CDCloudflare Developers
Created by Zeri on 11/9/2023 in #workers-help
Can I create a "non-edge" worker?
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).
6 replies
CDCloudflare Developers
Created by Zeri on 10/31/2023 in #workers-help
It appears that a `Promise.all()` of "pg" requests happens serially rather than parallel. Expected?
Hi there, I'm using the pg package inside a cloudflare worker. It's connected via a socket to a Neon database. I'm executing about 100 requests in parallel to the database (inside a Promise.all() wrapper) but it appears as though the requests are resolving sequentially rather than in parallel (which makes the query take a lot longer than expected). Is this expected behavior? It's always possible that something else is going on with my code, but I want to quickly double check the behavior of Cloudflare Workers.
2 replies