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

    Jacob Wright

    03/07/2023, 10:16 PM
    I have a lot of data centrally located in a database. I want to move it all to Durable Objects. I don't want to wait until a customer logs in for the first time to run the data migration for their data into the Durable Objects for their account and projects. At least, I don't want to make that a requirement, since many users have historical data but are not currently using my service. I'm thinking I would run all the migrations ahead of time and current/previous users would have their data located near the original data center rather than near them. New customers would get their data located near them. It will be nice if those current customers eventually had their data moved closer to them. Seeing that they currently don't have the data close to them, it isn't a big deal that their data won't be close, but it would be nice to have.
  • j

    Jacob Wright

    03/07/2023, 10:18 PM
    DO storage uses the structured clone algorithm. Do you know if there are any data protocol libraries available that can send that same data over the wire to a client application? protobuf or messagepack or anything?
  • u

    Unsmart | Tech debt

    03/07/2023, 10:20 PM
    Would be neat if DOs took in smart placement but a little bit more complex rather than just latency to external fetches took in the latency to requester locations and tried to place it in the best location latency wise for all of request latency and external fetch latency. I assume that would be very complex though 😅
  • j

    Jacob Wright

    03/07/2023, 10:20 PM
    I'd like to create a data console to inspect the data in my durable objects and am deciding if I should just support JSON or all the types
  • j

    Jacob Wright

    03/07/2023, 10:21 PM
    I suppose I should have asked first if there are any GUI/UI consoles to manage DO storage. That isn't something Cloudflare is working on already, is it?
  • j

    Jacob Wright

    03/07/2023, 10:24 PM
    You mean, it would try and sit somewhere between the user and backend servers it has to make requests to instead of as close to the user as possible?
  • u

    Unsmart | Tech debt

    03/07/2023, 10:25 PM
    It would do both. Try to be as close to the users and data as possible latency wise.
  • j

    Jacob Wright

    03/07/2023, 10:25 PM
    That would get complicated. 🙂
  • j

    Jacob Wright

    03/07/2023, 10:25 PM
    But it would be cool
  • u

    Unsmart | Tech debt

    03/07/2023, 10:25 PM
    I am well aware thats why I said it would probably be really complex
  • j

    Jacob Wright

    03/07/2023, 10:25 PM
    Yeah
  • j

    Jacob Wright

    03/07/2023, 10:26 PM
    It appears https://github.com/kriszyp/msgpackr can support structured cloning
  • u

    Unsmart | Tech debt

    03/07/2023, 10:27 PM
    I dont really do external fetches on DOs much so in that case it would basically choose the lowest RTT of all users who request the specific DO
  • j

    Jacob Wright

    03/07/2023, 10:48 PM
    Feature request: add
    name
    field to returned result of https://api.cloudflare.com/#durable-objects-namespace-list-objects for objects that were created with
    idFromName(name)
    . Thanks!
  • j

    Jacob Wright

    03/07/2023, 11:10 PM
    Actually, I probably need more flexibility with storing/loading my DOs, so I'll probably use D1 or something else to keep track of them rather than using the API.
  • l

    Larry

    03/08/2023, 1:30 AM
    I use https://github.com/kriszyp/cbor-x by the same author. CBOR is essentially msgpack but with an international standard. It's fast and easy to work with.
  • a

    ashutosh

    03/08/2023, 6:39 AM
    Anyone using DO for any production use-case as a replacement for Web-sockets? If yes, what is your monthly bills for the same on Cloudflare? I ran some tests and within few tests the dashboard was showing 100s GB-s (something similar, not sure) but at that point I abandoned the idea. My existing implementation use sockets via Pusher and I am on a $49/month plan. I can check the pricing examples here: https://developers.cloudflare.com/workers/platform/pricing/#durable-objects-billing-examples but that does not contain any real examples so it would be great if someone here can help us figure out the estimated costs.
  • h

    HardAtWork

    03/08/2023, 7:32 AM
    Running a DO non-stop costs about $4 a month, and a single DO can handle multiple WS connections, so you could probably get pretty far there, depending on what you are doing
  • h

    HardAtWork

    03/08/2023, 7:32 AM
    Also note, if you can fit it all in a single DO, then it qualifies for the “free” tier
  • j

    Jacob Wright

    03/08/2023, 2:48 PM
    Thank you!
  • d

    DanTheGoodman

    03/08/2023, 7:32 PM
    Is there a quick way to purge all DOs for a service without deleting the service? Doing a
    wrangler delete && wrangler publish
    doesn't actually seem to delete the objects.
  • c

    ckoeninger

    03/08/2023, 7:44 PM
    there's no restriction on the length of the name field, and it could potentially be sensitive information, so we do not store it and starting to store it would be a breaking change. We've discussed a possible feature to add tags to DOs that could then be visible in list or graphql api etc
  • z

    zehawk

    03/09/2023, 8:27 AM
    Search for "deleteall" - you'll get lots of previous discussions
  • a

    andheller

    03/09/2023, 11:32 AM
    Is there a way to know if/why a DO fails? I am merging Yjs updates and saving to R2 on an alarm. Most documents should be small, but I would want to handle bigger documents in a different way.
  • d

    DanTheGoodman

    03/09/2023, 12:36 PM
    Yeah unfortunately I have to keep track of all the DO instance IDs then somewhere which is annoying 😛
  • h

    HardAtWork

    03/09/2023, 12:39 PM
    You can use the API for that
  • d

    DanTheGoodman

    03/09/2023, 12:40 PM
    oh right! forgot about that, thanks
  • d

    DanTheGoodman

    03/09/2023, 12:40 PM
    but I have to implement my own deleete right? looking at the docs I don't see a way to kill it
  • l

    Larry

    03/09/2023, 12:40 PM
    Would a try/catch approach when you do an operation in a DO on a document work? Then you could retry triggering your different way.
  • h

    HardAtWork

    03/09/2023, 12:42 PM
    Yes
1...510511512...567Latest