https://discord.cloudflare.com logo
Join Discord
Powered by
# durable-objects
  • k

    kenton

    02/15/2021, 3:20 AM
    currently DOs run in 5 pops in western north america and 5 pops in western europe. We plan to add at least 15 more before leaving beta, including 5 in Asia
  • j

    jed

    02/15/2021, 3:22 AM
    haha, no wonder my DO latency isn't great, lol. especially when i'm logging through a tokyo-based ngrok endpoint and jumping across the pacific twice.
  • j

    jed

    02/15/2021, 3:22 AM
    but clearly updating KV from the DO and not the worker is an anti-pattern.
  • j

    jed

    02/15/2021, 3:23 AM
    (if you want it reflected to the end client ASAP, that is)
  • k

    kenton

    02/15/2021, 3:27 AM
    yeah KV writes take a while to read datacenters other than the one that performed them. That's something I want to fix by rebuilding KV on DO, actually. 🙂
  • j

    jed

    02/15/2021, 3:27 AM
    LOVE IT
  • j

    jed

    02/15/2021, 3:28 AM
    rebuilding KV on DO will also probably make the APIs more consistent too, i guess?
  • k

    kenton

    02/15/2021, 3:29 AM
    hmm, I wasn't imagining any API changes
  • k

    kenton

    02/15/2021, 3:29 AM
    more of a transparent performance improvement
  • j

    jed

    02/15/2021, 3:30 AM
    ah, i see. tho i'd love structured clone in KVs, and you might not have to change the API there?
  • j

    jed

    02/15/2021, 3:30 AM
    ie, putting POJOs instead of JSON strings.
  • j

    jed

    02/15/2021, 3:31 AM
    also you could add
    reverse
    pretty transparently.
  • k

    kenton

    02/15/2021, 3:31 AM
    yeah that would be cool. That's something we could do separately. Biggest issue is backwards-compatibility with existing data.
  • k

    kenton

    02/15/2021, 3:32 AM
    (structured clone serialization I mean)
  • k

    kenton

    02/15/2021, 3:33 AM
    right now, the caller specifies what type get() should return, and it coerces between text and bytes... in a structured clone world, if you put() an ArrayBuffer, get() should return ArrayBuffer with no need to specify it
  • k

    kenton

    02/15/2021, 3:34 AM
    maybe we could make it be a per-namespace flag though
  • k

    kenton

    02/15/2021, 3:35 AM
    oh yeah the other problem is what to do in the HTTP API (api.cloudflare.com)... it's not obvious how to represent V8-serialized objects there. It's not isomorphic with JSON.
  • k

    kenton

    02/15/2021, 3:35 AM
    but we could just... not let you use the HTTP API for such namespaces?
  • j

    jed

    02/15/2021, 3:37 AM
    hmmm, good point.
  • j

    jed

    02/15/2021, 3:38 AM
    i mean i guess you could add your own serialization (via data urls, etc) but it wouldn't be pretty.
  • j

    jed

    02/15/2021, 3:40 AM
    (basically it'd be like what JSON does with dates.)
  • j

    jed

    02/15/2021, 3:42 AM
    or maybe users could somehow specify their own replacer/reviver functions, but it gets a bit hairy.
  • k

    kenton

    02/15/2021, 3:43 AM
    well, the right place for people to implement custom conversions to JSON would be... in their worker. So not using the CF API.
  • j

    jed

    02/15/2021, 3:44 AM
    right, i was thinking they could specify a script name in the API or something.
  • j

    jed

    02/15/2021, 3:45 AM
    but at that point they're building their own API anyway, lol.
  • j

    jed

    02/15/2021, 3:45 AM
    ie, api.cloudflare.com doesn't make a ton of sense anymore.
  • j

    jed

    02/15/2021, 3:48 AM
    anyway if you rebuild KV on DO, consider making the legacy API a shim... would be much easier to reason about the platform if the APIs were the same.
  • j

    jed

    02/15/2021, 3:52 AM
    like, for example, the HTTP request schema is different between lambda and lambda@edge and it's really annoying.
  • j

    jed

    02/15/2021, 3:52 AM
    ie, the edge version and and regional version shouldn't need to have different APIs.
  • j

    jed

    02/15/2021, 4:05 AM
    (if you see KV storage and DO storage as the “everywhere” and “anywhere” flavors of the same product, that is)
1...171819...567Latest