SpringSource dm Server 入门

工程 | Rob Harrop | 2008年10月22日 | ...

更新于 2008年10月28日:添加了最新的示例链接和第三个示例链接

昨晚我在 Philadelphia Spring 用户组 发表了题为“SpringSource dm Server 介绍”的演讲。在演讲中,我创建了一个名为 GreenPages 的小型应用,展示了 dm Server 的所有主要方面。我向与会者承诺会将应用和幻灯片发布到这里。

在 dm Server GA 发布以来的几周里,许多人一直在询问如何最好地开始使用 dm Server,所以我用这篇文章来汇总所有相关信息…。

Spring Batch 2.0 新功能概述

工程 | Dave Syer | 2008年10月21日 | ...

在本文中,我们概述了 Spring Batch 2.0 的主要主题,并重点介绍了相对于 1.x 的变化。新版本的开发工作进展顺利,上周发布了 M2 版本,我们收到了很多关注,所以现在似乎是提供一些指导的好时机。

Spring Batch 2.0 主题

新版本的四个主要主题是

  • Java 5 和 Spring 3.0
  • 非顺序执行
  • 可伸缩性
  • 配置:注解和 XML 命名空间
因此我们将分别介绍这些领域,并描述它们的含义以及这些变化对 Spring Batch 现有用户的影响。下面有更多关于已实现功能的详细信息,主要集中在第一类,以及其他领域的一些启用功能。

Spring Batch 2.0.0.M2 的项目物理布局没有变化(下载方式相同,Java 包的基本布局也相同)。我们没有删除任何功能,但我们借此机会修改了一些 API,并且有一些小的变化…。

理解 OSGi uses 指令

工程 | Glyn Normington | 2008年10月20日 | ...

如果你为 SpringSource dm Server 或任何其他 OSGi 平台构建应用,你很可能很快就会遇到 uses 指令。除非你清楚地理解该指令的目的,否则你不会知道何时编写它,当一个 bundle 因为 uses 冲突而无法解析时,你将束手无策。本文旨在让你透彻理解 uses 指令,何时使用它,以及如何调试 uses 冲突。

Bundle 解析

OSGi 的设计理念是,一旦 bundles 被“解析”,通常不应因类型问题而遇到类转换异常或类似问题…。

优化和调优 Apache Tomcat - 第 2 部分

工程 | Mark Thomas | 2008年10月14日 | ...

几周前,Filip Hanik 和我举办了关于优化和调优 Apache Tomcat 系列网络研讨会的第二期。可以在 SpringSource 网站的网络研讨会部分 获取研讨会的录像和幻灯片副本。同一页面提供了所有先前 SpringSource 网络研讨会的链接,以及 Covalent 网络研讨会存档

