Rah*_*hul 5 python performance google-app-engine bulk-load bulkloader
我正在使用App Engine批量加载器(Python运行时)将实体批量上传到数据存储.我上传的数据以专有格式存储,所以我已经通过自己的连接器(注册它bulkload_config.py)实现,将其转换为中间python字典.
import google.appengine.ext.bulkload import connector_interface
class MyCustomConnector(connector_interface.ConnectorInterface):
....
#Overridden method
def generate_import_record(self, filename, bulkload_state=None):
....
yeild my_custom_dict
Run Code Online (Sandbox Code Playgroud)
要将此中性python字典转换为数据存储区实体,我使用我在YAML中定义的自定义帖子导入功能.
def feature_post_import(input_dict, entity_instance, bulkload_state):
....
return [all_entities_to_put]
Run Code Online (Sandbox Code Playgroud)
注意:我没有entity_instance, bulkload_state在我的feature_post_import功能中使用.我只是创建新的数据存储实体(基于我input_dict),并返回它们.
现在,一切都很好.但是,批量加载数据的过程似乎需要花费太多时间.例如,GB(~1,000,000个实体)的数据需要大约20个小时.如何提高批量加载过程的性能.我错过了什么吗?
我与appcfg.py一起使用的一些参数是(每个线程批量大小为10个实体的10个线程).
链接了Google App Engine Python小组帖子:http://groups.google.com/group/google-appengine-python/browse_thread/thread/4c8def071a86c840
更新:为了测试批量加载过程的性能,我加载entities了"测试" Kind.虽然这entity很简单FloatProperty,但仍然需要花费相同的时间来批量加载它们entities.
我仍然会尝试改变批量加载器参数rps_limit,bandwidth_limit并且http_limit,看看我是否可以获得更多的吞吐量.
有一个名为的参数rps_limit确定每秒上传的实体数量。这是主要的瓶颈。该值的默认值为20。
还要将 增加到bandwidth_limit合理的程度。
我增加了rps_limit,500一切都改善了。我实现了每 1000 个实体 5.5 - 6 秒,这比每 1000 个实体 50 秒有了重大改进。
| 归档时间: |
|
| 查看次数: |
1004 次 |
| 最近记录: |