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

    p0

    01/01/2023, 4:09 AM
    like SQL requests?
  • u

    Unsmart | Tech debt

    01/01/2023, 4:09 AM
    Technically any CF API call will add to that 1200 limit. And the CF API is the only way to query AE
  • p

    p0

    01/01/2023, 4:09 AM
    can I not do something using
    WHERE requests > 500
  • p

    p0

    01/01/2023, 4:10 AM
    and that'd only be one request
  • p

    p0

    01/01/2023, 4:10 AM
    and I can do it for all of the blobs (in a single request)
  • s

    sks

    01/01/2023, 4:11 AM
    One approach could be to use queues and KV. Whenever the api is called you first check the KV. if it’s 0 then don’t execute. And if it has a value then execute it and dispatch a queue event, which would be picked up by another worker. Which would simply increment the value. Instead of a queue you can also let a durable object do this write to the KV. That way you have more control over writes and you wouldn’t have any race conditions.
  • u

    Unsmart | Tech debt

    01/01/2023, 4:11 AM
    Probably not because of read side sampling.
  • p

    p0

    01/01/2023, 4:12 AM
    which message are you responding to?
  • p

    p0

    01/01/2023, 4:12 AM
    his or mine?
  • u

    Unsmart | Tech debt

    01/01/2023, 4:12 AM
    Yours
  • p

    p0

    01/01/2023, 4:13 AM
    what's "read side sampling"?
  • p

    p0

    01/01/2023, 4:14 AM
    queues are also expensive
  • u

    Unsmart | Tech debt

    01/01/2023, 4:14 AM
    AE is the only product that has sampling. It basically means it will omit some records
  • s

    sks

    01/01/2023, 4:14 AM
    Then use durable objects + KV.
  • d

    Deleted User

    01/01/2023, 4:14 AM
    Using AE for request tracking isn’t ideal if you’re wanting to prevent people from requesting over a certain limit. From what i’ve seen it takes anywhere from 10 seconds up to 1 minute to update, so ur users will have a window to spam requests before AE catches up
  • p

    p0

    01/01/2023, 4:15 AM
    That's still a possibility
  • u

    Unsmart | Tech debt

    01/01/2023, 4:15 AM
    Or just DO 🙂
  • p

    p0

    01/01/2023, 4:15 AM
    realistically, if my cap is at like 50,000 requests, will it matter that much?
  • p

    p0

    01/01/2023, 4:15 AM
    I mean, how many requests can one possibly churn out in a minute
  • d

    Deleted User

    01/01/2023, 4:15 AM
    a lot lol
  • u

    Unsmart | Tech debt

    01/01/2023, 4:16 AM
    Millions
  • d

    Deleted User

    01/01/2023, 4:16 AM
    DO is atomic
  • d

    Deleted User

    01/01/2023, 4:16 AM
    very secure in my testing
  • d

    Deleted User

    01/01/2023, 4:16 AM
    & with alarms it all comes together very well
  • s

    sks

    01/01/2023, 4:16 AM
    That can cost it. Cause if you have to check per request from a DO then you’re essentially have to let the DO run. But if the KV has 0 value then you don’t even execute the code to the DO which would effectively make it cheaper.
  • p

    p0

    01/01/2023, 4:16 AM
    DO would be easy but it feels too costly for something so simple
  • p

    p0

    01/01/2023, 4:17 AM
    why can't there just be an increment KV type
  • s

    sks

    01/01/2023, 4:17 AM
    What are you building. Like what’s the general idea ?
  • u

    Unsmart | Tech debt

    01/01/2023, 4:17 AM
    A KV read costs more than a DO read
  • s

    sks

    01/01/2023, 4:17 AM
    KV’s aren’t atomic. They are eventually consistent stores.
1...468469470...567Latest