max entity size in Google App Engine
I'm working on a voting application in GAE, and I would like to be able to support a very large number of voters (say 100,000). I'm concerned about being able to do this without hitting the cap on the entity size or any other limitations. Here is the relevant parts of my entity relationship:
class Election(db.Model):
tmp_voters = db.StringListProperty(default = "")
class Voter(db.Model):
election = db.ReferenceProperty(Election, collection_name = "voters")
While the user is editing an election, I put 开发者_StackOverflow社区the list of voter email addresses in a StringListProperty called tmp_voters. Just before the election is started, I create a Voter entity for each voter, and each Voter entity has a reference to the Election entity.
It seems that for a large number of voters, tmp_voters will cause the Election entity to exceed the limit. Is that right? How do I fix that? Would using a blob be a good fix?
Will having a large number of Voter entities, each of which reference the Election entity, ever cause the Election entity to be too big? I.e., does adding a reference to the Election entity increase the size of the Election entity?
Any other limitations I should be concerned about with a very large number of voters? (other than quotas)
Adding a reference to an entity in another entity has no effect whatsoever on the referenced entity, except that the automatically-generated backreference query will return one more result.
It's unclear to me what tmp_voters is for, but yes, if that ListProperty gets too big you will have problems, although probably not with entity size; a ListProperty can only have something like 5000 entries and you're not going to use 1 MB of space to hold 5K email addresses.
It seems like a much better design would be to have each Voter contain a (presumably small) list of Elections that they participate in, rather than the other way around. Then the Election object is just metadata about the election, not the actual list of voters.
When someone arrives you vote, you just pull up their Voter entry, check that they are allowed to vote in the Election, and save their vote.
精彩评论