本文共 2961 字,大约阅读时间需要 9 分钟。
花了一天时间,将原先放在免费虚拟主机上的 Flex 留言板,连同原先的数据库数据,全部搬家到了 Google App Engine 上,这里大概说说体会: 1、选 Python 还是选 Java ? 原先的留言板后台是PHP,准备上 GAE 就得面临这个选择。几经尝试后还是决定选 Java。 本来 Python 功能同样强大,比 Java 更敏捷,主要问题是没有一个好用的 IDE,这就很麻烦。少个冒号、少导入个包、输错一个函数名,你不会得到任何提示,程序运行起来到满屏的错误信息,根本无法迅速查找错误,所以最后选择了 Java。语法虽然罗嗦点,但是一切都中规中矩,实在不行还有Groovy这位“皇储”,呵呵。 |
2、GAE 速度怎么样?
说实话,很一般,Google 的粉丝不要拍砖哦,我这有证据。下面的两个网址,是同一个的 Flex 留言板程序,数据也一样。 第一个在 GAE 上第二个在美国的一个免费虚拟主机上,距离远,而且速度带宽都有限制,自己比较下吧,我这里GAE 要慢很多。
要是同国内付费的虚拟主机比较,可能差距更大。
3、GAE 数据库好使吗? 还不错。但是 Google 应该在现有的 API 上再简单的包装一层,立刻就可以减少 80% 的重复代码。 比如,原先 PHP 版的留言板,在用 CodeIgniter 框架的情况下,一条留言从 request 到插入数据库,只需要几条语句。而现在要几十条语句。只要简单再包装一下,应该可以达到类似的效果。 4、GAE 配额都有什么限制? 限制的种类非常多,但是配额数都够用了。经过三四天的折腾,CPU 也才用了0.06个小时。 其他包括各种 API 调用次数也都是有限制的,我为了搬家,抓取原来的数据,使用了16次 UrlFetch API,好在配额六十多万次,够用了。程序上传发布一天只能250次,我现在用了9次,问题也不大。 用的最多的是 Datastore API ,已经用了一千多次了,但是配额是每天一千万次,哈哈,够用了吧。
Quotas are reset every 24 hours. Next reset: 5 hours
Resource | Daily Quota | Rate | ||
---|---|---|---|---|
CPU Time | 0% | 0.11 of 46.30 CPU hours | Okay | |
Requests | 0% | 2142 of 1333328 | Okay | |
Outgoing Bandwidth | 1% | 0.07 of 10.00 GBytes | Okay | |
Incoming Bandwidth | 0% | 0.00 of 10.00 GBytes | Okay | |
Secure Requests | 0% | 0 of 1333328 | Okay | |
Secure Outgoing Bandwidth | 0% | 0.00 of 10.00 GBytes | Okay | |
Secure Incoming Bandwidth | 0% | 0.00 of 10.00 GBytes | Okay |
Datastore API Calls | 0% | 4024 of 10368000 | Okay | |
Stored Data | 0% | 0.00 of 1.00 GBytes | Okay | |
Data Sent to API | 0% | 0.00 of 12.00 GBytes | Okay | |
Data Received from API | 0% | 0.02 of 116.00 GBytes | Okay | |
Datastore CPU Time | 0% | 0.09 of 62.11 CPU hours | Okay |
Mail API Calls | 0% | 0 of 7000 | Okay | |
Recipients Emailed | 0% | 0 of 2000 | Okay | |
Admins Emailed | 0% | 0 of 5000 | Okay | |
Message Body Data Sent | 0% | 0.00 of 0.06 GBytes | Okay | |
Attachments Sent | 0% | 0 of 2000 | Okay | |
Attachment Data Sent | 0% | 0.00 of 0.10 GBytes | Okay |
UrlFetch API Calls | 0% | 0 of 657084 | Okay | |
UrlFetch Data Sent | 0% | 0.00 of 4.00 GBytes | Okay | |
UrlFetch Data Received | 0% | 0.00 of 4.00 GBytes | Okay |
Image Manipulation API Calls | 0% | 0 of 864000 | Okay | |
Data Sent to API | 0% | 0.00 of 1.00 GBytes | Okay | |
Data Received from API | 0% | 0.00 of 5.00 GBytes | Okay | |
Transformations executed | 0% | 0 of 2592000 | Okay |
Memcache API Calls | 0% | 0 of 8640000 | Okay | |
Data Sent to API | 0% | 0.00 of 10.00 GBytes | Okay | |
Data Received from API | 0% | 0.00 of 50.00 GBytes | Okay |
Deployments | 0% | 0 of 250 | Okay |
最后看看超出配额的价格,下面的表格是每天0.1美元预算、偏重于存储的情况,11G的空间,够用了,博客园干脆也搬到 App Engine 上吧,呵呵。
Resource (% of Budget) | Budget | Unit Cost | Paid Quota | Free Quota | Total Daily Quota |
---|---|---|---|---|---|
CPU Time 40% | $0.05 | $0.10 | 0.50 | 46.30 | 46.80 CPU hours |
Bandwidth Out 8% | $0.00 | $0.12 | 0.00 | 10.00 | 10.00 GBytes |
Bandwidth In 2% | $0.00 | $0.10 | 0.00 | 10.00 | 10.00 GBytes |
Stored Data 50% | $0.05 | $0.005 | 10.00 | 1.00 | 11.00 GBytes* |
Recipients Emailed 0% | $0.00 | $0.0001 | 0.00 | 2000.00 | 2000.00 Emails |
==================================================
本文转自左洸博客园博客,原文链接:http://www.cnblogs.com/myqiao/archive/2009/05/12/1454670.html,如需转载请自行联系原作者