Reverse Proxy syncing config database
Hello!
My goal is to keep the internal (in memory) config up-to-date across all workers and propagate the remote db changes effectively.
So, I have one Worker acting as a reverse proxy that process requests with
fetch
.
It also includes a scheduled
method that makes a call to an external GCloud API and save the response in edge storage (I tried KV, and D1 so far) from time to time.
When processing requests, I read from storage (KV, D1...) and check if new config data is available. If so, I replace the config in memory.
Then i go on with the request handling (using this latest config data).
So far it seems KV provided good results but D1 fails to deliver.
I am not sure why but it appears too slow (so the Round trip time increases a lot with D1 because of the wall time).
Should D1 work fine?
Am i using the right approach?
Thanks!0 Replies