Comments (15)
Would this check both the number of records and the overall record size?
from nds.
I wrote this feature for goon, it's not as trivial as it sounds there's
lots of gotcha, particularly how you return on partial success.
On Fri, Apr 3, 2015, 2:25 AM Derek Perkins [email protected] wrote:
Would this check both the number of records and the overall record size?
—
Reply to this email directly or view it on GitHub
#6 (comment).
from nds.
@derekperkins I am not quite sure what you mean. appengine/datastore
only allows you to GetMulti
a maximum of 1000 entities in one go. PutMulti
and DeleteMulti only allow 500 entities. With
nds.GetMultiit breaks the entities up into chunks of 1000 or less and then executes concurrently as many calls to
datastore.GetMultias necessary to retrieve all the entities. This doesn't currently happen with
nds.PutMultiand
nds.DeleteMulti` but I would like to add code to make it happen.
In practical terms though if I were to try to nds.GetMulti
5000 entities, each 1Kb big then I would need to set my context timeout to 30 seconds from the default 5 seconds and even then would probably get timeout errors.
@mzimmerman is right about it being non trivial to implement. If he looks closely, he might see how similar my implementation is to his. Thanks for the help Matthew. 😜 I originally wrote my code with channels and realised Goon's looked much nicer.
from nds.
@mzimmerman I wasn't trying to make it sound trivial. We've looked at implementing this for a while now, but haven't precisely because it is complex.
@jongillham There are more reasons to chunk it up than just the record count. We have also run into issues where the total size of the PutMulti
causes an error. I don't know if that is because it is the 10 MB transactional limit mentioned here https://cloud.google.com/appengine/docs/go/datastore/#Go_Quotas_and_limits or some undocumented limit.
We refer to that error internally as Too big for missiles, switching to guns
, because we sometimes have to not use a PutMulti
and instead do a lot of concurrent Put
s. There's for sure some optimal middle ground there, but we haven't found it yet.
from nds.
@derekperkins I understand now. I've not run into that limit yet. I have a feeling that the maximum size an RPC response can be is 32Mb. So you would want to automatically chunk your Gets/Puts/Deletes if the size is > 10/32Mb or number of entities > 1000. That seems useful. It would almost certainly have to use some reflection to follow down struct members counting the size of each member.
from nds.
I just ran into this over the weekend and got verification that there is a 1 MB limit for a PutMulti.
"There's a per-API call limit of 1 MB for almost every API call, including datastore.*." - David Symonds
https://groups.google.com/forum/#!topic/google-appengine-go/kzSVWIwIbP0
from nds.
Ran into this just now. Possible to prioritize this? Or do you want a PR?
Thanks for nds
btw.
from nds.
Hi @kidoman I'm happy to add the feature. I just need to do a bit of research as @mzimmerman is right. It isn't as trivial as it sounds due to the possibility of partial failure.
@mzimmerman how did you tackle the problem with Goon if one datastore.PutMulti
succeeds and another one fails for a single call of nds.PutMulti
? I believe that datastore.PutMulti
can also have partial failure? If that's the case then I suppose I would just return an appengine.MultiError
from my nds.PutMulti
and mark all the errors associated with the failed datastore.PutMulti
as non nil. Does that sound reasonable?
from nds.
Yes, that's exactly right, a MultiError.
https://github.com/mjibson/goon/blob/master/goon.go#L220
See maddyblue/goon#20 for the discussion around the
design decisions
On Sun, Oct 18, 2015, 5:39 AM Jonathan Gillham [email protected]
wrote:
Hi @kidoman https://github.com/kidoman I'm happy to add the feature. I
just need to do a bit of research as @mzimmerman
https://github.com/mzimmerman is right. It isn't as trivial as it
sounds due to the possibility of partial failure.@mzimmerman https://github.com/mzimmerman how did you tackle the
problem with Goon https://github.com/mjibson/goon if one
datastore.PutMulti succeeds and another one fails for a single call of
nds.PutMulti? I believe that datastore.PutMulti can also have partial
failure? If that's the case then I suppose I would just return and
appengine.MultiError from my nds.PutMulti and mark all the errors
associated with the failed datastore.PutMulti as non nil. Does that sound
reasonable?—
Reply to this email directly or view it on GitHub
#6 (comment).
from nds.
@mzimmerman thanks for the input.
@kidoman I've released the changes to the concurrent branch. Please let me know how you get on and I'll merge it to master in a few days if everything is OK.
from nds.
@jongillham I have looked the code and left a few comments. Thanks for putting this together.
from nds.
@kidoman here's the next instalment b240b98 with your suggestions. Thanks for spotting the potentially disastrous race condition bug!
from nds.
Looking forward to the merge!
from nds.
Commit 705d168 adds this functionality.
from nds.
Danke!
Sent from my iPhone
On 27-Oct-2015, at 12:55 AM, Jonathan Gillham [email protected] wrote:
Commit 705d168 adds this functionality.
—
Reply to this email directly or view it on GitHub.
from nds.
Related Issues (20)
- Remove zeroMemcache* code. HOT 1
- It is not possible to detect if nested contexts are transactional. HOT 5
- Make the transaction context safe for concurrent access. HOT 1
- Failing tests with "appengine: NewContext passed an unknown http.Request" HOT 2
- Different namespaces used for memcache and datastore HOT 4
- Migrating data when the underlying struct changes HOT 2
- Tests fail when using nds HOT 14
- nds item not stored warning HOT 4
- Calling AddMulti for a single entity instead of Add HOT 2
- Panic with datastore.PropertyLoadSaver HOT 3
- Make compatible with cloud.google.com/go HOT 8
- ErrFieldMismatch in GetMulti returns only one result HOT 4
- Gracefully handle memcache quota limits HOT 2
- Support saving of entities to memcache in putMulti() HOT 7
- Tag v2 branch as v2.0.0 HOT 3
- [v2] Possible marshal/unmarshaling bug HOT 2
- Change locking policy for Transaction HOT 1
- Change module versioning from git branches to subdirectories. HOT 2
- want new tag in v2 HOT 2
- failed to Put dial tcp 192.168.0.3:15127: connect: connection refused HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nds.