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

    Josh

    06/16/2021, 11:19 PM
    $0.50/GB vs $0.20 / GB
  • g

    Greylock

    06/16/2021, 11:19 PM
    but the value size is limited to 32kb
  • g

    Greylock

    06/16/2021, 11:19 PM
    the price per GB is largely irrelevant if the data cant be effectively modeled to actually use all of that storage available
  • j

    Josh

    06/16/2021, 11:20 PM
    I haven't used DO yet, So just spit balling what I know 🙂
  • g

    Greylock

    06/16/2021, 11:20 PM
    maybe this nativity comes from my ignorance when it comes to database stuff
  • g

    Greylock

    06/16/2021, 11:20 PM
    but I don't get it
  • g

    Greylock

    06/16/2021, 11:22 PM
    I guess DO is just a different version of the KV store with higher/faster consistency at the cost of a lack of distribution
  • v

    Vanessa🦩

    06/16/2021, 11:26 PM
    Did you read Kenton's original announcement of DOs from back in September? It explains it very well, IMHO. It's not a magic bullet to make your database faster. What it really enables is real-time multiuser sessions (my interpretation). Many apps don't need that. Ours does, so DOs are a good fit.
  • g

    Greylock

    06/16/2021, 11:26 PM
    I read about it being good for realtime stuff
  • g

    Greylock

    06/16/2021, 11:27 PM
    but I didnt really know the extent?
  • g

    Greylock

    06/16/2021, 11:27 PM
    should it be used to track sessions and stuff w/ websockets?
  • v

    Vanessa🦩

    06/16/2021, 11:27 PM
    that's a very good use case for it, yes
  • g

    Greylock

    06/17/2021, 12:11 AM
    imo the PR is misleading though
  • g

    Greylock

    06/17/2021, 12:11 AM
    but maybe thats just me
  • g

    Greylock

    06/17/2021, 12:12 AM
    I mean I can totally see a use case for auth, tracking user data like email, password, etc and I will be using it for that
  • j

    jamis0n

    06/17/2021, 6:52 AM
    Hi! I'm working on building a realtime document editor using the YJS framework and a new collaborative editing backend websocket server framework called Hocuspocus (https://www.hocuspocus.dev/installation/express) I've prototyped setting this up with a traditional express node server and it works great, but Im curious if it would be a good use case for durable objects? My primary interest is in being able to scale the number of documents the application can handle as well as the number of simultaneous connections per document. It's required that all editors for a given document are connected to the same socket server as it has a YJS document instance in memory for reconciling changes (the size of a single doc could grow into the tens of MB potentially). Once all users disconnect though, the in memory instance can be discarded and later loaded from cold storage (like postgres) the next time a user requests it. Essentially, every incoming request for a given documentID needs to be routed to the same in memory server instance. Can durable objects + the new websocket support handle this? Would love to hear your thoughts! Thanks in advance.
  • c

    clash

    06/17/2021, 9:41 AM
    How long can a worker communicate with a client using websockets? Since websockets are for realtime and ongoing connections I was wondering how long it would stay active for
  • b

    brett

    06/17/2021, 1:46 PM
    If you're asking about Durable Objects, there isn't currently a limit. That said, your code has to be written to anticipate and handle disconnections -- the server could crash, the network between the client and server could fail in some way, we might relocate your object (in the future), or we roll out regular upgrades to the underlying services, etc.
  • b

    brett

    06/17/2021, 1:47 PM
    Check out the Actor Model. And when designing a DO application it's true that you'd typically want many small objects rather than few large ones. e.g. an object per user, per game lobby, per document, per whatever... rather than monolithic ones like a typical web service.
  • b

    brett

    06/17/2021, 1:49 PM
    I don't know the specifics of YJS but I think Durable Objects should be a great fit for this. A Durable Object makes a great websocket server and place to coordinate document changes (and you'd probably want to use 1 object per document). I keep meaning to try to make a little demo of something similar myself but haven't had time.
  • j

    jamis0n

    06/17/2021, 1:57 PM
    Thanks Brett! Is there a guide I can follow to deploy a simple durable objects worker with web sockets that uses 3rd party dependencies? I’d like to try setting up the basic setup for the hocuspocus link I shared above and connect my existing fronted to it 🙂
  • j

    jamis0n

    06/17/2021, 1:58 PM
    I’d be happy to share my findings once I get it running!
  • b

    brett

    06/17/2021, 2:12 PM
    I don't know about a guide, we have some templates: https://github.com/cloudflare?q=durable and there's the chat demo that uses websockets (but no dependencies) https://github.com/cloudflare/workers-chat-demo
  • j

    jamis0n

    06/17/2021, 3:58 PM
    Thanks! Any examples that show compiling 3rd party dependencies?
  • m

    matt

    06/17/2021, 4:33 PM
    Both the rollup and webpack examples linked from https://github.com/cloudflare?q=durable will allow you to import 3rd party dependencies from npm
  • c

    clash

    06/17/2021, 4:35 PM
    that is very cool! I was looking to use workers for websockets but was worried they might time out sooner than I think
  • c

    clash

    06/17/2021, 4:38 PM
    wait so just to be sure, the websockets with durable-objects will run as long as the connection isn't closed due to some reason right?
  • e

    Erwin

    06/17/2021, 4:43 PM
    Yup
  • c

    clash

    06/17/2021, 4:44 PM
    great, thank you!
  • g

    Greylock

    06/17/2021, 8:05 PM
    But they said documents may be up to 10MB in size
1...103104105...567Latest