EJB and Java Serialization (3) Open enable-call-by-reference

Source: Internet
Author: User
Tags serialization

The problem is finally found, simply because Java serialization is inefficient, and EJB calls are heavily used for serialization, resulting in significant performance consumption and response time. Careful analysis of the project situation, oh, the situation is very serious, the system architecture is designed according to three layers, each layer is an EJB, the next layer is through the remote interface, and the layer may also be multiple EJB calls.

(On the other hand, this design personally feel very, well, do not understand, performance killer, and the EJB configuration is extremely complex, of course, or EJB is the case, EBJ and WebLogic for me is very strange very advanced things, at present there is no in-depth grasp. )

It's natural to think of a configuration item in ejb2.0 Enable-call-by-reference, which avoids serialization in a remote interface call if it can be turned on. Check the configuration file found that almost set Enable-call-by-reference is set to true, odd

Strange, and then check the deployment mode found, en, fainted, was deployed to different ear packs.

Different ear packets, enable-call-by-reference even set bit true can not open it?

The next way to improve, it is natural to think that if you can package into the same ear, you can not change the code, do not change the deployment of the file to solve the problem, seems to be a good idea.

Be cautious and, at the same time, do a test first in order to get enough evidence to say the upper level.

Simulate the company's project structure, write a separate project,1 servlet responsible for receiving outside requests, 3 SLSB to simulate three layers of work, EJB directly only provide remote interface, and then packaged to the same ear package for testing. Of course Enable-call-by-reference set to True

and false for comparison testing.

To highlight this difference, there is no action in the EJB and no sleep. This consumption is mainly reflected in the Java serialization of the consumption, and in order to simulate the real situation, the parameter set is relatively large, which put 1000 instance.

Using LoadRunner, open 100 test threads, access the servlet through HTTP, test time one minute, see how many requests can be executed, test results are as follows:

Enable-call-by-reference = false:558

Enable-call-by-reference = true:21163

Because the difference in this result is too big, so there is no need for many tests, nearly 40 times times the difference can fully respond to the problem, the actual project should be far less exaggerated.

To sum up:

1. Java Serialize very slow

2. Enable-call-by-reference can effectively avoid this overhead

Therefore, can enable-call-by-reference as far as possible enable-call-by-reference.

PS: By the way, let's share this test eclipse project, please download it here

http://www.fs2you.com/files/045b367d-5d23-11dd-a2ed-0014221b798a/

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.