Notes on development experience in the first half of 2013

Framework construction:
1. Unified constants and enumeration classes.
2. Unify the return value of each layer method.
3. Unify custom exceptions.
4. Unified log output.
5.ibatis file specification.
6. About the unification of paging.
7. Do not write too dynamic sql in the ibatis file.
8. The most annoying development time is insufficient, and it has not been developed for a long time to test, and the test stares at the butt and shouts all day long.
9. For a good development engineer, the finer the task decomposition, the better. There is no bottom line. Development time evaluation and execution are more important than anything else.
Front-end and back-end joint calls:
Asynchronous requests return a json list, it is best not to talk about the output of ordinary vo objects after conversion, because there will be many useless values.
And it is not possible to dynamically decide which parameters to return based on the input parameters.

Table Design:

Consider comprehensiveness at the beginning.

Flexible response:
The problem of checking and commenting according to the order id is handled. From another angle, all problems are solved.

The only way to reduce RT:
performance:
1. Build a search to avoid multiple data source association queries.
2. Put the assembled result into the cache, and return it directly next time.
3. Distributed loading, first load the torso information, and then use the lazy method to load additional information.
Performance:
1. Build search to avoid multiple data source related queries.
2. Put the assembled result into the cache, and return it directly next time.
3. Distributed loading, first load the torso information, and then use the lazy method to load additional information.


<res-loaders:file-loader basedir="D:/apps/vmcommon" />


Store key-value pairs:
<itemId,item order related content (id,title,oriPrice,price,soldNum,picurl,isDiscount,isRecommend) >
<localstoreId,<name-id,name-id,name-id,name-id,name-id>>All baby titles and ids, support query according to baby and keywords

<localstoreId+category id+timeDesc, array type Baby id list>
<localstoreId+category id+timeAsc, array type baby id list>

<localstoreId+ category id+priceDesc array type baby id list>
<localstoreId+ category id+priceAsc, array type baby id list>

<localstoreId , category LinkedHashMap>

<localstoreId+timeDesc, array type baby id list>
<localstoreId+timeAsc, array type baby id list>

<localstoreId+priceDesc, array type baby id list>
<localstoreId+priceAsc, array type baby id list>

capacity:
50 categories (1KB), 500 baby items (5KB) per store, The various categories add up to 10KB of memory for each store, and 10M

data initialization for 1W:
The baby data is queried for the first time and added to the tair. Later, it will be updated to the tair when it is changed, and it will be permanently cached in real time.
The index cache of various key values ​​is similar to the baby cache as a permanent cache, triggering an instant update when the category or baby is updated.


Use:
According to the paging parameters, find (al.subList(fromIndex, toIndex)) the qualified id list in the cached array or list, and then index the corresponding baby collection according to the id list and return it to the front end.
Tair failure:
The data of all stores is initialized at the first query (the person who visits the store page for the first time), and the pressure will not be too concentrated.

Performance speculative analysis:
At present, a real-time search is
called , with an average of 20ms: itemInstantSearchService.search takes a baby of ic, an average of 10ms
: getItemReadService(). *6 times in 20ms , then: the current plan is a store with 20 categories and 20 queries * 20+500 babies are checked once each *10=5s           and the tair plan is 20ms+500*2=1s Experimental verification: basically in line with speculation, performance improvement 5 times what is the average web server timeout? If you develop a function point or a page, you must be responsible for the page. All problems should be dealt with as early as possible. If you rely on others to remind you, it may already be online or at the last minute, and the price to be paid is much greater.








The transitional reliance on the front end has seriously hindered the progress of the work! ! !
Mutually beneficial contacts will last for a long time!

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326963004&siteId=291194637