1

AlertSubscription に含まれるユーザー ID に基づいて取得したい大きな (約 20000) オブジェクトがあります。これにはGAEで20秒以上かかりますが、これをより速くすることは可能でしょうか? 標準クエリを使用して 5 秒で 20000 個の AlertSubscriptions オブジェクトを既に取得しているので、DeviceInfo オブジェクトに 20 秒以上かかるのはおかしいと思います。

私の現在のロジックは次のとおりです。

  1. アラート サブスクリプションのリストを取得する
  2. サブスクリプションに関連付けられているすべての DeviceInfo を取得します
  3. 各 OS (Android、iOS、WP7/8) ごとに 1 つのタスクを開始します。

したがって、一度にすべてのデバイスが必要なので、カーソルを使用してもあまり役に立ちません。これを高速化するために、オブジェクトのキーにインデックスを追加する方法はありますか? datastore-index.xml ファイルにインデックスが設定されていません。

    List<com.googlecode.objectify.Key<DeviceInfo>> dKeys= new ArrayList<com.googlecode.objectify.Key<DeviceInfo>>(); 
    for (AlertSubscription s: filteredSubscriptions.values()) 
    {
        dKeys.add(new com.googlecode.objectify.Key<DeviceInfo>(DeviceInfo.class,s.user));

    }
    log.info("Getting keys " + filteredSubscriptions.size());
    Map<com.googlecode.objectify.Key<DeviceInfo>, DeviceInfo> fetched = ofy.get(dKeys);
    log.info("Got keys, looping now");
...
   @PersistenceCapable(identityType = IdentityType.APPLICATION)
   public class DeviceInfo {
      @PrimaryKey
      @Persistent
      @Indexed
      private Key key;
4

1 に答える 1

0

これは私のためにそれを解決しました:

ObjectifyOpts opts = new ObjectifyOpts();
opts.setConsistency(Consistency.EVENTUAL);
Objectify ofy = ObjectifyService.begin(opts);

https://groups.google.com/forum/?fromgroups=#!topic/objectify-appengine/1dIi-JOK_k4

于 2013-03-07T20:12:46.427 に答える