Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for extending database size? #39

Open
bclothier opened this issue Aug 20, 2018 · 4 comments
Open

Support for extending database size? #39

bclothier opened this issue Aug 20, 2018 · 4 comments

Comments

@bclothier
Copy link
Contributor

As I understand it, WhiteDB require that size parameter be provided when creating/loading the database. This doesn't work well in scenarios where the size isn't known in advance and could vary considerably.

If it's not practical to implement extending an open database's memory space, what strategies are available for allocating more memory on demand in a performant manner?

@priitj
Copy link
Owner

priitj commented Aug 23, 2018

Well, I would agree with you that such scenario is not well supported.

Possible strategies:

  • allocate a lot of memory in advance (wastes memory)
  • if you have many databases, store them all together and use a field as indicator (still wastes memory, but no more than a single database would)
  • split the database into fragments and use some hash-based addressing scheme. Possibly allocate fragments on demand (multiple indexes won't work well, single one could be coerced to work)

@bclothier
Copy link
Contributor Author

Just for my education, why can't we simply extend? If I understand everything is an offset within a contiguous block of memory, adding new offsets beyond the first block would spill over into the 2nd block that's allocated on the demand. It's acceptable to keep allocating new blocks which can be then linked so that one block handles a set of offsets, right?

I am also considering whether it's acceptable to dump database, resize, load. The only concern is whether this will cause excessive pause between resizes.

@priitj
Copy link
Owner

priitj commented Aug 23, 2018

AFAIK we don't have enough control over how the shared memory is mapped into the virtual address space. There should be contiguous unused address space available to fit all the segments and future segments for that idea to work. Some platforms do not even let you control where your segment is mapped.

@bclothier
Copy link
Contributor Author

Ah, gotcha. My scenario actually was for a local database; I do not need it in the shared memory. Would that make a difference?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants