Posts Tagged ‘feedlr’

feedlr的2008

Thursday, December 18th, 2008

08年初,我在开发feedlr的时候,就只是想做一个对人们有用而且好用的工具。虽然我是个程序员,但是我向来热爱设计,精巧而优美的事物总是最能吸引我(天秤座?)。其实如果我在中学没有读理科班,到现在很可能是个设计师,因为在那个时候我就非常对设计方面非常感兴趣。有点扯远了:)

我对自己的作品一直是很挑剔的,我为feedlr设定的标准很简单,要让我自己爱用它。那么feedlr做到了吗?我觉得80%做到了吧。自从feedlr上线开放以来,我自己就一直订阅着好几个feedlr驱动的微博机器人,每天可以直接在im上快速阅览我感兴趣的新闻,用了feedlr机器人确实大大提高了我的feed阅读速度。

feedlr的定位本身就决定了它只可能在略geek的群体中传播,但是看着每天新增的feed机器人,我感到非常欣慰。刚开始,feedlr上线的只有英文版。大家可能觉得奇怪,还有人问过我是不是中国人。其实,虽然我从小在上海长大,但是我确实一直对中文互联网没多大兴趣和接触。因为我英文还不错,在上个世纪末通过14.4k modem接触网络的时候,网上的中文内容还非常贫乏,所以我从一开始就是喜欢浏览英文内容。而且对一个标准geek来说,也确实在英文互联网上有多得多的吸引的内容。中文世界呢?新浪?网易?还有百度?我都几乎从来不上。看着这些弹出窗口花花绿绿满屏的广告毫无设计可言的页面就烦。中文互联网是不属于geek的。

我这么说可能很有争议。我在之前对中文互联网最多的接触,还是在兼职solidot.org的主编的那段时间。但自从feedlr项目起深入接触中文互联网,认识了很多朋友,却更巩固了我这样的认识:中文互联网也不缺少才华横溢的geek,但是统治这个江湖的却是一批中年商人。这只是一个商业世界的延伸,而不是一个容得下创新和geek精神的地方。人们谈论和崇拜的是马云,而不是戴志康。叽歪是我一年多来用得最多的国内web2.0服务,创始人李卓桓也是我很敬佩的一位朋友。但在csdn英雄会上,大家争相握手献媚的却是垃圾网站51.com的庞升东,那位号称只找60年代人合伙的商人。

没错,不管是不是做互联网,business的目的总是赚钱。但其实,就像Paul Graham说的那样,我们想要的其实是财富,而不是钞票。那么,在一个理性的世界,你创造出了人们想要的东西,就是创造了财富。所以,你应该努力做到的,是不断创造出人们想要的,有用的东西来。而不是挖空心思想着怎么从无辜的人兜里抢钱。这个世界也不能离开商人,但是真正创造财富的,是创造商品的人,而不是把商品卖到不可思议的高价的人。更重视前者的社会,才是一个理性的值得尊敬的社会,也是一个有持续发展动力的社会。因为这样,这个社会里的人才会整天想着怎么做出更棒的产品,而不是做梦都想明天怎么去忽悠下一个客户或者投资人。当人们崇拜的是钞票而不是财富时,这个社会就失去了创新的动力。

而我们的互联网,其实和整个社会一样,是个浮躁浅薄的地方。只要这样的状态不改变,这里不会真正有中国的google,中国的facebook,当然也不会有中国的TechCrunch,更不可能出现Y Combinator。有的只能是C2C(Copy To China),只能是忽悠了钱走人的MBA,还有拿个ecshop几分钟搭个网店就认为是互联网创业的青年。

一不小心就说了那么长一通,其实我打算写这篇文章是想感谢一下分享web2.0的盗盗同学,把feedlr提名为“2008 最值得关注的15个 China Web2.0 Startup”。和那些我很喜欢和尊敬的web2.0项目摆在一起,其实颇不好意思。话说我差不多也有半年没有改进feedlr了。我希望的只是feedlr能继续对人们有用。在feedlr之后的时间里,我其实放弃了一些hardcore geek的想法,认真尝试了中文互联网创业的方式,为钱做过了妥协,圈了几十万的用户,也有日pv一百几十万的成果。但是在2008年即将过去的时候回头看看,还是feedlr为我带来了最多的快乐。

一个人能有一些值得坚持的原则是应该珍惜的,所以我想,在即将到来的新的一年,不管金融危机怎么恶化,不管“业界”热点转成抄袭哪个另外的国外网站,我还是会照着自己的原则做事,做出更多对人们有用的东西来。feedlr也会继续办下去的,因为至少,我还需要用它来每天快速接收新闻呢!另外,我也可能比较彻底的改写一下feedlr,让它变的更有用。

如果你喜欢和支持feedlr,现在可以通过文章底下的tipjoy来方便的支付一小笔零钱了。

Feedlr支持做啥微博客,并即将支持OAuth认证

