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

leaps loads documents twice (on first load) #5

Open
jonasfj opened this issue Oct 4, 2015 · 4 comments
Open

leaps loads documents twice (on first load) #5

jonasfj opened this issue Oct 4, 2015 · 4 comments
Labels

Comments

@jonasfj
Copy link
Contributor

jonasfj commented Oct 4, 2015

Instrumenting store.Fetch I saw that leaps called store.Fetch a lot.
Fixing the flush_period_ms to 60s helped a lot. I guess if you're using the file system 500ms might be sane (for a few files), but anything else we're probably better off with a much higher default.

Anyways, whenever a document is opened for the first client, not the second client, it's fetched twice.
I assume the leaps doesn't keep active documents in memory, which is why it does fetch prior to storing anything. I like that, very efficient.

Perhaps I should do a pull-through storage engine that caches on disk, and does a real fetch if the file isn't on disk.. It could be done as a wrapper to any storage engines.

@jonasfj
Copy link
Contributor Author

jonasfj commented Oct 4, 2015

Also, leaps seems to fetch the document every flush_period_ms regardless of whether or not there is any changes to the document.

This is a problem, if we have a lot of documents open. Afaik most people keep a lot of idle tabs around..

@Jeffail
Copy link
Owner

Jeffail commented Oct 4, 2015

From scanning the code I can't see straight away where this is happening but there's certainly no reason for it. I'm planning on looking into this next time I'm free but if anyone works it out feel free to send a pull request.

@jonasfj
Copy link
Contributor Author

jonasfj commented Oct 4, 2015

I suspect it's NewBinder followed by Subcribe both of which does a flush(). Since we don't keep the document in memory, I'm not sure how to fix this...

Maybe NewBinder could return the Document and subscribe could optionally take a Document parameter... But it's not pretty... So maybe not... I think fixing the mutex is more important...

@Jeffail
Copy link
Owner

Jeffail commented Oct 4, 2015

Ah gross, I remember choking over this before. I'll leave this open for now and come back after a few sleeps.

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

No branches or pull requests

2 participants