AlertSubscription に含まれるユーザー ID に基づいて取得したい大きな (約 20000) オブジェクトがあります。これにはGAEで20秒以上かかりますが、これをより速くすることは可能でしょうか? 標準クエリを使用して 5 秒で 20000 個の AlertSubscriptions オブジェクトを既に取得しているので、DeviceInfo オブジェクトに 20 秒以上かかるのはおかしいと思います。
私の現在のロジックは次のとおりです。
- アラート サブスクリプションのリストを取得する
- サブスクリプションに関連付けられているすべての DeviceInfo を取得します
- 各 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;