`
jimcgnu
  • 浏览: 35485 次
  • 来自: ...
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

转: walmart.com 迁移到 java5

阅读更多
Migration to Java 5 at walmart.com


June 2005

Discussion


How do you upgrade one of the busiest web applications of the whole Internet to Java 1.5? This is a challenge under the best conditions, considering that the application must handle up to 7 million sessions and 106 million page views per day. This article is a case study of the Java 1.5 upgrade for the application and subsystems that make up the walmart.com web site.

Upgrading to Java 1.5 was motivated by the need to have better monitoring tools and JVM capabilities on the production site, the evolution of some foundation technologies that require Java 1.5 functionality in their latest releases, and programmer demand to use the new language features.

The walmart.com store is structured as a single application with scores of subsystems. The application combines open-source, commercial, and proprietary technologies. The main web site is a served by Apache and Tomcat, and it depends on:

  • Database stored procedures
  • Apache Axis
  • Commercial application APIs
  • Internal applications
  • Various presentation technologies

The application runs in a loosely coupled cluster of over one hundred servers. Data is managed by a massively parallel database server. The application provides and consumes web services in the form of HTTP POSTs, ad hoc file transfers, and SOAP web services. Since it all depends on Java, the upgrade to 1.5 was planned in three distinct stages over the course of 24 weeks. The goal was to have minimum operational impact.

The application development calendar is made up of eight-week cycles. A typical cycle includes:

  • new software development;
  • unit, integration, and interoperability testing;
  • staging; and
  • deployment.

The release dates are immutable because of the interdependence with many vendors’ applications. Delaying a release impacts the application itself and a large number of third-party vendors who provide services throughout the site.

Table 1 shows how the Java 1.5 upgrade was mapped to the release calendar:

Release

Activity

Notes

A

Introduce Java 1.5 tools to the development environment, but allow compilation only as Java 1.4

 

Define workarounds for issues so that a roll ‑ back to JVM 1.4 is possible in case of major production issues not identified during this release or due to system load

Identify and address build and environmental issues

 

Training in the new Java 5 language features for the engineers

B

Deploy Java 1.5 in production, running as Java 1.4

 

Define “best coding practices” for developers aching to use the new language features

 

Resolve issues identified during release A in a permanent way and adopt Java 1.5-compatible solutions

If the production deployment causes problems, roll ‑ back to Java 1.4 and reevaluate

 

Some third party products, like Apache Axis, may be updated in release B

C

Deploy code written using the new Java 1.5 language features in production

Migration is complete

Table 1

The release schedule is designed to minimize operational disruption and to give the engineers time to address any development and integration issues. The rest of this article presents some of those issues and how the development and operations teams addressed them.

SWITCHING JAVA COMPILERS

The application used Jikes instead of javac prior to release A. Jikes was used in the development environment for compiling static classes and content, and at run‑time for generating JSPs. The upgrade required switching the compiler to javac and configuring it for 1.4 sources and 1.5 targets. This created minimum disruption in the core application building tools, which rely on make and Ant for compiling the application. It created a few problems among the developers because the engineering department policy allows the developers to build with any IDE of their choice as long as the site can be built with the standard make/Ant/javac command line tools. The compiler switch affected the developers in varying degrees:

  • Users of standard *NIX-only tools were not affected; all they had to do was check the new compiler and build files out of the CVS repository and run “make clean; make”.
  • Eclipse 3.1 users had the most problems getting the site to compile and execute within the scope of the IDE. None of the problems was a showstopper, and issues were resolved within 24 hours of the upgrade in most cases.
  • IDEA users didn’t experience major disruptions with the upgrade.
  • Users of jEdit and other tools didn’t report issues.

There was a small performance impact in building dynamic JSPs with the javac compiler. The impact was deemed insignificant in the context of the site, and balances out with performance advantages gained with the use of Java 1.5 Hotspot.

XML SUPPORT IN JAVA 1.5

Java 1.5 introduced several changes or enhancements to its XML API (SAX, DOM and XSLT in particular). These changes first became apparent when running code that relied on JSP’s imports. Previous versions of the XML API allowed the same XML attribute to be defined more than once in a single JSP. Quite a few JSP pages, dynamic and static, broke when running under Java 1.5 because of the attribute repetition. The two main solutions proposed to address this problem were:

  • Parse all the JSP files that made reference to this attribute and replace it with a unique name per file. This would allow nesting and cause minimum impact to the existing code or the site itself, since the offending attribute had limited scope.
  • Restructure the JSP pages and imports so that the attribute was defined once, and only once, for each page, without collisions while retaining the attribute’s name.

We discarded the first solution because, although expeditious, it was also considered a kludge. The “unique name per file” solution would help perpetuate a bad-coding practice. This would result in short-term impact to the production site but non-maintainable or brittle code in the long term. This is not acceptable for a site that relies on several hundred JSPs that, combined with database queries and templates, explode to thousands of different pages.

Implementing the second solution was relatively straightforward, albeit labor-intensive for the platform engineers. Several hundred pages were updated to reflect the change, and were individually tested. We expect to find few issues during quality assurance thanks to their work. The application engineers participated in a training session that explained the reasons for this change and adapted the production code to the new header page import sequence.

SOAP WEB SERVICES

Some mission-critical applications are implemented as Axis SOAP web services. These applications presented two major challenges during the upgrade:

  • The Axis 1.1 developers had used the word ‘enum’ in one of their package names; enum is a word now reserved for designating enumerated types. Java enums are class‑like constructs and specialize the java.lang.Enum class.
  • The platform group upgraded Axis to version 1.2 with a different package nomenclature. This worked fine for the compiler but resulted in a run‑time error because of Axis.

Changes to existing Java classes relying on any component upgraded along with Java 1.5 were kept to a minimum to simplify the roll-back process. The standard operating procedure for Axis implementations is to re—generate the application code with the new code base and tools such as WSDL2Java. We chose to keep the existing classes instead for release A and build a programmatic solution to the bug found in Axis 1.2 that would also work with Java 1.4/Axis 1.1. That way only the JVM and libraries need to roll-back if needed. Full implementation of Axis 1.2 (or latest) will wait for releases B or C, when the development focus shifts to language and library features, not JVM/run‑time migration.

HOTSPOT CAVEATS

The servers implement all possible optimization advantages because of the traffic volume that they must handle. The application relies on Hotspot to optimize frequently used methods. The introduction of the Java 1.5 JVM brought with it a few run-time exceptions in code that worked fine under the JVM 1.4.

Troubleshooting and resolving these errors is simple, though somewhat labor intensive:

  • Use profiling tools, if possible
  • If the JVM dies, analyze the core dump for clues as to which methods are causing the error

An example of the first case was a problem with the concurrent and parallel garbage collector. It was resolved by increasing the stack memory available to the GC through the use run-time configuration parameters like CMSMarkStackSize and CMSParallelRemarkEnabled, per the Java vendor’s recommendation.

In the second case, some methods threw NullPointerExceptions during the JIT compilation, regardless of the configuration. The short-term workaround this problem is to add the class/method name to the .hotspot_compiler configuration file. The JVM won’t compile the methods listed there. The long-term solution is for the JVM vendor to provide a bug fix.

JSTL TRANSFORM ERRORS

Some portions of the site are implemented with JSTL. They are isolated within a set of common end‑user services, so it was easy to resolve issues when they cropped up.

A number of errors were reported when the JSTL code was executed in the Java 1.5 environment. It was determined JSTL relies on JAXP 1.2 but the J2SE provides JAXP 1.3. The solution to involved two steps:

  • Specifying the JAXP 1.2 classes to the run-time; and
  • Resetting the default transformer factory from Xalan to XSLTC.

In step with our desire to disturb the environment as little as possible, these changes were made as command line switches passed to the JVM during startup; they are easy to remove if there is a need to roll Java 1.5 back in a production environment.

OTHER THINGS TO CONSIDER

The examples listed so far are the most glaring examples of incompatibilities and issues introduced by the new JVM in an otherwise stable environment. It’s likely that other issues will manifest themselves during regression testing. At this time, the application is stable and the platform development team feels that all the show stopping issues have been resolved.

Once the JVM upgrade to production is complete, the programmers will use Java 5 idioms in the code such as generics, autoboxing, enhanced ‘for’ statements, etc. starting in release B.

RELEASE B: JAVA 1.5 PROGRAMMING

Java 5 coding idioms were introduced at walmart.com through a series of presentations beginning in December 2004. The goal was for the engineering team to familiarize themselves with the new language features and the caveats involved in their use (or abuse). Three 90-minute overview sessions were scheduled:

  • December 2004: new Java 5 programming features overview: generics, autoboxing, enumerated types, enhanced ‘for’ statement and static imports
  • May 2005: Annotations, new concurrency API, and enhanced formatted I/O
  • June 2005: JVM monitoring and profiling tools (JMX)

A team of walmart.com’s engineers developed these training sessions. Additional in‑depth training provided by a third party will follow. The company has a set of non-restrictive coding guidelines in place already; the engineering group will enhance it with a set of best practices specific to the new language features.

New language features will be added only when:

  • they’re necessary because a third—party API requires them;
  • an existing third—party API is updated and integrated with the environment;
  • new application code is developed; and
  • existing application code is revised;

There won’t be a massive updating exercise to implement the Java 5 language features in every source file. The number of classes and JSP pages to update is staggering, and such endeavor would be plagued with bugs. The goal is to add these features as their need becomes apparent.

CONCLUSION

Upgrading a production Java 1.5 environment for a popular site is a task riddled with risks that can be minimized or addressed through conscientious planning. This article presented how problems were overcome during a run‑time Java 1.5 upgrade process. The engineers in charge of this upgrade and their users (i.e. the application developers) feel comfortable with the process so far, though a few things might be done differently in the future. For example, JTidy (an HTML syntax checker that can fix malformed HTML output) was introduced along with the Java 1.5 upgrade. The engineering group spent some resources chasing ghosts thinking that some problems introduced into the environment by JTidy were caused by the XML parser changes in J2SE 1.5. Future run‑time updates will focus on JVM—specific upgrades, leaving the introduction of new functionality to the late part of the current cycle, or moving it to the next release altogether.

This article is limited to just the Java environment at walmart.com. Except for the problems presented in here, the overall feeling is that a migration to Java 1.5 in a production environment can be a mostly painless exercise. No insurmountable issues are expected when the new coding features come in use. The Java 1.5 upgrade engineers feel that this update will result in performance, integrity, coding and monitoring benefits for the site’s customers, the application developers, and the operations team in charge of the site.

AUTHOR BIO

Eugene Ciurana is an author and computer engineer with 20+ years of experience in the design, implementation and deployment of mission-critical systems.

分享到:
评论

相关推荐

    AliPrice Shopping Assistant for-3.0.1.zip

    概述:Walmart.com 的 AliPrice 价格跟踪器 描述: Walmart.com的AliPrice价格跟踪器 主要特点: √价格历史。跟踪3/6个月内的价格历史记录。 √降价提醒。将产品添加到您的收藏夹,当价格下降时,您会...

    Text_Scraper:walmart.com 的示例文本抓取工具

    Text_Scraper 使用 Jsoup 库抓取网站的 Java 文本爬虫: 。文本抓取器为以下查询提供结果: 查询 1:返回搜索产品后返回的结果总数查询 2:返回每个产品的详细信息,如名称、价格。

    Node-WalmartIO:Walmart.io的请求变得更加轻松!

    安装此仓库需要在node_modules中进行其他设置首次运行安装npm i node_walmartio接下来导航到/ node_modules / node_walmartio / src 您必须在页面顶部填写详细信息let details = { consumerId: "", <- Find on ...

    沃尔玛产品详细信息-数据集

    域名:walmart.com  日期范围:2020年1月1日至2020年3月31日   文件扩展名:CSV 可用字段:Uniq ID,抓取时间戳记,产品网址,产品名称,描述,标价,销售价格,品牌,商品编号,Gtin,包装尺寸,类别,邮政编码...

    walmart-open-api-java

    - `com.walmart.api`(或类似命名空间):该包可能包含与沃尔玛API交互的主要类,如`WalmartApiClient`,用于初始化API客户端,设置认证信息,以及执行不同的API调用。 - `com.walmart.api.model`:这里可能定义了...

    PhoenixBot:凤凰机器人-复活的鸟机器人

    凤凰机器人Phoenix Bot受Natewong1313的Bird Bot项目的启发,但由于其...mark: target.com :check_mark: walmart.com :check_mark:Phoenix Bot存储库链接Windows快速安装确保您的Chrome浏览器已更新到最新版本在所需

    PyPI 官网下载 | python-walmart-0.1.7.tar.gz

    《PyPI官网下载:python-walmart-0.1.7.tar.gz——探索Python库的奥秘》 在Python的世界里,PyPI(Python Package Index)是开发者们分享和获取开源软件包的重要平台。"PyPI官网下载 | python-walmart-0.1.7.tar.gz...

    node-v12.22.10.tar.xz

    Node.js,简称Node,是一个...在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。

    零售行业全球经典商超系列研究(二):Walmart竞争优势再思考-0130-银河证券-23页.pdf

    作为全球最大的零售公司,沃尔玛由沃尔顿家族控股,业务板块包括Walmart U.S.(沃尔玛美国)、Walmart International(沃尔玛国际)和Sam’s Club(山姆会员店),其中沃尔玛美国是其销售额最大的板块。公司的核心...

    good-hapi-rollbar:Hapi.js的好Rollbar记者

    1. **Hapi.js**: Hapi.js是一个由 Walmart Labs 开发的Node.js服务器框架,它提供了一套完整的结构来组织应用,包括路由、中间件、安全策略等。它的核心设计原则是分离关注点,允许开发者专注于业务逻辑,而不是基础...

    藏经阁-LEARNINGS USING SPARK STREAMING & DATAFRAMES FOR WALMART SEA

    6. Solr – 索引 walmart.com Spark Streaming 的应用 Spark Streaming 是一个流式数据处理引擎,可以实时处理大量数据。在 WalMart SEARCH 项目中,Spark Streaming 用于捕获目录更新、价格更新、库存更新等事件...

    Qik Deals-crx插件

    此Chrome扩展程序可帮助您从以下站点在amazon.com上找到产品:https://www.macys.com https://www.eastbay.com https://www.jimmyjazz.com https:// www .walmart.com https://www.walgreens.com ...

    ReviewAnalyzer:该应用程序从社交网站和walmart.com收集评论,并帮助确定需要改进的地方

    **评论分析器(ReviewAnalyzer)**是一款专为收集和分析用户评论设计的应用程序,它整合了社交媒体平台和沃尔玛(walmart.com)的数据源,旨在帮助企业更好地理解消费者反馈,从而找到产品或服务需要改进的关键点。...

    Laravel开发-walmart-marketplace-laravel-sdk

    5. **集成到Laravel应用**:根据业务需求,将SDK与Laravel的路由、控制器、模型和视图等组件结合,实现具体的功能。例如,创建一个控制器处理商品的CRUD操作,或者设置一个定时任务来定期同步订单状态。 6. **测试...

    沃尔玛产品清单数据2020-数据集

    总记录数:408504域名:walmart.com日期范围:2020年1月1日至2020年3月31日文件扩展名:csv 可用字段:Uniq Id,抓取时间戳,Pageurl,网站,标题,评分,评论,审稿人姓名,审稿,审稿,验证购买者,推荐购买,...

    node-v16.14.2.tar.xz

    Node.js,简称Node,是一个...在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。

    电商React迁移之路 .pptx

    沃尔玛美国电商业务(walmart.com)的搜索前端部门负责处理大量的客户流量,尤其是与商品搜索相关的页面。为了提升用户体验和系统性能,团队决定进行前端框架的重构。原有的技术栈包括Backbone.js、Marionette、...

    Veronisoft.IP.Monitor.v1.3.23.0-WaLMaRT

    《Veronisoft IP Monitor v1.3.23.0-WaLMaRT:全面解析TCP/IP主机连接状态监控》 在IT行业中,网络监控是维护系统稳定性和安全性的重要环节,尤其是对于TCP/IP协议栈的监控。Veronisoft IP Monitor v1.3.23.0-...

Global site tag (gtag.js) - Google Analytics