Tuesday, May 6th, 2008

大家可能已经发现,在新建和编辑Feed的时候,可以选择微博客服务为做啥了。没错,Feedlr开始支持广播到做啥了。使用方式和其他支持的服务一样。而且类似叽歪,在做啥,你也可以通过播发完整链接(选择不使用TinyURL转换),来在网页上直接内嵌多媒体内容。目前由于API的差别,暂时无法在Feedlr显示做啥帐号关注者人数和总消息数。

另外,Feedlr即将支持最新的OAuth认证方式。OAuth是一种开放的API安全认证标准,通过OAuth,大家就不必在Feedlr提供微博客帐号的用户名和密码,也能建立广播机器人了,这样能最大程度地保证用户账户的安全性。目前叽歪已经开始支持OAuth,Twitter也有非正式的支持,正式支持应该也快了。Feedlr将首先支持叽歪的OAuth认证。

Performance tuning for Grails app in a memory constrained environment

Sunday, April 20th, 2008

Feedlr has been running quite well for a while, until a couple weeks ago, the server started to choke a lot. And I realized I had to do something to improve the performance. Actually, until then I had barely paid any attention performance-wise - getting the app up and running was the goal. And then with the growth of the app it’s time to do some work for that.

The Problem

The symptom of the performance bottleneck was that from time to time Tomcat would take a long time to respond, resulting in timeouts at the browser clients. This is caused by heavy swapping - apparently the 512MB RAM shared by all the services on the VPS, including Apache (with worker mpm), php, MySQL, and Tomcat, is less than abundant. But before upgrading my VPS, I want to see how far I can go with the current specs.

Attempting to optimize the code

My first attempt was to review my code and try to identify any possible memory leaks and memory inefficient spots. After working with profiling tools (I used an evaluation version of JProfiler, which is very good), and several refractory efforts, there was no obvious improvement. It didn’t look like a memory leak. And the effort trying to squeeze more memory from the code didn’t seem to pay off.

Tuning the JVM

Then I began to focus on tuning the JVM. The sporadic heavy swapping hints at inefficient garbage collections. But why is GC taking so much resources? Using GCViewer, I can see that the throughput can be as low as around 70%. And full GC time constantly reaches several minutes. (SliceHost has sent me a dozen heavy swap usage report already)

After some searching and study, first thing I tried was to decrease the maximum heap size. Yes, decrease it. Previously, I was assigning 384MB to the heap. Because while Tomcat is not running, I have a little less than 440MB free physical memory. Leaving some buffer, 384MB seems a reasonable number. But the excessive swapping and very long full GC time indicates that part of the heap must be slipping into the virtual memory. And virtual memory is the biggest enemy of JVM garbage collection. So I decreased the heap size incrementally, arriving at 270MB. And the GC log shows that the time full GC takes has considerably dropped.

To further improve the situation, I tried different GC policies. First I tried the Concurrent Mark Sweep GC policy, which is supposed to work very well with multi-processor servers and is optimized for response time. Profiling with the CMS options on my local workstation shows good results. And since “cat /proc/cpuinfo” shows that my VPS is equipped with 4 CPU’s, I was expecting to see obvious improvements.

However, to my great disappointment, CMS totally strangled my VPS. Soon after Tomcat starts up, CPU usage became constantly high and the Grails app responds even slower! I’m not exactly sure why, but it looks like the number of CPU’s shown at your VPS doesn’t mean it has the comparable concurrent processing power.

Then I gave up the CMS policy and tried the other GC policy suitable for servers, the Parallel policy. This turned out to work quite well on the VPS, together with “-XX:+UseParallelOldGC” which is available since Java 5 update 6 and enhanced in Java 6 which I’m running my app on.

The Results

I experimented with a few other JVM options, and finally achieved a throughput of above 98%. Full GC now usually takes around 1 second, occasionally maxing at over 10 seconds. I think there are some hard limitations to the server, but the results are already good enough for now. Here are the current ones which have achieved reasonable performance for my Grails app. These may not be the perfect setup since I haven’t tried the combinations exhaustively.

-server -Xmx270m -Xms270m -XX:MaxPermSize=80m -Xverify:none -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+UseAdaptiveSizePolicy -XX:SurvivorRatio=4 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=31 -XX:+AggressiveOpts

References

Below are some useful articles I’ve come across while tuning the JVM.

Further thoughts

I really love Grails for what it is: remarkably agile development with real joy. But as the person running the app, I have to deal with various issues of the stack that Grails sits on, which sometimes frustrates me.
On one hand this robust stack really grants Grails an advantage in the enterprise market. But on the other hand, this is no good news for the creators of hundreds and thousands of small web apps, pet projects, interesting weekend hacks and alike. The most obvious obstacle is Java hosting. It’s 2008 already, and there are still simply _no_ easily affordable and good enough hosting services for the Java stack! The entry cost is too high. With innovative services like Heroku and Googel App Engine emerging, the gap is even increasing. The barrier to actually making something useful on the web is being dramatically lowered. But yet, the Java stack is left out in the cold.

