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

Question about server performance... Are we doing something wrong? #96

Open
ericoe opened this issue Sep 17, 2017 · 2 comments
Open

Question about server performance... Are we doing something wrong? #96

ericoe opened this issue Sep 17, 2017 · 2 comments

Comments

@ericoe
Copy link
Contributor

ericoe commented Sep 17, 2017

First let me thank you for this wonderful package!

We must be doing something wrong... There seems to be too much server activity for a single update... and really busy for several consecutive (though uncoupled) updates.

When we do a single update like this:

Cards.update(
	{_id: id},
	{$set: newData},
	{
		tx: true,
		context: {deckId: card.deckId, cardId: id}
	}
);

We get 4 invocations of tx.checkPermission. I can almost understand 3, but 4?
We also get 2 "Executed update" logs.

If we make several of these "single transacted updates" in a client-side loop... things get really strange. The first one generates 4 invocations, 2 executes... the second one 8 invocations and 4 executes, the third generates 12 and 6, etc. It is as if the tx processor thinks that the subsequent updates are somehow related to each other. (They are not.)

The Kadira logs for a single update look like this:

find/fetch card
find/fetch card
find/fetch transaction
update card
update card
find/fetch transaction
find/fetch oplog

Why 2 fetches on the card? Why 2 updates?
And, in the case where the client is doing several updates in a loop... the Kadira log is really nasty... following a similar pattern described in the 4/8/12/16 above.

I'd appreciate any suggestions or insight.
Thanks!
Eric

@JackAdams
Copy link
Owner

Yes, this is strange. These, as written, should auto-commit and just execute sequentially.

What exactly does a newData object look like? If it's actual data to overwrite the card's data in its entirety, it won't work -- the package doesn't support that kind of update. The newData object would have to be of the form:

{ set: { field1: value1, field2: value2 } }

@ericoe
Copy link
Contributor Author

ericoe commented Sep 17, 2017

Yes. newData is exactly as you guessed.
If we track this down you'll be the first we tell.
Thank you.

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