15 十月, 2008

GAE SDK的批量数据上传工具

总有些Datastore,譬如说常量表等,需要初始化的数据,写了一小段代码执行数据初始化,不过始终无法正常执行,原因是GAE服务器在操作开始后不久就返回timeout或者exceed CPU quota错误。

实际上,GAE允许的一天CPU使用的QUOTA有200,000,000 megacycles,而需要初始化的只有1200多条记录,理论上,绝无超标的可能。但是GAE Quota System它的主要任务是保证应用在整个一天之内的可用性,象上面提到的这种集中使用CPU的操作,Quota System认为它可能会影响应用在接下来的时间内对CPU资源的利用,所以也会以exceed quota的理由拒绝。(参考:Understanding Application Quotas with Google App Engine)

试了几次,都不行,没辙了,又返回去看GAE Articles,才注意到GAE SDK中就带有"Bulk Data Uploader"(tools/bulkload_client.py)这才是正道啊。(参考:Uploading Data with Bulk Data Uploader

然而,事实胜于雄辩,经过测试,Bulk Data Uploader一样不能避免上述Quota limit的问题,特别是batch_size比较大的时候。而且,对于中文数据,因为Python 2.5缺省的codec是ascii而不是utf-8,所以在调用cvs库的iter方法时,会由于无法成功encode而触发类似"UnicodeEncodeError: 'ascii' codec can't encode characters in position 3-7: ordinal not in range(128)"这样的异常。

解决办法:减少batch_size的值,每一次少上传一些数据,减少GAE那里datastore的压力;并且,将bulkload.Loader拷贝到本地,修改代码,在调用cvs reader的iter方法之前,显式地将数据转换为utf-8格式:data=data.encode('utf-8')


9 十月, 2008

Oracle database and Amazon Cloud -- msg from OOW 2008

From Oracle OpenWorld 2008, "General Session: Best Practices for Oracle Database - Information Management in the Enterpris"

这个Session只谈及Oracle数据库11g,所以这里也只摘抄Oracle数据库在云上的新应用,不包括Oracle application的on-demand/SaaS服务。

New Oracle Secure Backup interface
• Works with all editions of:
– Oracle Database 10g
– Oracle Database 11g
• Amazon S3 supported today
• Uses familiar interfaces
– Oracle Enterprise Manager
• Encrypts data backups


可以从OTN上取得支持Amazon S3云备份的接口库,使用OEM统一界面操作,也可以使用RMAN,就像把数据库备份到磁带上一样简单。支持压缩,支持加密。

Easy Deployment in the Cloud
– Amazon EC2 supported today
– Pre-created Virtual Machine Images
– Deploy Oracle to Cloud in minutes
• Available for all editions
– Supported on the Cloud

你只需要告诉Amazon你想要用Oracle database,Amazon会提供你一份预先配置好的AMI,运行即可。


17 八月, 2008

开源的“Amazon EC2

Eucalyptus, 一个开源的软件基础架构,用以在Cluster上实施云计算。它在接口级和Amazon EC2兼容,你可以使用Amazon EC2的command-line tools与Eucalyptus交互。

只支持Linux系统,需要Xen虚机平台。

简单介绍Eucalyptus的slides:


9 八月, 2008

HP, 云计算 (Cloud Computing), Everything as a Service

  1. 上月末,HP, Intel and Yahoo! Create Global Cloud Computing Research Test Bed。 TechCrunch提前一天还让大家竞猜:What Are HP, Intel, and Yahoo Announcing Tomorrow?然而业界对此似乎反应平平,而2天后,SaaS/PaaS的代表人物之一Salesforce.com的CEO在他的关于Cloud and Service的文章里根本就没有提及此事件。
  2. 大家的分工如下:HP提供刀片(Blade),Intel提供CPU,Yahoo!提供软件(Hadoop & Pig)。
  3. 它的主要目的,不是提供Amazon EC2/S3或者Google GAE那样的面向终端用户的服务,而是为了"research on the software, data center management and hardware issues associated with cloud computing at a larger scale",就是面向“云”的基础建设。
  4. 这样,进入云时代后,HP还是可以继续卖刀片,当然用的是安腾,由Hadoop来支持高扩展性能。Yahoo!在这方面起步不算晚,但是声音太小,趁此机会,一来拉两个小兄弟一起壮壮声势,二来可以继续研究,争取后来居上。
  5. 至于HP提到的Everything as a Service,看HP的这个解释,象是比SaaS进一步,有点“Ubiquitous computing”的趋势。等看了他们提供的一个例子,你就会明白,这个EaaS实际上就是很多SaaS的Mashup。这里的Everything,不是指Software,Platform,Infrastructure,Network等,而是指All kinds of Applications。所以,归根结底,还是SaaS。
  6. 例子在这里:Here’s a simple example: say it’s 2 p.m. and your calendar shows you’re booked on a flight to Toronto at 6 p.m. Your device should have the smarts to anticipate what information you’ll need for this trip and then proactively gather it for you — a weather forecast for the Toronto area, a status update on your flight, a recommended route to the airport based on up-to-the-minute traffic conditions, and so on。日历服务+搜索+天气预报+航班服务+路径交通服务+...,这就是Everything的含义。
  7. Salesforce.com提供on-demand CRM服务,这是典型的SaaS。同时,因为他们已经有云了,在现有的Cloud上提供Force Platform服务也是发展的必然。Amazon的Google的那些(E2/S3/SIMPLEDB, GAE),都是在已有的Cloud内提供PaaS服务。HP/Intel/Yahoo!这个Cloud,是IaaS,Infrastructure as a Service,这个,比较靠谱。
  8. 补一下,搞个8条,纪念一下2008/08/08,昨天那个大日子,开幕式不错。