While this is a problem, it’s also an incredible opportunity. With Grails emerging, the Java stereotype can be changed. People can build agile web apps on top of the proven stack, which is the core competency of Grails as I see it. I want to build things with Grails. But I don’t want to worry about how to host my app. Now, who’s gonna give us the ultimate service to grow little ideas into reality?

Feedlr十八般用法之:消息前缀的妙用

Sunday, April 6th, 2008

不知道大家有没有注意到,在新建一个Feed广播的时候,可以在Feed信息的“更多选项”里填上给每条消息加上的前缀。

image

这个功能有什么用呢?最简单的用法,可以用博客的标题,Feed的内容关键字,等等作为前缀,这样关注者收到就知道消息是从哪里来,关于什么的了。但今天我想介绍的是几种更有趣的用法。

@通知某人

如果设定了前缀“@用户名”,那么发送的每条消息都能通过@功能让某人(用户名)收到。目前Twitter,叽歪,饭否都支持@功能。

有什么用呢?比如你向自己的微博客帐号发送消息,如果不加@前缀,那么新消息别人都能收到而你自己收不到。如果加上前缀“@你自己的用户名”,那么你和你的帐号的关注者都能收到新消息了。

另外,@功能可以让不关注这个帐号的人也能收到消息通知。

把消息做为私信发送给某人

想到了@的用法,可能你也就想到了d的用法。在Twitter和叽歪,支持用格式“d 用户名 消息内容”来直接发送私信给某人。如果给你的feed消息加上前缀“d 用户名”,那么每条feed消息都会直接做为私信发送给这个用户。

这样的话,你的feed机器人就成为某人(大多是你自己吧)的专用了,feed的消息不会被微博客上的其他人看到。

用前缀定义track关键字

Twitter和叽歪都支持关键字track功能,但是各自的使用方式有所不同。

在Twitter,用户可以通过GTalk或者手机发送“track 关键字”来自定义关键字跟踪。这样,只要有人在Twitter发表了包含关键字的消息,用户就能收到这条消息。

而在叽歪,如果一条消息带有“[关键字]”的内容,那么方括号里的关键字就自动成为一条线索。用户可以通过访问“http://jiwai.de/t/关键字”的地址来看到所有带有这个关键字的消息。在关键字页面上,用户可以订阅feed或者关注这个关键字。在IM和手机上,也可以发送“on [关键字]”来直接关注。

那么,如果你用feedlr广播到Twitter或者叽歪的话,你自然可以给你的feed加上相应的关键字前缀,就能保证关注这个关键字的用户都能收到feed的更新了,而不论用户是不是关注了你的机器人帐号。

Feedlr is now alive!

Saturday, March 1st, 2008

Hi friend, my latest pet project feedlr has gone alive! After testing the initial version with friends, I’ve decided to make Feedlr open to the public now.

Feedlr is a service inspired by twitterfeed, built with Grails. It is both an automatic feed tweeting service like twitterfeed, and a bot showcase for miniblog users to browse, find, and follow interesting bots on popular miniblog services. Currently, Feedlr supports miniblogs including Twitter, JiWai, and FanFou. The idea is to make Feedlr a thriving farm of miniblog bots where anyone can create or adopt cute bots.

You can use Feedlr to broadcast feeds to multiple miniblogs

To do this, please first sign in or sign up for an account, and then click the “New” tab on the top and follow the simple wizard.

The wizard will ask for “bot accounts”, which means miniblog accounts used to broadcast the feeds. You should have already registered an account on a supported miniblog and provide the account information to the wizard.

A note on privacy here. Since the way miniblog API’s are designed, Feedlr has to have your bot login information in order to do the posting. So it’s strongly recommended that bot creators don’t use their personal accounts as bot accounts, but create dedicated accounts for the bot service only.

Feed creators can choose to attach a feed up to 2 bots at a time, choosing among the 3 currently supported services.

Feedlr is also a bot showcase

In addition, you can simply browse for bots on Feedlr and find interesting ones to follow. Once you want to follow a certain bot, there are two ways to follow it and both should take less than 10 seconds.

First, you can simply click the bot avatar and visit the bot’s homepage on the miniblog. Then just follow the bot as how you do it with the miniblog service.

Second, you can click the “Follow” hover menu. You will be prompted to enter your own login for the miniblog service where the bot is hosted. To ensure privacy and security, Feedlr does not record you login in any way. It’s strictly used to follow the bot for this one time.

Feedlr loves feeds, miniblogs, and you!

So start by feeding it with more feeds:)

If you have any comments, find any bugs, want any new features, or just want to say something, please leave a word or two by replying to this blog post. Feedlr is a new born baby. Love and caring makes it grow healthily and fast!