谁需要分布式事务?

June 16th, 2010

有个项目,用 Tuscany 实现了 SCA 。然后呢,服务与服务之间会互相调用。然后呢,因为你不知道被调用的下一个服务被部署在什么地方,所以就需要分布式事务。一切多么的合理。

Bullshit.

Martin Fowler说 ,分布式对象设计第一原则:不要分布你的对象。如何利用多个进程?集群,而非分布。

因为很显然,如果应用程序本身是 无状态的 ,分布式对象基本上无法带来任何集群不能提供的好处:性能,吞吐量,都不可能在涉及跨进程调用的情况下超过进程内调用。唯一可能的好处是,能够把应用程序分成小块,分别部署在不同的机器上。

是的,这就是这个项目需要分布式对象(以及,分布式事务)的真正原因。当然,不是因为一台服务器不能负载整个应用程序,而是因为一个邪恶的原因:把功能模块与服务器硬件绑定。你已经买了功能A,还想要功能B吗?请购买功能B──和它所在的整个服务器。不管你的访问量是否大到需要一台真正的服务器,我们粗制滥造的程序会把它的性能都用尽的。

是的,再一次地,一个企业级超复杂技术的漂亮广告词被扯开之后,归根结底就是一个制造浪费从而制造需求的邪恶玩意。Fxxx IBM

JRubyWorks: J2EE on Rails

August 18th, 2007

(NOTE: JRubyWorks keeps moving forward and this article may not be up to date.)

How to run your Rails application with J2EE web servers (such as Jetty and Tomcat)? Here’s a solution:

1. Set JRUBY_HOME environment variable properly.

export JRUBY_HOME=/usr/lib/jruby

2. Install ActiveRecord-JDBC.

jruby -S gem install ActiveRecord-JDBC -y

3. Install JRubyWorks plugin.

script/plugin install \
http://jrubyworks.rubyforge.org/svn/trunk/jrubyworks/

4. Configure your Rails application as this article. JRubyWorks plugin includes mysql-connector by default. If you use database other than MySQL, you can put corresponding JDBC driver in ${RAILS_ROOT}/lib/java directory and JRubyWorks will take care of it conventionally.

5. Run your application and try it at http://localhost:8080. Also you can find a WAR file of your application in ${RAILS_ROOT}/war directory. You can deploy it to other J2EE web servers.

jruby -S rake retty

JRubyWorks is based on JRuby Rails Integration and hope to make the integration easier. It’s quite immature so far, apparently. Your feedback and contribution will be very helpful and highly appreciated.