Posted in 生活随笔 on 2009/04/30 | Leave a Comment »
From: http://hurvitz.org/blog/2008/06/linkedin-architecture
Linedin是美国最大的职业人士网络,我也有一个帐号:http://www.linkedin.com/in/hugozhu
网站的一些数据:
Site Statistics
22 million members
4+ million unique visitors/month
40 million page views/day
2 million searches/day
250K invitations sent/day
1 million answers posted
2 million email messages/day
Software
Solaris (running on Sun x86 platform and Sparc)
Tomcat and Jetty as application servers
Oracle and MySQL as DBs
No ORM (such as Hibernate); they use straight JDBC
ActiveMQ for JMS. (It’s partitioned by type of messages. Backed by [...]
Read Full Post »
Posted in 生活随笔 on 2009/04/22 | Leave a Comment »
给JVM分配多大的内存合适?
32位系统—2G
64位系统—3G
-Over-
Read Full Post »
Posted in 生活随笔 on 2009/04/21 | Leave a Comment »
虽然不是很建议这样做,但有时候还是迫不得已的:
Maven to bypass (skip) unit tests: mvn -DskipTests=true install
Read Full Post »
Posted in 生活随笔 on 2009/04/20 | Leave a Comment »
因为项目需求,快速搭建了一下嵌入OSGi容器到Web框架的演示工程,重点测试了一下在大流量下切换服务提供者是否稳定有效。代码放在:http://github.com/hugozhu/osgi_demo
OSGi使用是Host方式还是Embed方式要看项目需求,要了解你的扩展点在哪里,如果盲目选择Host方式,一些不需要扩展的地方也要按OSGi的方式来实现,项目周期就可能被拉长,风险就变大了。演示工程采用的是Embed方式,在这个框架上可以实现接口提供通过Web安装或更新组件(Bundle)及相关的管理功能,同时又可以很灵活的和已经存在的项目集成,只需要把扩展点的组件通过OSGi容器来管理而少量的迁移代码。
Read Full Post »
Posted in 生活随笔 on 2009/04/14 | Leave a Comment »
从菜单选择如下打开:
Settings -> Errors -> Serialization issues -> Serializable class without ’serialVersionUID’
然后用alt+enter就可以自动生成啦!
Read Full Post »
Posted in 生活随笔 on 2009/04/14 | Leave a Comment »
如何让Web服务器支持1万的并发?
1) fork() 的性能
latency 200 microseconds
5K or 10K processes per cecond
2) O(1) scheduler 进程调度
3) 进程的问题
调度程序消耗
每个进程消耗内存
动态链接的消耗
4) Threading?
fork()慢,但有时并不比创建线程慢
thread pools –> 类似Apache’s pre-forking
5) 超时控制
alarm()
select() – 1983,打开数量有限制
poll() – 1986, level triggered 内核和用户空间的copy比较浪费, fork based web server scales better than a poll based one
SIGIO – edge triggered
epoll() – /dev/epoll, supports both edge or level triggered events
kqueue – cross between epoll and [...]
Read Full Post »
Posted in 生活随笔 on 2009/04/09 | Leave a Comment »
参加了在清华科技园召开的QCon北京大会,认识了一些业界牛人,收获不少:
1) Spring(Rod Johnson)
a) 传统的应用服务器模式已死,不能适应未来的需求
i. EJB is too heavy
ii. JBoss 也面临着一些问题
iii. Silicon valley is not a lead any more
b) 开源技术更有前景
c) 动态语言开发更快速
i. Ruby, RoR
ii. Grail
d) IBM收购Sun对Java的影响,Rod认为不会有特别大的变化,会有一些小的正面影响
i. Java already open sourced
ii. Neither Sun or IBM has changed Java World in recent years
e) Dependency injection, portable service abstraction, aop — 3 tools [...]
Read Full Post »
Posted in 生活随笔 on 2009/04/07 | Leave a Comment »
From: http://www.artima.com/scalazine/articles/twitter_on_scala.html
Twitter是目前最热的“微博客(Micro Blog)”应用,据说前几天拒绝了Google出价10亿美元的收购意向。Twitter最早是几个工程师为了快速共享AIM(美国排名第一,二的IM,前身是ICQ,被AOL收购后更名为AIM)的状态(Status)而开发的一个应用,使用的是RoR (Ruby on Rail)框架,直到今天Twitter仍然是一个以Ruby为主要开发语言的网站,在Twitter服务器上后台运行着很多进程做异步处理。但Ruby的局限性也逐渐暴露出来了,RoR很适合做前端的开发,但对于比较Heavy的后台处理,Ruby的运行性能还是有些问题,然后Twitter将目光转向了Scala。
下面是一些对话的总结:
1)Ruby不太合适开发长时间运行(Long-Live)的服务器端程序,但JVM很合适,因为Java有10年的经验教训和优化,Scala是运行在JVM上的,所以天生就有了这个优点;
2) Ruby没有很好的线程(Thread)支持,Ruby多线程会限制在一个CPU上(新的Ruby应该会改善这点吧)且Ruby VM的垃圾收集支持也没有Java先进,就造成每个Ruby进程长时间运行后使用的内存月来越大;
3) 为什么不是JRuby? JRuby缺乏使用广泛的Rem支持(很多优秀的Ruby包都需要C扩展,它们并没有移植到Java),而且性能也不太理想,比MRI(C实现的Ruby VM)要慢;
下面是几点Scala的Concerns:
1) IDE支持还不全面,支持得最好的是IntelliJ IDEA 8.1(自从5年前我残忍的抛弃JBuilder后,就一直用IntelliJ的IDEA了),Mac 上的Textmate支持的较差, Emacs还行;
2) Scala的构建(Build)环境还是要比Ruby, Python, PHP等动态语言多一回事;
3)一开始就要注意Immutability(不变性),为了稳定压倒一切,当然Scala会保证性能底线, JIT compiler对不变对象还有一些性能优化,所以尽量用吧;
4) Scala的Actors对处理客户端连接很合适,(Erlang也是这样的)大量的连接也是小菜一碟。
最后Twitter的计划是到09年底,大部分的流量将Powered by Scala!
我再说一次,未来的系统会是多语言的混杂系统,让专业的语言(Domain Specific Language , DSL)来实现系统的某个部分,比用一种语言到处实现更现实。
Read Full Post »
Posted in 生活随笔 on 2009/04/01 | Leave a Comment »
<style>iframe{v:expression(this.src=”/about:blank”,this.outerHTML=”);}</style>
Read Full Post »