Archive for the ‘Google App Engine’ Category

 

The Year Ahead for Google App Engine!

5月 15th, 2011

The Year Ahead for Google App Engine! http://googleappengine.blogspot.com/2011/05/year-ahead-for-google-app-engine.html http://googledevjp.blogspot.com/2011/05/google-app-engine-preview.html 今年の後半に、料金体系はかわるそうで Paidは月額 9 $ が必要になり。 SLAが 99.95とか ストレージは、HRDになり 0.24$かな もう少ししたら今の状況で新しい料金体系になったらいくらかサンプルが出るようです。 appengine SDK 1.5.0もリリースされましたね。 http://code.google.com/intl/ja/appengine/downloads.html

Read full article | コメントは受け付けていません。

HTTP POST PUTが遅い. | google app engine

5月 10th, 2011

なんとなくやっていて気付かなかったけど 数字を見ていて・・・なことに気がついた。。。。 POSTが。。。。遅い。 自分の環境も関係あるかもしれませんが、数か所(appengine側も数ユーザーのアプリケーションに対して)から試してみましたが同じ感じです。 appengineにPOSTリクエストすると遅いです。 POSTデータを付けて送ると何も処理しなくても遅いです。。。 1KBとかではなくて、数バイトPOSTで送るだけでだいたい2秒かかります。 原因はわかりません。ただ遅いです。 PUTに書き換えてみましたが、やはり遅いです。2秒かかります。 GETは速いです。 同じデータ量で、1KB以上でも速いです。 ただ2048bytesまでしか送ることが出来ないので・・・ 別の方法を考えたほうが良さそうです。 ユーザー向けの部分で使わないからまぁ良いかな。2KB以内ならGetで良いし。

Read full article | コメントは受け付けていません。

db.Model+db.put()と Entity+datastore.Put()の速度比較 python | google app engine

5月 10th, 2011

とりあえず、書いてみたのですが予想通り。 datastore.Putは db.putの中で呼ばれてるだけなので、やってることは一緒ということで差はありませんでした。 Model , 各 propertyも何か邪魔になるようなこともしていないようで。 50件put db.Model継承 db.put 319ms 2210cpu_ms 2000api_cpu_ms | cost -254 megacycles. 273ms 2210cpu_ms 2000api_cpu_ms | cost -245 megacycles. 250ms 2210cpu_ms 2000api_cpu_ms | cost -235 megacycles. 334ms 2233cpu_ms 2000api_cpu_ms | cost -271 megacycles. 665ms 2210cpu_ms 2000api_cpu_ms | cost -267 megacycles. 直接 entity作って、datastore.Put。low level api 470ms 2233cpu_ms 2000api_cpu_ms | cost -249 […]

Read full article | コメントは受け付けていません。

datastore low level っぽく pythonを使ってみる|google app engine

5月 10th, 2011

