App Engine的速度有多快db.get(keys)和A.all(keys_only = True).filter('b =',b).fetch(1000)? [英] How fast are App Engine db.get(keys) and A.all(keys_only=True).filter('b =', b).fetch(1000)?

查看:139
本文介绍了App Engine的速度有多快db.get(keys)和A.all(keys_only = True).filter('b =',b).fetch(1000)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

50个键的db.get()似乎需要5-6秒。这是正常的吗?什么时候是函数的一部分?



我也做了一个A.all(keys_only = True).filter('b =',b).fetch(1000) Ab是ReferenceProperty。我做了50次这样的往返数据存储,有不同的b值,总时间只有3-4秒。

这怎么可能? db.get()是并行完成的,只有一次到达数据存储区,我认为通过键查找实体是一个比获取更快的操作。



这里是我的类A的定义:

  class App(db.Model):
name_atom = db。 ReferenceProperty(AppName)
author = db.ReferenceProperty(Author)
short_desc = db.StringProperty()
description = db.TextProperty()$ b $ url url = db.StringProperty()
rating_avg = properties.RangeProperty(0,1000,default = 0)
rating_count = properties.RangeProperty(min_value = 0,default = 0)
add_dt = db.DateTimeProperty(auto_now_add = True)
modify_dt = db.DateTimeProperty(auto_now = True)

更新

好的,AppStats说: datastore_v3.Get real = 2272ms api = 416ms



我认为发生的事情是,我正在做这个db.get([50个关键字]),在大量其他低效率之后数据存储在相同的请求处理程序中调用,并且它只是限制了我或某事的速度。其他时间我做了相同的db.get(),它返回200ms:)

解决方案


50个键的db.get()似乎需要
5-6秒。这是正常的吗?什么是
功能的时间?


没有。它应该需要几百毫秒。你怎么计算它呢?

lockquote
我也做了
A.all(keys_only = True).filter(' b =',
b).fetch(1000)其中Ab是
ReferenceProperty。我在数据存储区做了50次这样的
次旅行,其中b $的b $ b值不同,总时间仅为
3-4秒。




这并非毫无道理,只有50次往返。


这可能如何? db.get()并行完成
,只有一次到
数据存储,我认为
通过key查找实体的操作速度比
更快fetch。


这是一个非常奇怪的结果,我认为在工作中可能存在混淆因素。正如David所言,您应该使用AppStats来发现时间。


A db.get() of 50 keys seems to take me 5-6 seconds. Is that normal? What is the time a function of?

I also did a A.all(keys_only=True).filter('b =', b).fetch(1000) where A.b is a ReferenceProperty. I did 50 such round trips to the datastore, with different values of b, and the total time was only 3-4 seconds.

How is this possible? db.get() is done in parallel, with only one trip to the datastore, and I would think that looking up an entity by key is a faster operation than fetch.

Here is the definition for my class A:

class App(db.Model):
    name_atom = db.ReferenceProperty(AppName)
    author = db.ReferenceProperty(Author)
    short_desc = db.StringProperty()
    description = db.TextProperty()
    url = db.StringProperty()
    rating_avg = properties.RangeProperty(0, 1000, default=0)
    rating_count = properties.RangeProperty(min_value=0, default=0)
    add_dt = db.DateTimeProperty(auto_now_add=True)
    modify_dt = db.DateTimeProperty(auto_now=True)

Update

OK, AppStats says: datastore_v3.Get real=2272ms api=416ms

I think what's happening is that I'm doing this db.get([50 keys]) right after a ton of other inefficient datastore calls in the same request handler, and it's just rate limiting me or something. Other times I've done the same db.get() and it returned in 200ms :)

解决方案

A db.get() of 50 keys seems to take me 5-6 seconds. Is that normal? What is the time a function of?

No. It should take a couple of hundred milliseconds. How are you timing it, though?

I also did a A.all(keys_only=True).filter('b =', b).fetch(1000) where A.b is a ReferenceProperty. I did 50 such round trips to the datastore, with different values of b, and the total time was only 3-4 seconds.

That's not unreasonable, for 50 roundtrips.

How is this possible? db.get() is done in parallel, with only one trip to the datastore, and I would think that looking up an entity by key is a faster operation than fetch.

It's an extremely odd result, and I think that there are likely confounding factors at work. As David suggests, you should use AppStats to discover where the time is going.

这篇关于App Engine的速度有多快db.get(keys)和A.all(keys_only = True).filter('b =',b).fetch(1000)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