在问答环节中,我们未能回答所有问题,因此,正如承诺的,这里是剩余的问题和我们的答案。

  • 如何识别 Tomcat 应用中的内存泄漏?

    你几乎肯定需要使用分析器来确定内存泄漏的根本原因。最新的 Sun JDK 包含 jhat 和 jmap 等工具。还有许多其他分析器可用,包括免费和商业的。Filip 和我在调查 Tomcat 内存泄漏时使用 YourKit,因为 YourKit 为开源开发者提供免费许可证。

  • 重部署如何导致内存泄漏?

    这通常发生在 Tomcat 加载的类保留对 web 应用加载的类的引用时。当 web 应用停止时,Tomcat 类加载器继续保留对 web 应用加载的类的引用。这个类保留了对 web 应用类加载器的引用,而后者又保留了对其加载的所有类的引用。因此,web 应用类加载器及其加载的所有类都无法进行垃圾回收。这会导致内存泄漏。典型的根本原因是 JDBC 驱动程序和日志框架。

  • 更改 Tomcat 使用的 JVM 的最佳方法是什么?

    要使用的 JVM 是通过 JAVA_HOME(完整 JDK)或 JRE_HOME(仅 JRE)环境变量设置的。设置此项的正确位置取决于你的环境,特别是如果 Tomcat 配置为在系统启动时自动启动。如果你可以自由选择设置位置,那么根据你的操作系统使用 setenv.bat 或 setenv.sh。

  • 你推荐特定的 JVM 吗?

    不,我们不推荐。你选择哪个 JVM 供应商取决于你的操作系统。

  • 应该使用哪个连接器将 Apache httpd 连接到 Tomcat?

    我们推荐 mod_proxy_http,mod_jk 紧随其后。一般来说,mod_proxy_ajp 不如 mod_proxy_http 或 mod_jk 稳定。请注意,mod_jk2 已被弃用,不应再使用。

  • 使用 SSL 时,maxKeepAliveRequests 的正确设置是什么?

    使用 SSL 时应启用 HTTP keep alive,因为 SSL 握手对于每个请求来说是一个相对昂贵的操作。

  • 如果我们在 Solaris 上运行 Tomcat,你是否不推荐使用本地 APR 连接器?

    是的,我们不推荐。我们从客户那里收到的反馈是 APR 连接器在 Solaris 上不稳定。

  • 我们之前尝试在 Solaris 上迁移到 mod_proxy_http,但遇到了几个错误。这些错误是否已解决?

    不清楚你遇到的具体错误或使用的版本,很难评论。所有已知的 Apache httpd 问题及当前状态都可以在 ASF Bugzilla 数据库 中找到。Tomcat 的问题也可以在 Bugzilla 中找到。

  • 对于默认的阻塞 IO HTTP 连接器,maxKeepAliveRequests 应该使用什么值?

    对于高并发环境,将其设置为 1。否则,将其设置为页面上对象的平均数量,介于 10 到 100 之间。

  • 如何配置 JkOptions +DisableReuse?

    JkOptions +DisableReuse 应放置在你的 httpd.conf 文件中,与其他 mod_jk 设置一起。

  • 何时最适合使用非阻塞 IO HTTP 连接器?

    当你需要支持高并发和 keep alive,并且 APR 不是一个选项时,例如因为它在你的平台上不稳定。

  • 如果在 Apache Tomcat 前使用 Apache httpd,性能会更好吗?

    这取决于情况。如果你将所有请求都代理到 Tomcat,那么性能会略有下降。如果 httpd 处理部分请求(例如所有静态内容),那么你可能会看到一些好处。有很多基准测试试图证明某个连接器优于另一个。然而,这些基准测试很可能无法代表你的应用。确定这一点的唯一方法是在你的环境中,使用实际的负载和使用模式进行测试。

  • Tomcat 可以在前面没有 Web 服务器的情况下用于生产环境吗?

    是的。这是否能为你的环境提供最佳性能,取决于你的环境和你的应用。与上一个问题一样,确定这一点的唯一方法是在你的环境中,使用实际的负载和使用模式进行测试。

  • 在 Tomcat 前使用 Apache httpd 会提高安全性吗?

    你的安装的安全性取决于许多因素。是否使用 Apache httpd 不太可能显著改变你安装的安全性。其他因素,例如及时更新补丁和使用防火墙,通常对你的整体安全级别影响更大。

  • 哪个 Apache httpd MPM 提供最佳性能?

    和往常一样,这取决于你的环境,但 httpd 性能调优文档 提供了一些有用的通用指南。

  • SpringSource ERS 和 Apache Tomcat 之间的性能差异是什么?

    SpringSource ERS 远不止 Apache Tomcat。从纯 Tomcat 的角度来看,性能并不是决定性因素。ERS 的优势在于简单的安装、易于管理的升级和打补丁、对多实例的支持以及所有组件的集成。

  • 我的公司使用 Tomcat 和 XYZ 应用服务器。Tomcat 与 XYZ 应用服务器相比如何?合并它们有什么好处吗?

    会有很多差异,而且重要的差异因组织而异。首先确定你希望从应用服务器获得什么,然后将这个列表与市场上的产品进行比较。合并是有好处的。更高的统一性意味着更简单的维护、更少的培训等等。然而,也有成本。你需要审视你的组织以及它计划如何合并(只合并新项目、下一次主要发布时的所有项目、现在全部合并等),以便将成本与相关收益进行比较。

  • 你们有 Tomcat 和 XYZ 应用服务器的性能比较数据吗?

    该领域已发布了各种报告。结果的有用性取决于测试与你的负载匹配程度。和往常一样,确定这一点的唯一方法是在你的环境中,使用实际的负载和使用模式进行测试。

  • 负载测试 Tomcat 服务器的好方法是什么?

    有几种可用的负载生成工具,包括免费和商业的。免费工具包括 abJMeter

  • 为了实现高可用性和性能,Tomcat 可以配置为为同一个 Web 应用启动多个 JVM 吗?

    Tomcat 不提供此配置选项。当然,你可以创建多个 Tomcat 实例,在每个实例上安装你的应用,然后跨这些实例进行负载均衡。

  • 有没有通用的 Tomcat 健康检查脚本?

    Manager 状态页面 可能是一个不错的起点。如果需要,你可以使用该 Servlet 的代码作为基础来构建你自己的、更具体/更广泛的检查。如果你对其进行了增强,请考虑将你的增强贡献回 Apache Tomcat 社区。

  • logging.properties 文件在哪里?

    默认位置在 $CATALINA_BASE/conf 中。

平衡的议题:调整维护策略

工程 | Rod Johnson | 2008年10月07日 | ...

经营企业至少有一点像编写代码:即使你知道想要实现什么,第一次也不总是能做到完美——但如果你在必要时愿意返工,最终会得到更好的结果。在 SpringSource,我们对最近宣布的维护策略有一个清晰的愿景:平衡开源社区的需求、企业用户的需求以及 Spring 创建者的需求,以便惠及所有人。然而,我们第一次没有完全达到平衡,是时候进行一些重构了。

在过去几周里,我…。

Common Service Locator 库

工程 | Mark Pollack | 2008年10月03日 | ...

