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

    Greylock

    06/29/2021, 2:19 PM
    I dont really know how they work internally but I think its very fair to say that the object needs to be in memory for this conflict resolution to happen
  • w

    Wallacy

    06/29/2021, 2:21 PM
    I already do that, when i list my DO with 2GB data (not fit on memory) a can query that pretty quickly. You are speculating too much here... I can get a storage.list paginated and do my search. Thats already works!
  • g

    Greylock

    06/29/2021, 2:21 PM
    what I would recommend is having either the KV or another durable object act as an index node, and put your indicies in it and use those as the basis of a search
  • g

    Greylock

    06/29/2021, 2:22 PM
    the entire DO isnt going to be in memory, especially if its 2GB like you said
  • g

    Greylock

    06/29/2021, 2:22 PM
    but the DO itself still has to be in memory so that it can perform conflict resolution.
  • g

    Greylock

    06/29/2021, 2:22 PM
    unless that happens in the worker runtime itself,
  • g

    Greylock

    06/29/2021, 2:23 PM
    I can ask around and see but even if its possible for this to be implemented, it probably will not be in the near future at least.
  • g

    Greylock

    06/29/2021, 2:25 PM
    I would love to see a search myself, but from my experience and my understanding of durable objects its simply not what they are designed for.
  • g

    Greylock

    06/29/2021, 2:26 PM
    maybe im totally off about this, so I would love to hear some input from someone else on the workers team.
  • w

    Wallacy

    06/29/2021, 2:27 PM
    Understood.... My problem relies in the fact the values of DO storage are limited to 32kb, so instead split a 10MB document (for example) in several key sections, i was trying to keep each one on a DO, and for a bonus a can support shared editing in parallel. But if the DO is not loaded in memory, i still want to know what inside then.
  • w

    Wallacy

    06/29/2021, 2:27 PM
    I do my search using the flexsearch and fit my needs.
  • w

    Wallacy

    06/29/2021, 2:28 PM
    i just create the index using the flexseach and a have a route /search and works nice.
  • g

    Greylock

    06/29/2021, 2:28 PM
    I think you should just load it then
  • g

    Greylock

    06/29/2021, 2:28 PM
    and use the standard ``fetch`` method on your durable object
  • g

    Greylock

    06/29/2021, 2:28 PM
    you can have your worker query multiple at the same time
  • g

    Greylock

    06/29/2021, 2:29 PM
    I think the limit is 50 sub-requests in a worker (im not sure if durable objects count against this limit)
  • g

    Greylock

    06/29/2021, 2:30 PM
    you cant read the DO's state without it being ran in memory, but you can just call it and cloudflare will automatically move it into memory and evict it as necessary
  • w

    Wallacy

    06/29/2021, 2:30 PM
    I was planing to do that, but sounds inefficiently, but better try first how far i can get. If not works i will keep my currently implementation splitting my document in 32kb sections.
  • g

    Greylock

    06/29/2021, 2:31 PM
    if it does not work you may want to look at macrometa or firebase or mongodb or something similar
  • g

    Greylock

    06/29/2021, 2:31 PM
    as these have years of software engineering put into efficiency and design
  • w

    Wallacy

    06/29/2021, 3:07 PM
    Well... @User , looking again at my problem. If a spin up a DO to read/write a single KV entry (that can be 25MB) i still can use the DO to controll my editions and i probably can search using a regular work over the collections of keys.
  • g

    Greylock

    06/29/2021, 3:07 PM
    theres nothing wrong with spinning up the DO
  • g

    Greylock

    06/29/2021, 3:07 PM
    its still going to be fairly cheap
  • w

    Wallacy

    06/29/2021, 3:09 PM
    Any problem in use the KV storage inside the DO? Just to know if there's any know issue here.
  • g

    Greylock

    06/29/2021, 3:11 PM
    no problem I dont think
  • g

    Greylock

    06/29/2021, 3:11 PM
    but I haven't tested it yet
  • g

    Greylock

    06/29/2021, 3:12 PM
    I think durable objects are the same runtime as regular workers so you should be able to do that okay.
  • g

    Greylock

    06/29/2021, 3:16 PM
    any ideas why ``env.rooms`` is undefined?
  • g

    Greylock

    06/29/2021, 3:21 PM
    Copy code
    js
    let id = OBJECT_NAMESPACE.newUniqueId()
  • g

    Greylock

    06/29/2021, 3:22 PM
    the demo chat app uses ``rooms.newUnique()`` but this here uses ``OBJECT_NAMESPACE``
1...113114115...567Latest