https://discord.cloudflare.com logo
Join DiscordCommunities
Powered by
# workers-discussions
  • k

    kian

    03/21/2023, 6:58 PM
    Consistency model is probably the main 'it depends'
  • k

    kian

    03/21/2023, 6:59 PM
    KV is good for read-heavy where you're okay with eventual consistency, whereas a DO is a single, unique object which means you have strong consistency but latency for cross-region requests.
  • k

    kian

    03/21/2023, 6:59 PM
    D1 is SQLite on DOs, so you get the same consistency model (and latency downside), but will eventually give users read replicas to offset the latency hit (but likely also incurring eventual consistency for those replicas)
  • k

    kian

    03/21/2023, 7:00 PM
    There's also R2, which is strongly consistent and similar to S3 - but has Worker bindings just like KV
  • c

    calebhailey

    03/21/2023, 7:00 PM
    yeah I was skimming KV docs last night and my brain just registered "don't use this if reads/writes happen less frequently than 60s"
  • k

    kian

    03/21/2023, 7:00 PM
    Personally I would use R2 - since it has an S3 API, there's already a wide ecosystem for interacting with it outside of Workers (i.e backups) - but there is the performance constraints that you have to consider.
  • c

    calebhailey

    03/21/2023, 7:00 PM
    or use a DO as a sort of consistent index, and store the data in KV?
  • c

    calebhailey

    03/21/2023, 7:01 PM
    looks at size limit of a DO
  • k

    kian

    03/21/2023, 7:01 PM
    KV's cache/timings/etc will be changing in 2.0 - https://discord.com/channels/595317990191398933/874727019479437372/1087242463976108052
  • k

    kian

    03/21/2023, 7:01 PM
    You'll have a lot more options to make it workable for different workloads (or consistency needs)
  • k

    kian

    03/21/2023, 7:01 PM
    Note that with all of these products, you are OK to use the Cache API to store them at a given edge colo where the Worker was requested
  • k

    kian

    03/21/2023, 7:02 PM
    so if they're read frequently enough, you can usually not feel the cold read of DO/R2
  • c

    calebhailey

    03/21/2023, 7:03 PM
    hmm, hadn't considered adding cache into the mix 🤔 that's a helpful suggestion! Thx https://developers.cloudflare.com/workers/runtime-apis/cache/?cmdf=cloudflare+cache+api
  • k

    kian

    03/21/2023, 7:03 PM
    R2 being able to leverage S3's ecosystem is IMO most important for data durability - even if we discount the idea that Cloudflare has a data loss incident, that will never protect you (or someone else) accidentally deleting data. R2 is very easily backed up onto
  • k

    kian

    03/21/2023, 7:04 PM
    It'll also have object versioning, and just recently got lifecycle rules - both concepts from the S3 world as you're probably used to
  • c

    calebhailey

    03/21/2023, 7:05 PM
    yeah, don't know why I didn't think of R2. That seems like a good starting point (because S3 compat)
  • c

    calebhailey

    03/21/2023, 7:05 PM
    there's a lot of breadth there
  • k

    kian

    03/21/2023, 7:05 PM
    If D1 fits your needs, it also has hourly backups to R2 - but yeah, I love R2 just for the S3-compat and concepts.
  • k

    kian

    03/21/2023, 7:05 PM
    Not to mention 5TB max object size, etc - you probably won't need anything near that, but the ceiling is a lot higher than the other options.
  • k

    kian

    03/21/2023, 7:06 PM
    It's also the cheapest - for reads, you can expose it on a custom domain that uses caching w/o any Workers involved
  • c

    calebhailey

    03/21/2023, 7:06 PM
    heh, yeah, for the projects I'm working on now I'll be high-fiving someone if an object gets to 5GB haha
  • k

    kian

    03/21/2023, 7:07 PM
    R2 buckets are currently single region - with stuff like replication (or moving data near where users request it most, or however the team decide to implement it) on the roadmap
  • k

    kian

    03/21/2023, 7:08 PM
    They get created closest to you when you create it (GeoIP) but you can provide a location region yourself if you'd prefer to place it closer to
  • k

    kian

    03/21/2023, 7:09 PM
    As I'm sure you can guess, I have a clear favourite - the S3 API gives me a gateway to data durability and portability that only D1 really comes close to (automatic backups and sql dumps)
  • s

    sixfalls

    03/21/2023, 7:24 PM
    any idea for what the pricing model for sockets would be? if I have an socket ex. game server open for 1 minute, will i be billed for the entire minute?
  • c

    calebhailey

    03/21/2023, 7:34 PM
    I just noticed this upon new bucket creation. Seems like something that can be mitigated w/ Cache API and/or other means.
  • n

    nordiauwu

    03/21/2023, 9:21 PM
    Is it still possible to use WASI?
  • e

    Erisa | Support Engineer

    03/21/2023, 9:24 PM
    I assume so
  • e

    Erisa | Support Engineer

    03/21/2023, 9:24 PM
    https://github.com/cloudflare/workers-wasi
  • e

    Erisa | Support Engineer

    03/21/2023, 9:25 PM
    not sure whether its documented outside of this repo and the accompanying blog post
1...235023512352...2509Latest