Reproduced Why PayPal migrated from Java to node. JS with a performance increase of up to 44% less file code

Source: Internet
Author: User

http://ourjs.com/detail/52a914f0127c763203000008

As everyone knows PayPal is another large company migrating to the node. JS platform, Jeff Harrell's blog, node. js at PayPal explains why the migration came from Java: one-time increase in development efficiency (2 people who do 5 of their lives with less), One-fold performance increase, code volume reduced by 33%, file reduced by 40%:

(Small: I think the underlying reason is that Java is becoming more and more closed, and it is becoming more and more complex and Oracle is charging Java, see: Oracle plans to release the premium JVM, which has prompted more and more companies to join the Java team)

There are a lot of people out there saying PayPal is migrating to the node. JS platform. I am happy to announce here that rumors are true and we are migrating from Java to node. js

For historical reasons, our engineers have been divided into two people, one to write code on the browser (Html,css,javascript), and another to write the application layer code in Java. Imagine that a write HTML had to call a write Java to link A/b two pages together? We're doing this, and we call this an all-end engineer, those who can design beautiful interfaces and server backgrounds. Now there is no limit to the front and back end, which once was a big bottleneck that blocked PayPal's discovery.

node. JS helps us to merge the front and back end, and now we have a full-end team to solve all of the user's problems.

Early adoption

Like everyone else, we've just started using node. js to do some prototypes for demo applications. Like many people, she showed high performance, so we finally decided to put her on the line.

We initially used Express routing requests, nconf for configuration, and grunt to create tasks. Express is very popular, but we have found that express does not have enough scalability to work with multiple teams, and it is not suitable for all occasions. Expres is very flexible, but not scalable for large team development. Eventually our team was based on the native node. JS and created the karken.js; she is not a framework, more like a specification, but she is more suitable for large-scale team expansion relative to express. We want our engineers to focus on their applications rather than focusing on their operating environment.

We've been using kraken.js internally for several months (we'll open it up soon!). Our engineers are eager for this internal framework to go live as soon as possible.

(Small part: Predicting karken.js is about to be, another super fire back end frame, fiery degree reference Twitter bootstrap)

Send node. js to the online

Our first product to adopt Nodejs is not a small application; it is our most visited user homepage. We wanted to get a little bit bigger, but we knew the risks, so we ran a Java program in parallel. We have a lot of experience in developing and extending Java. So once the node. JS application goes wrong, we can immediately cut back to Java. However, we have also found some very interesting data.

Development

Starting in January, we spent several months building the infrastructure of node. js. For example: Sessions (session), centralized logging (centralized log), Keystores (storage). During this time we had 5 Java engineers developing java. After two months of development, two engineers began developing the node. JS application. At the beginning of June, the development of two teams was the same, and the functions of the two were exactly the same. The small team that developed the node. JS application, though postponed for two months, quickly caught up. Here are some of the results of the unit tests we've done with these same features:


node. JS is:

Fewer people develop a node. JS application that is one-fold faster than Java;
Save 33% of the code amount;
Less than 40 of the documents;

(Small, the author does not mean that the Java Programmer's quality is not good, the Java language features determine that she needs more people, more time, more code to complete the same job under node. js, and thankless.) Reference: Why do they say that object-oriented problems, to explore some object-oriented defects; performance evaluation: node. JS is 20% faster than Java EE)

This is a very encouraging evidence that we seem to be migrating to the JavaScript platform more quickly. We immediately made a decision to pause the development of Java applications and to develop JavaScript applications wholeheartedly. This is good news for engineers working on Java projects, who have eliminated the doubts about node. JS and are delighted to be involved in parallel node. JS Development, so we're twice times more productive.

Performance

Performance is a very interesting and controversial topic. In our case, we have two platforms that implement exactly the same functionality, one using the spring-based internal Java framework, and another based on kraken.js,express,dust.js and other open source frameworks. These programs contain three APIs, each of which responds to 2 to 5 requests, and is simulated by dust to get the data and display the page.

We use the online environment to test the two applications and collect the time and number of requests to complete the response.

node. JS vs Java Performance Comparison

In this diagram you can see the benefits of the node. JS app:


The number of requests per second is twice times that of Java. But what's even more interesting is that we only use single-core node to compare it with 5-core Java, and we really want to inherit the benefits of expanding node. js in the future.
With the same page rendered, node. js saves 35% of the time. That is, each page saved 200 Hao seconds, the user can clearly feel the difference.

Future

We will continue to use node. js to build our web App. Like the portals we're developing, and the user overview page that's already online. And a dozen of those projects that are going into beta testing, we will continue to share our experience in the online process, data. For PayPal, this is a very exciting time for others.



Original address: paypal-engineering.com

Reproduced Why PayPal migrated from Java to node. JS with a performance increase of up to 44% less file code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.