Java Google App Engine批量加载程序下载警告"__key__没有降序索引,执行串行下载"

Ste*_*wie 7 java google-app-engine bulkloader objectify

可能重复:
App引擎批量加载程序下载警告" 密钥没有降序索引,执行串行下载"

我的帖子非常相似:App引擎批量加载器下载警告"__key__没有降序索引,执行串行下载"

我基本上想要做同样的事情.

基本上,我使用以下内容来下载我的一种类型的所有实例:

appcfg.py download_data --config_file=bulkloader.yaml --kind=ModelName --filename=ModelName.csv --application=MyAppid --url=http://MyAppid.appspot.com/remote_api
Run Code Online (Sandbox Code Playgroud)

如果类型的实例多于批量大小,那么我会收到此警告:

No descending index on __key__, performing serial download
Run Code Online (Sandbox Code Playgroud)

这导致我只下载大约6500个实体需要471.4秒(根据bulkloader工具完成后).这真的很慢,因为我还有其他4种甚至更大(大约15,000个实体)!

另外根据我的Mac的活动监视器,我只以大约24Kb /秒的速度下载,如bulkloader输出中的带宽所示:

[INFO    ] Logging to bulkloader-log-20110514.011333
[INFO    ] Throttling transfers:
[INFO    ] Bandwidth: 250000 bytes/second
[INFO    ] HTTP connections: 8/second
[INFO    ] Entities inserted/fetched/modified: 20/second
[INFO    ] Batch Size: 10
Run Code Online (Sandbox Code Playgroud)

我的问题是:

1)如何摆脱这个警告"__key__没有下降索引,执行串行下载"以获得并行下载速度?

我认为我的问题的答案是添加降序索引.就像是:

<datastore-index kind="Game" ancestor="false" source="manual">
    <property name="id" direction="desc"/>
</datastore-index>
Run Code Online (Sandbox Code Playgroud)

我尝试将其添加到datastore-indexes.xml文件中.

它已成功部署,但我查看了Google上管理门户网站上的数据存储区索引,但我没有看到它正在服务或正在构建.无论如何,为了它,我重申下面的命令,它仍然很慢......

我也尝试将相同的xml,但使用source ="auto",添加到datastore-indexes-auto.xml文件.但是,当我尝试部署我的eclipse抱怨时出现以下错误:

java.io.IOException: Error posting to URL: https://appengine.google.com/api/datastore/index/add?app_id=<My_APP_ID>&version=1&
400 Bad Request
Creating a composite index failed: This index:
entity_type: "Game"
ancestor: false
Property {
 name: "id"
 direction: 2
}

is not necessary, since single-property indices are built in. Please remove it from your index file and upgrade to the latest version of the SDK, if you haven't already.
Run Code Online (Sandbox Code Playgroud)

2)删除此警告是否要求我更新自动生成的bulkloader.yaml?我在下面列出了游戏类型:

python_preamble:
- import: base64
- import: re
- import: google.appengine.ext.bulkload.transform
- import: google.appengine.ext.bulkload.bulkloader_wizard
- import: google.appengine.ext.db
- import: google.appengine.api.datastore
- import: google.appengine.api.users

transformers:

- kind: Game
  connector: csv
  connector_options:
    # TODO: Add connector options here--these are specific to each connector.
  property_map:
    - property: id
      external_name: key
      export_transform: transform.key_id_or_name_as_string

    - property: __scatter__
      #external_name: __scatter__
      # Type: ShortBlob Stats: 56 properties of this type in this kind.

    - property: genre
      external_name: genre
      # Type: String Stats: 6639 properties of this type in this kind.

    - property: name
      external_name: name
      # Type: String Stats: 6639 properties of this type in this kind.

    - property: releasedate
      external_name: releasedate
      # Type: Date/Time Stats: 6548 properties of this type in this kind.
      import_transform: transform.import_date_time('%Y-%m-%dT%H:%M:%S')
      export_transform: transform.export_date_time('%Y-%m-%dT%H:%M:%S')
Run Code Online (Sandbox Code Playgroud)

有用的发现

当我输入这个问题时.我发现了这款App Engine Bulk Loader性能

它基本上解释了将bandwidth_limit增加到合理的值并增加rps_limit可以真正帮助加快速度.

所以我尝试过:

appcfg.py download_data --config_file=bulkloader.yaml --kind=ModelName --filename=ModelName.csv --application=MyAppId --url=http://MyAppId.appspot.com/remote_api --rps_limit=500 --bandwidth_limit=2500000 --batch_size=100
Run Code Online (Sandbox Code Playgroud)

其中下载时间减少到109.8秒.这是一个巨大的减少!

但是,我的目标仍然集中在摆脱"__ key__上没有下降索引,执行串行下载"以进行并行下载.


额外的信息可能是相关的

我正在使用objectify3.0.jar来操纵我的GAE数据存储区.所以我的游戏类似:

public class Game {
    @Id private Long id; //This is my key, auto generated by objectify  
    private String name;
    private String genre; 
    private Date releasedate;

    //ommitting getters and setters 
}
Run Code Online (Sandbox Code Playgroud)