Scenario Comparison for client update definition data (definition)

Source: Internet
Author: User
Tags comparison

I. Issues/Needs

Scene:

The client displays data from the server side;

There are many data items (item), and may increase or decrease;

The definition (definition) of each data item may also change

The display of data will be based on its definition

Analysis:

Although the definition may change, the frequency is relatively low and does not need to be fetched every time from the server side. The specific data is changed and needs to be obtained each time.

Response time is an important indicator when the client is a mobile terminal (such as a mobile phone)

Reducing the acquisition of definition will effectively improve the response time of the client

Ii. programme

There are 3 programmes:

1 Just-in-time (JIT, Just in time) update

Each time you apply for data, the (JIT) passes past the define LastUpdateTime.

The service side is judged to have new, then returns with the data.

2) Update on Demand (OnDemand):

Every time you need this data, judge the IsNull. If blank, apply for update

3 initialization (initiation) Update: All updates at first run time

-Establish flag flag_initiated = False.

-If False, do an initialization action, update all, and set to True when finished

Note: 2,3 must run the standalone Update definition feature at the same time-the background thread is taken at idle time.

Iii. Comparison of programmes

----------------------

Copywriting 2 and Scenario 3 are actually a delaying strategy that takes only the required. In many scenarios, the definition collection is large and the user does not go to every path. Scenario 3 (initialization) Not only has a lot of waste, but it may be too long for the first time, resulting in poor user experience.

Scenarios 2 and 3 have a certain definition of outdated risk

The disadvantage of scenario 1 is that 2 logic is mixed together, a little bit more complex, and, in most cases, useless work (returning null).

The advantage of scenario 1 is that correctness can be well protected.

Alternatively, options 1 and 2 can be optimized for consolidation applications: the application of definition and data are merged into the same request, saving the network interaction. This avoids too long a terminal response time and is particularly valuable for mobile internet.

Four, the conclusion

Which one would you choose? Or have a better plan, also please suggest.

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/database/basis/

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.