Thanks Li for looking into it.
For me 1-2 minute delay is fine, problem is like contains query(for
finding friend's data), i can pass max 30 user id, so basically on one
page i will be able to show max 30.
But in other case where wall type data need to be saved queries need
to perform faster and need to break the limit of 30 as i would like to
get latest activity from all of my friends rather then first 30
friends. So if i have 300 friends i may need to run such query 10
times in the batch of 30 nad each time need to go through activties
and sort them out which will be very time consuming and sure user will
not like the response time.
I am thinking why not do it at the write time that my updates goes to
all of friend's domain but again in one 30 second request i will try
to create/update my domain(user Data) + 300(assuming i have 300
friends) other domains. I am not sure how it will perform.

But i would love to see some solution where write is less and still
read is faster like any other site(facebook/twitter etc)


Ravi.


On May 18, 4:31 pm, Yiming Li <yiming...@umail.ucsb.edu> wrote:
> This is an interesting problem, I am not an expert on database design,
> especially key-value based datastore,  but I will try to answer this
> question.
>
> For me, the design like
> Class User{
> Key id;
> String name;
> String email;
> List<key> friends.
> ...etc}
>
> makes perfect sense, and as you said, you can do more query on
> something like "UserActivity" or "TimeBecomeFriends", with
> "user1Id=<userId> or user2Id=<userId>". approach. I am also fine with
> it.
>
> How big is your application? I think a good design is relevant to the
> scalability, and we are always trading storage space with query time.
>
> Another thing maybe useful is memcache, using it may lead to a gain in
> performance, although it may bring a bit data inconsistency,  however
> I think it's ok. For example, it should be fine if you see your
> friends' latest post 1 minute later.
>
> Maybe there is some paper talking about datastore design for scalable
> applications? Not sure.
>
> Thanks
>
>
>
>
>
> On Tue, May 18, 2010 at 7:58 AM, Ravi <ping2r...@gmail.com> wrote:
> > Hi,
> > I am trying to design a website like Facebook, where user will have
> > friends and will have wall where they can see there friend's updates
> > etc. While designing it on GAE i got confused with what will be the
> > best approach like data duplicate, data read time or data write time
> > etc
>
> > Friend's Design:
> > I thought there will be User and User will be friend with another
> > User.
>
> > Class User{
> > Key id;
> > String name;
> > String email;
> > ...etc
> > }
>
> > Now i definitely can not have owened relatioship with Friends means I
> > can not have List<User> friends in my User Class as it will not be
> > same domain(User) data, so i thought ok i will have List<Key> or
> > List<Long> User Ids as Friends
> > Class User{
> > Key id;
> > String name;
> > String email;
> > List<key> friends.
> > ...etc
> > }
> > And confusion/problem begins.
> > First a Friendship is supposed to be from both side, so it should be
> > defined only once but in this design both Friends will have each
> > other's id in there friend list. Basically its not a typical
> > relationship. What if i want to keep friendship info like when it
> > started, who introduced etc. Then i may need to create a new Friend
> > class with two fields as user1Id and user2Id and query this class with
> > user1Id=<userId> or user2Id=<userId>. But not sure about this
> > approach.
> > Second i am doing data duplicate(but i am fine with it if it can be
> > proved as best solution).
> > Third: I am showing one user's profile and want to show his friends on
> > one page, so first i need to get the User and its Friend List<Key>
> > then i need to search User for each and every Id to get each user's
> > data(like name.profile id and photo). For me it seemed bit longer
> > process.Not sure how queries will perform.
> >  Pseudo Code will be like this
> >   > Get Logged In User
> >   > Loop through friends field
> >        >Begin
> >          get User for each iterated Friend Id.
> > //and if we want to show how many friends that user have, then i will
> > be accessing friend list for each friend,so there will be lot of data
> > read from database.
> >        >End
> > put all data in jsp to compile and show it to user.
>
> > Other design problem related to wall like Facebook wall/profile,
> > Lets say i have UserActivity class to keep track of User's Activity
> > and that can be owned by User, so User class can look like
> > Class User
> > {
> > Key id;
> > String name;
> > String email;
> > List<Key> friends//assume we are going with this kind of design
> > List<UserActivity> activities
> > }
>
> > Class UserActivity
> > {
> > Key id;
> > String statusMessage;
> > Date time;
> > User user;
> > }
>
> > Now i want to show all activities of a user to him/her order by
> > time(recent first/on the top).
> > Now again i see one way of doing it as get all the Friend's id from
> > List<Key> friends field, query all User data then go through
> > UserActivity and get all data in memory and sort it out. This seems
> > not a good option to me.
> > How can i solve this problem efficiently and design a good solution.
>
> > Thanks in advance
> > Ravi.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Google App Engine for Java" group.
> > To post to this group, send email to google-appengine-j...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > google-appengine-java+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/google-appengine-java?hl=en.
>
> --
> Yiming
> MS student of CS Department @UCSB
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/google-appengine-java?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to