ArcGIS Server Java ADF case study 42

Source: Internet
Author: User
Ii. Use utility objects to improve query performance [Case Study]

This is a real problem that my colleagues use utility objects to solve for a user. This user calls ao to perform a space query, and then performs paging on the basis of the query. When paging, the user traverses all ifeature values on the page, extracts attribute information, and constructs his own results to return -- results, when a serious performance problem occurs, it takes two or three minutes to query tens of thousands of records. This is intolerable in a national project.

After adding log analysis, it is found that the AO query speed is very fast. The problem is that the ifeature traversal operation is continuously produced by cross-process calls. At this time, 9.3.1 was officially released, and utility objects came as a savior!

As we have already made it clear in the previous section about how to define a utility object, we will not discuss how to encapsulate interfaces and implementation classes here. The following is the encapsulated functional code, which is mainly used to traverse the paging elements and extract useful information. Of course, the original code is executed at the web layer.

Ifeature feature = featurecursor. nextfeature ();

Int
Featurecount = 0;

While
(Feature! =Null
)

{

If
(Featurecount> = first + pagesize)

{

Break
;

}

If
(Featurecount> = first)

{

Result. Add (serviceutil. feature2einfo (feature ));

}

Featurecount ++;

Feature = featurecursor. nextfeature ();

}

After such processing, the performance has been greatly improved. A simple test can explain the situation: a space query with a radius of 1000 kilometers is conducted here, and the total number of returned results is 30437.

Paging start record

Number of paging records

Before optimization (s)

After optimization (s)

0

500

179.406

5.203

If you have fine-grained operations and have encountered performance problems, are you very excited?

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.