Translate: Azul为开源社区项目提供免费的Zing JVM

 

4月末,继Zing 5.2 之后, Azul Systems宣布他们将无停顿(pauseless )的Zing JVM提供给开源软件开发者和项目,以供开发和测试。

Azul Systems 工程部副总裁和合作创始人Shyam Pillalamarri向InfoQ说明道:

我们的部署很大一部分基于开源组件,所以我们认为:“假设我们不能将一些有价值的东西免费提供给开源项目贡献者,他们将一直受限于从Java虚拟机(JVM)视角所看到的内容”,他们将不会考虑额外的用例,或者选择其他能解决了所有内存或扩展性问题、类似Zing的系统。如果这样的话,他们会面临堆占用尺寸过大且没有下降趋势的问题。

这个想法产生于开源社区早期贡献者的经验。例如,Apache Lucene项目参与者及PMC项目成员Michael McCandless在新闻稿中谈到:

Azul创新的Zing JVM和无停顿垃圾回收(GC)使Apache的 Lucene 项目开发者开始去研究需要大规模堆的事例(例如为了更快搜索将整个搜索索引存在内存中)。基于全维基百科英文站点的索引内存初步测试显示Zing真正实现了在管理140GB以上堆时不用暂停。

Clojure创始人Rich Hickey提到:

平衡不可变性以提高并发性和扩展性的的编码和架构策略使Zing JVM能很好地支持无任何中断或停顿的、持续的高对象分配率。Azul将Zing JVM开源,这为社区作出了杰出贡献。

除了在垃圾回收(GC)时不用停顿,Zing的GC收集器(详见这里)设计的很健壮,能支持各种平台。这主要得益于受突变、碎片比率、堆大小、软引用、存活对象尺寸等因素影响较小。同样地,Zing很适合需要高内存占用、高事务率、稳定响应时间、高持续吞吐量的负载场景。同时5.2版本在性能上有了进一步优化,特别是在同步方法调用和对象共享上。

Zing基于Oracle HotSpot,针对Linux和x86平台进行了优化。5.2版本支持以下Linux发行版:

  • Red Hat Enterprise Linux (5.2以上, 6.x)
  • SUSE Linux Enterprise Server (SLES 11 sp1和sp2)
  • CentOS (5.2以上, 6.x)
  • Ubuntu Linux (10.04 LTS, 12.04 LTS) -Zing 5.2版本新支持的平台

JVM支持任何基于Java SE/EE 6的应用程序,不久将来会支持Java 7。

Zing JVM发行版同样包括了产品应用可视化工具,称做Zing Vision,它提供了以一套工具用以在不恶化潜在故障的前提下实时获取故障程序的信息。在5.2版本有一些功能上的增强,例如在安全的时刻去收集更多的垃圾回收统计数据。

想在开源项目中使用Zing的用户可以发邮件至zing_oss@azulsystems.com;获取免费技术支持可访问Azul开源项目社区支持论坛http://www.azulsystems.com/developers/forum;如果发现问题可以访问http://www.azulsystems.com/developers/bugzilla,当然他们也提供商业化支持。

英文原文:http://www.infoq.com/news/2012/08/azul-zing-free

Open source: common-remote-pool

Apache common object pool can help user to manager resource, but if use it , you will find you can only share resources in one machine,not between multi-process or multi-machine. So we use the object pool to constructor one web service to provide distributed pool to share resources between multiple machines. The web common remote pool provide one default implement which can add any json string to pool and borrow json resource from it.What’s more, the resource object factory’s class can be uploaded into the web service. In short, the project is restful style web object pool for global access.

http://code.google.com/p/common-remote-pool/

How to initial it

1. mvn tomcat7:run to start the webservice;

2. If you need define your implement, you should upload your resource factory class , if you have no need, omit this step.

How to use it

http request style

  • borrow the object from pool
 	Request:
 	        GET http://localhost:8080/common-remote-pool/service/object/borrow

 

Response: has resource response code:200 response body: json example: {“domain”:”10.224.64.225″,”user”:”6731″}

Response: no resource response code:404

 

  • return resource to pool
 	Request:
 		POST http://localhost:8080/common-remote-pool/service/object/return                 
                body: json
 		example:{"domain":"10.224.64.225","user":"6731"}

 

Response: response code:204

  • get borrowed resouce number
 	Request:
 		GET http://localhost:8080/common-remote-pool/service/object/active

 

Response: response code:200 response body: number

  • add resource to pool
 	Request:
 		POST http://localhost:8080/common-remote-pool/service/object/add

 

body: json example: {“domain”:”10.224.64.225″,”user”:”6731″} or [{“domain”:”10.224.64.225″,”user”:”6731″},{“domain”:”10.224.64.13″,”user”:”6732″}]

Response: response code:200

  • flush all resource
 	Request:
 		GET http://localhost:8080/common-remote-pool/service/object/drain

 

Response: response code:200

  • get idle resource number
 	Request:
 		GET http://localhost:8080/common-remote-pool/service/object/idle

 

Response: response code:200 response body: number

  • get pools resource amount info
 	Request:
 		GET http://localhost:8080/common-remote-pool/service/object/idle

 

Response: response code:200 response body: {“idleNumber”:3,”borrowedNumber”:3,”totalNumber”:6}

  • query current enabled resource factory
 	Request:
 		GET http://localhost:8080/common-remote-pool/service/object/getFactory

 

Response: response code:200 response content: such as com.googlecode.common.remote.pool.resource.DefaultResourceFactory

  • list all resource in pool
 	Request:
 		GET http://localhost:8080/common-remote-pool/service/object/list

 

Response: response code:200 response content: “no any resource” or {file=1.txt, owner=jiafu}:2014-04-28 14:29:34

client style

The client’s code amount is so small that you can copy the code directly.

 

        com.googlecode.common.remote.pool.client.CommonRemotePoolClient.CommonRemotePoolClient(String)
        com.googlecode.common.remote.pool.client.CommonRemotePoolClient.borrowObject(Class<T>)
        com.googlecode.common.remote.pool.client.CommonRemotePoolClient.returnObject(Object)
        com.googlecode.common.remote.pool.client.CommonRemotePoolClient.addObject(Object...)

Dependence:

        <dependency>
          <groupId>org.jboss.resteasy</groupId>
          <artifactId>resteasy-jackson-provider</artifactId>
          <version>2.3.1.GA</version>
        </dependency>
        <dependency>
          <groupId>org.jboss.resteasy</groupId>
          <artifactId>resteasy-client</artifactId>
          <version>3.0.2.Final</version>
        </dependency>

How to manage resource

you can manage resource by default implement.