JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Application Server » GAE  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友   
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 使用 High Replication 儲存資料
pakxpakx





發文: 24
積分: 0
於 2011-07-03 15:00 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
GAE/J的文件上說明,使用 High Replication 最好是使用ancestor query, 也就是Entity最好都要有一個parent。所以這樣entity就會長得像樹狀圖一樣,但是樹狀圖一定會有樹根,也就是一定會有一些Kind的Entity是樹根,是沒有parent的,那麼是否有必要為這些沒有parent的entity,特地建立一個parent,讓這些entity都變得有parent,也不再是樹根?

reply to postreply to post
作者 Re:使用 High Replication 儲存資料 [Re:pakxpakx]
mylee





發文: 764
積分: 1
於 2011-07-04 09:39 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
pakxpakx wrote:
GAE/J的文件上說明,使用 High Replication 最好是使用ancestor query, 也就是Entity最好都要有一個parent。


你上面這段的最後一句是錯誤的結論,再看一下文件吧。

However, in the High Replication datastore, queries across entity groups (in other words, non-ancestor queries) may return stale results. In order to return strongly consistent query results in the High Replication environment, you need to query over a single entity group. This type of query is called an ancestor query.

意思是,你查的資料,應該最好來自同一個 entity group,不然可能會有 stale result. 而不是說只要 entity 有 parent,你就可以任意同時讀取它們而不會出問題。先把 entity group 這個概念弄清楚吧!


reply to postreply to post
作者 Re:使用 High Replication 儲存資料 [Re:mylee]
pakxpakx





發文: 24
積分: 0
於 2011-07-04 09:46 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
ok, 大大我明白你的意思,同一個parent才在同一個entity group, 所以擁有同一個parent的entity可以一起進行修改吧?
另外我有一點不明白,就是如果ancestor path超過兩個,也就是變成這樣
root entity -> entity1 -> entity2
那麼這三個entity是算在同一個 entity group裡面嗎?


reply to postreply to post
作者 Re:使用 High Replication 儲存資料 [Re:pakxpakx]
mylee





發文: 764
積分: 1
於 2011-07-04 10:06 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
pakxpakx wrote:
ok, 大大我明白你的意思,同一個parent才在同一個entity group, 所以擁有同一個parent的entity可以一起進行修改吧?
另外我有一點不明白,就是如果ancestor path超過兩個,也就是變成這樣
root entity -> entity1 -> entity2
那麼這三個entity是算在同一個 entity group裡面嗎?


算啊!同一個 root 就是同一個 entity group,不過和是否同一個 Kind 沒關係。
不過要小心,不要為了能夠用 transaction 而到最後把整個系統設計成單一 entity group 就糗了。


reply to postreply to post
作者 Re:使用 High Replication 儲存資料 [Re:mylee]
pakxpakx





發文: 24
積分: 0
於 2011-07-04 12:38 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
ok, 大大我明白你的意思,不過我還有一個問題
同一個entity group裡面,entities的數量有限制嗎?如果有可以透過付費擴充嗎?

另外,ancestor query才有strongly consistency,非ancestor query,是eventual consistency,指的是非ancestor query出來的結果,有可能剛剛才put的entity還不會出現,是這個意思嗎?


reply to postreply to post
作者 Re:使用 High Replication 儲存資料 [Re:pakxpakx]
mylee





發文: 764
積分: 1
於 2011-07-04 14:47 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
pakxpakx wrote:
ok, 大大我明白你的意思,不過我還有一個問題
同一個entity group裡面,entities的數量有限制嗎?如果有可以透過付費擴充嗎?


Google 負責員工 (IKai L) 說沒有限制。
http://groups.google.com/group/google-appengine-java/browse_thread/thread/de7a91d92b2bc6be?pli=1

他當時提到唯一問題是你如果要一次讀出該 entity group 會遇到問題。因為當時一個 request 最多回傳 entity 數量和總大小的上限不算很大。後來是放大還是取消限制我也忘了,要再查一下才知道。


另外,ancestor query才有strongly consistency,非ancestor query,是eventual consistency,指的是非ancestor query出來的結果,有可能剛剛才put的entity還不會出現,是這個意思嗎?


要看你的 datastore 的種類,不一定都是 eventual consistency

http://code.google.com/intl/en/appengine/docs/python/datastore/queries.html

The Master/Slave Datastore and the High Replication Datastore have different guarantees when it comes to query consistency. By default:

* The Master/Slave datastore is strongly consistent for all queries.
* The High Replication datastore is strongly consistent by default for queries within an entity group. With the High Replication Datastore, non-ancestor queries are always eventually consistent.

同份文件的另一段

When you select eventual consistency for a datastore query, the indexes used by the query to gather results are also accessed with eventual consistency. Eventual consistency queries occasionally return entities that don't match the query criteria, while strong consistency queries are always transactionally consistent. (You can use transactions to ensure a consistent result set if the query uses an ancestor filter.) See Transaction Isolation in App Engine for more information on how entities and indexes are updated.


reply to postreply to post
» JWorld@TW »  Application Server » GAE

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8