CommonServiceLocator 项目本周在 CodePlex 上发布,其主要思想是提供一个独立于 IoC 容器的 API,用于使用服务定位来解决依赖问题。来自 SpringSource 的 Erich Eichinger 贡献了 Spring.NET 的实现,谢谢 Erich!

这里是 API,以便你了解基本概念 public interface IServiceLocator : System.IServiceProvider {

object GetInstance(Type serviceType); object GetInstance(Type serviceType, string key); IEnumerable GetAllInstances(Type serviceType); TService GetInstance(); TService GetInstance(string key); IEnumerable GetAllInstances(); } …

SpringSource dm Server 1.0.0 reaches GA

Engineering | Peter Cooper-Ellis | September 30, 2008 | ...

You may have noticed that SpringSource announced the general availability of the SpringSource dm Server™ today. The dm Server is part of the SpringSource Application Platform. Since this is the first time out for the dm Server, I want to make a couple of short comments about the product.

We believe that the dm Server overall will change the way enterprise Java software is developed and deployed. In particular, the dm Server is designed from the ground up, to be lightweight (the dm Kernel has a footprint of about 3 megabytes), flexible, and fast. It is also designed to facilitate modular…

SpringSource Seminar Day Linz in Review

Engineering | Juergen Hoeller | September 23, 2008 | ...

A brief pictorial review of the SpringSource Seminar Day in Linz, having happened on September 8th, 2008, at the Bergschloessl Linz... More than 150 people were listening to a six-pack of presentations about what's new and upcoming at SpringSource. The "Story of Spring" keynote by Rod Johnson and Adrian Colyer was a great start into a day full of information: about the SpringSource Application Platform, the SpringSource Tool Suite, Spring 3.0, etc. (See the original blog announcement for details on the agenda.)

It was a pleasure to see so many people attending: from Austria as well as from Germany and Eastern Europe - and even from Norway! I hope you enjoyed the seminar and your stay in Upper Austria. Looking forward to seeing you again at the SpringOne Europe 2009 conference in Amsterdam, April 27-29... as well as at upcoming EJUG Austria

SpringSource (and other top vendors) leading the OSGi charge

Engineering | Adrian Colyer | September 17, 2008 | ...

In a press release made available by the OSGi Alliance yesterday, several leading vendors including SpringSource, IBM, Oracle, RedHat, Sun, SAP, ProSyst, and Paremus joined forces in their support of OSGi as the foundation for next generation server platforms.

To highlight some of the key points:

Craig Hayman, VP IBM WebSphere said

[IBM] has been shipping WebSphere Application Server built on OSGi since 2006. As a result, IBM clients benefit from a modular platform built with proven components and the ability to automatically use only the components required by their application.
Steven G. Harris, SVP of Development at Oracle said
Oracle WebLogic Server is a great example of the customer benefits of modularization, with its reduced footprint, improved startup time, and flexible configuration options. OSGi technology provides the standards based foundation...
Sacha Labourey, VP of Engineering for RedHat's middleware business said
Running OSGi technology in JBoss Enterprise Middleware Solutions enables our customers to deliver safer services and applications in a more dynamic runtime environment.
Tom Kincaid, Executive Director of Application Platforms at Sun Microsystems said
Sun has seen strong demand for OSGi technology within the GlassFish community. The GlassFish community will be able to take advantage of the modularity and dynamic extensibility implemented via an OSGi-technology based microkernel in the upcoming GlassFish v3 Prelude Release.
What all of the vendors quoted in the release have in common, including SpringSource, is that they build their server platforms on top of OSGi. This has the potential to deliver a set of benefits to users of those platforms including more modular server structures with the ability to run in a smaller footprint and to dynamically alter server characteristics and capabilities.

You need to look a bit harder at the various vendor offerings to determine to what extent they have been able to realize those benefits for you as a user. At SpringSource you could say we were "lucky" in this respect. We had the good fortune to be able to design…

SpringSource dm Server 1.0 RC2 Released

Engineering | Rob Harrop | September 11, 2008 | ...

I'm happy to announce the availability of RC2 of the SpringSource dm Server, previously known as the SpringSource Application Platform. This release is feature complete and barring any serious issues will become 1.0 GA in two weeks time.

This release fixes a few critical bugs, upgrades to Tomcat 6.0.18 and updates all code, documentation and supporting materials to reflect the new name.

Due to the renaming of the product, PlatformOsgiBundleXmlWebApplicationContext has been renamed to ServerOsgiBundleXmlWebApplicationContext and moved from the com.springsource.platform.web.dm package to the com.springsource.server.web.dm package. Thus, if you are setting the contextClass for Spring MVC's ContextLoaderListener or DispatcherServlet in web.xml in a Shared Services WAR, be sure to change the fully qualified path to com.springsource.server.web.dm.ServerOsgiBundleXmlWebApplicationContext

Get the Spring newsletter

Stay connected with the Spring newsletter

Subscribe

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all