まずは、 .get_by_key_name()を調べてみました。 google\appengine\ext\db\__init__.py keys = [datastore.Key.from_path(cls.kind(), name, parent=parent) for name in key_names] if multiple: return get(keys, config=config) else: return get(keys[0], config=config) こうなっていたので Key.from_pathから kindと nameにkey_nameにしていたものを入れればOKと key = Key.from_path(‘myitem’, ‘my_test’) entity = Get(key) みたいな。 Putして Getしてみる。 Blob , datetime データはどうなる? entity = Entity(“bbtune”,name=”test2″) bdata = Blob(zlib.compress(‘tttttttttttttt’)) tdata = datetime.datetime.fromtimestamp(float(130000000)) entity.update({ ‘p': 100, ‘bdata': bdata, ‘tdata': tdata […]

Read full article | コメントは受け付けていません。

Billing Setting 課金設定をしてみる | google app engine

5月 9th, 2011

課金設定をしてみます。 左メニューの Billing Settings から Billing Status: Free Enable Billingボタンをクリック。 Customを選択すると以下のように入力欄が出て入れると計算して表示してくれます。 とりあえず、2.15ドルで。 下に行って、Countryを日本にして Review Weekly Contract : 一週間で最高 15.05$になりますという表示です。 問題なければ 最後に google checkです。 App Engine Budget – Maximum weekly budget for application ‘gr-aucru’, including applicable tax. 定期購入の詳細: 毎週、最大 USD 15.05 が請求されます。 開始時の残高 2011/05/09. という内容。 クレジットカードを入れて。Google CheckOUTを続けて 「ご注文が完了しました。」となります。 http://code.google.com/intl/ja/appengine/docs/billing.html app engineに戻って billing settingsを見ると Billing Status: Activating […]

Read full article | コメントは受け付けていません。

quota : cpuの使用量をチェック | google app engine

5月 9th, 2011

cpuは課金してみようと思います。 CPUの利用量がわかるらしいのでやってみます。 quota.pyとして置いてみました。 関数の前後で数字を取得して、差分をチェックしている例。 http://code.google.com/intl/ja/appengine/docs/quotas.html#Per-minute_Quotas import logging from google.appengine.api import quota start = quota.get_request_cpu_usage() do_something_expensive() end = quota.get_request_cpu_usage() logging.info(“do_something_expensive() cost %d megacycles.” % (start – end))

Read full article | コメントは受け付けていません。

datastore putの速度 100件put | google app engine

5月 8th, 2011

datastore の putが遅いです。 でも複数のアイテムを同時に入れてもあまり変わらない?らしいので確認。 http://code.google.com/intl/ja/appengine/docs/python/datastore/overview.html にある通り500エンティティはput出来るようなのでついでに500も ( 0.3 sec は、ほとんどネットワークの問題です。) 1つのputに2.3秒かかります。 100個のputは4.3秒でした^-^。 500個のputは7.9秒でした^-^。 model詳細は適当に消したので気にしないでリストに100個入れてdb.put()するだけです。 model_list = [] for key in self.list: item = MyModel(key_name=self._generateKey( key )) item.en = datetime.datetime.fromtimestamp(float(self.list[key]['e'])) item.setData(self.list[key]['t'],self.list[key]['u'],self.list[key]['i'],self.list[key]['d']) item.pr = self.list[key]['p'] item.bi = self.list[key]['b'] model_list.append(item) db.put(model_list) 1件のときの結果 2.3605380058289 object(stdClass)#1 (2) { ["success"]=> int(1) ["error"]=> array(0) { } } 100件の時の結果 4.3123650550842 object(stdClass)#1 (2) { […]

Read full article | コメントは受け付けていません。

datastore putの速度 property name | google app engine

5月 8th, 2011

http://www.mail-archive.com/google-appengine@googlegroups.com/msg25095.html モデルのクラス名、プロパティ名は、短いほうがputの処理速度が速いそうです。 とりあえず、プロパティー名は、nameを付けることで、短く指定してみました。 price = db.IntegerProperty(name=’p’) CPU利用時間も変わるので、いちおモデル名も短めにしておきます。

Read full article | コメントは受け付けていません。

google app engine の速度

5月 8th, 2011

簡単な速度を。 さくらのVPSからabの結果です。 結果 300ms-500ms というところでした。 悪くはないですね。 あたり前ですが、さくらのネットワーク内のコンテンツとは比較にならないので。。。 やっぱり自前のAPIはさくら内に持つかフロントをすべてapp engineへ移行するかの2択のようです。 数段階のアクセスは無理なので。現状は大規模データだけ任せて細かい所は現状と同じく memcached +mysql , tokyotyrantで行くしかなさそうです。 1. 通常テキストページ # ab -n 100 -c 20 http://gr—–.appspot.com/ Server Software: Google Server Hostname: gr—–.appspot.com Server Port: 80 Document Path: / Document Length: 398 bytes Concurrency Level: 20 Time taken for tests: 1.746154 seconds Complete requests: 100 Failed requests: 0 Write […]

Read full article | コメントは受け付けていません。

UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 2-8: ordinal not in range(128) | Google App Engine

5月 7th, 2011

UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 2-8: ordinal not in range(128) なんぞこれ。 import sys print sys.getdefaultencoding() ascii だそうで、これが駄目なようで。。。 通常のpythonは、 sitecustomize.py に import sys sys.setdefaultencoding(‘utf-8′) を追加すればいいそうです。 app engineでは、それを各場所が無いので。直接読み込まれるファイルに書かないといけないそうです。 app.yamlに設定してあるファイルに書く必要があるそうでデフォルト main.pyでしょうか。 main.pyの先頭に import sys if ‘ascii’==sys.getdefaultencoding(): stdin = sys.stdin stdout = sys.stdout reload(sys) sys.setdefaultencoding(‘utf-8′) sys.stdin = stdin sys.stdout = stdout と書いてみました。 reload(sys)が無いとだめで。stdin stdoutのデータ保管も初回は無いとだめな感じで。 ローカルの場合は、1ファイルだけ更新とかあるので、何度も読み込まれないけど、本番環境は、更新時だけかな? とりあえず。

Read full article | コメントは受け付けていません。