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

    vans163

    05/10/2021, 9:45 PM
    i need something like 4-8 seconds behind at most
  • v

    vans163

    05/10/2021, 9:45 PM
    was thnking to use the DO
  • v

    vans163

    05/10/2021, 9:45 PM
    maybe all reqs to the DO and it builds the cache
  • v

    vans163

    05/10/2021, 9:45 PM
    if cache misses back to do
  • i

    itsmatteomanf

    05/10/2021, 9:45 PM
    KV is faster usually, but it's guaranteeing a 60s average.
  • v

    vans163

    05/10/2021, 9:45 PM
    yea with KV my results wer mixed
  • v

    vans163

    05/10/2021, 9:46 PM
    like the sam region i was seeing often around 10s
  • m

    Mallissin

    05/10/2021, 9:58 PM
    I was imagining that the data was stored in the Durable Object and then you'd have an edge worker that would load the data from the DO into the cache, then return the cache to that user accessing the data.
  • m

    Mallissin

    05/10/2021, 9:58 PM
    Wouldn't that reduce egress costs?
  • i

    itsmatteomanf

    05/10/2021, 10:03 PM
    Definitely. Higher latency on first requests, though.
  • m

    Mallissin

    05/10/2021, 10:07 PM
    Yeah, but in vans' use case, with the delay of 4-8 seconds then there should be enough time to touch the cache to make it hot and reduce the latency at each colo that will need it.
  • i

    itsmatteomanf

    05/10/2021, 10:14 PM
    The Cache is instant per colo, so once it's filled all subsequent requests can use it, it's just per colo.
  • v

    vans163

    05/11/2021, 12:07 AM
    HLS video 2 second segments are not allowed in cache tho right?
  • m

    Mallissin

    05/11/2021, 12:32 AM
    Why not?
  • m

    Mallissin

    05/11/2021, 12:33 AM
    Just make sure to be polite and set the cache expiration reasonably.
  • m

    Mallissin

    05/11/2021, 12:34 AM
    (For Cloudflare and end users.)
  • v

    vans163

    05/11/2021, 12:35 AM
    ah i dont know i thought video had to use the cloudflare streams
  • v

    vans163

    05/11/2021, 12:35 AM
    what is reasonable expiration like 2h or 24h?
  • v

    vans163

    05/11/2021, 12:43 AM
    Sorry I forgot 1 important point on the KV testing, this was an update to existing key. I forgot to test the speed of inserting new key that DNE, i think it was much faster.
  • m

    Mallissin

    05/11/2021, 1:43 AM
    If it's live video, 30 seconds to 2 minutes. If not live video, sort of depends on your use case. Keep in mind you need to remove the video data from the Durable Object too or it will build up. I have not heard of any limitations for use for video but maybe someone at Cloudflare could answer. Cloudflare Stream is really good for automating multi-quality encoding and takes care a lot of the process for you.
  • i

    itsmatteomanf

    05/11/2021, 9:46 AM
    A new key, on KV, is instant in the same colo, up to 60s on all others (usually way less). Updates same thing.
  • v

    vans163

    05/11/2021, 12:36 PM
    This was clearly not the case on updates on my testing, thru multiple times refreshing the page and hitting the same worker. (I doubt I was jumping around colos every refresh, I have a fiber line)
  • v

    vans163

    05/11/2021, 12:40 PM
    Yea live video. The idea behind the DO was it could be the source of truth, so always it will have the most recent data, up to say like 30 sec of video. Whatever fits in mem, 30sec should fit unless it's some h264 6k video, could be based on mem vs time. Then as requests come in for hls segments, hit the cache if cache miss hit the DO and subsequently fill the cache
  • v

    vans163

    05/11/2021, 12:41 PM
    The cache should prob get filled on ingestion actually
  • d

    Deebster

    05/11/2021, 12:57 PM
    On https://github.com/cloudflare/durable-objects-template it says > On your first publish, you must use
    wrangler publish --new-class Counter
    to allow the Counter class to implement Durable Objects. but the latest wrangler doesn't like it:
    error: Found argument '--new-class' which wasn't expected, or isn't valid in this context
  • d

    Deebster

    05/11/2021, 12:57 PM
    Is this outdated advice?
  • m

    MrHalzy

    05/11/2021, 1:12 PM
    You need the pre-release version of wrangler: https://github.com/cloudflare/wrangler/releases/tag/v1.16.0-durable-objects-rc.0
  • d

    Deebster

    05/11/2021, 1:13 PM
    that version specifically? It says that version or later and I'm on 1.16.1
  • d

    Deebster

    05/11/2021, 1:36 PM
    ok, it is just that particular version
  • b

    brett

    05/11/2021, 1:40 PM
    For what it's worth I have Google Fiber and my requests appear to come out of the Google network all over North America, it's pretty wild
1...828384...567Latest