Authored by hugufei

fix召回缓存日志

@@ -65,11 +65,7 @@ public class BrandVectorCacheBean { @@ -65,11 +65,7 @@ public class BrandVectorCacheBean {
65 searchParam.setSize(10000); 65 searchParam.setSize(10000);
66 SearchResult searchResult = searchCommonService.doSearch(indexName, searchParam); 66 SearchResult searchResult = searchCommonService.doSearch(indexName, searchParam);
67 Map<Integer, List<Double>> result = this.buildBrandVectors(searchResult, isForRnn); 67 Map<Integer, List<Double>> result = this.buildBrandVectors(searchResult, isForRnn);
68 - if (!result.isEmpty()) {  
69 - RECALL_NEW_LOGGER.info("loadBrandVector from [{}] success, size is[{}],cost is[{}]", indexName, result.size(), System.currentTimeMillis() - begin);  
70 - } else {  
71 - RECALL_NEW_LOGGER.info("loadBrandVector from [{}] fail, result is empty,cost is[{}]", indexName, System.currentTimeMillis() - begin);  
72 - } 68 + RECALL_NEW_LOGGER.info("loadBrandVector from [{}] success, size is[{}],cost is[{}]", indexName, result.size(), System.currentTimeMillis() - begin);
73 return result; 69 return result;
74 } catch (Exception e) { 70 } catch (Exception e) {
75 RECALL_NEW_LOGGER.error(e.getMessage(), e); 71 RECALL_NEW_LOGGER.error(e.getMessage(), e);
@@ -66,11 +66,7 @@ public class SortBrandVectorCacheBean { @@ -66,11 +66,7 @@ public class SortBrandVectorCacheBean {
66 searchParam.setSize(15000); 66 searchParam.setSize(15000);
67 SearchResult searchResult = searchCommonService.doSearch(indexName, searchParam); 67 SearchResult searchResult = searchCommonService.doSearch(indexName, searchParam);
68 Map<String, List<Double>> result = this.buildSortBrandVectors(searchResult, isForRnn); 68 Map<String, List<Double>> result = this.buildSortBrandVectors(searchResult, isForRnn);
69 - if (!result.isEmpty()) {  
70 - RECALL_NEW_LOGGER.info("loadBrandSortVector from [{}] success, size is[{}],cost is[{}]", indexName, result.size(), System.currentTimeMillis() - begin);  
71 - } else {  
72 - RECALL_NEW_LOGGER.info("loadBrandSortVector from [{}] fail, result is empty,cost is[{}]", indexName, System.currentTimeMillis() - begin);  
73 - } 69 + RECALL_NEW_LOGGER.info("loadBrandSortVector from [{}] success, size is[{}],cost is[{}]", indexName, result.size(), System.currentTimeMillis() - begin);
74 return result; 70 return result;
75 } catch (Exception e) { 71 } catch (Exception e) {
76 RECALL_NEW_LOGGER.error(e.getMessage(), e); 72 RECALL_NEW_LOGGER.error(e.getMessage(), e);
@@ -36,6 +36,8 @@ class RecallConfigCommonService { @@ -36,6 +36,8 @@ class RecallConfigCommonService {
36 36
37 private void loadRecallConfigCommonCache() { 37 private void loadRecallConfigCommonCache() {
38 try { 38 try {
  39 + RECALL_NEW_LOGGER.info("loadRecallConfigCommonCache ........");
  40 + long begin = System.currentTimeMillis();
39 List<CsRecallConfigCommon> configList = csRecallConfigCommonIndexBaseService.queryAll(); 41 List<CsRecallConfigCommon> configList = csRecallConfigCommonIndexBaseService.queryAll();
40 Map<String, Map<Integer, ConfigSizeInterval>> tempCache = new HashMap<>(); 42 Map<String, Map<Integer, ConfigSizeInterval>> tempCache = new HashMap<>();
41 for (CsRecallConfigCommon csRecallConfigCommon : configList) { 43 for (CsRecallConfigCommon csRecallConfigCommon : configList) {
@@ -52,7 +54,7 @@ class RecallConfigCommonService { @@ -52,7 +54,7 @@ class RecallConfigCommonService {
52 tempCache.get(configKey).put(pageId, configSizeInterval); 54 tempCache.get(configKey).put(pageId, configSizeInterval);
53 } 55 }
54 recallConfigCommonCache = tempCache; 56 recallConfigCommonCache = tempCache;
55 - RECALL_NEW_LOGGER.info("loadRecallConfigCommonCache success,recallConfigCommonCache size is[{}]", MapSizeUtils.getMapElementMapCount(recallConfigCommonCache)); 57 + RECALL_NEW_LOGGER.info("loadRecallConfigCommonCache success,recallConfigCommonCache size is[{}],cost is [{}] ms", MapSizeUtils.getMapElementMapCount(recallConfigCommonCache),System.currentTimeMillis()-begin);
56 } catch (Exception e) { 58 } catch (Exception e) {
57 RECALL_NEW_LOGGER.error("loadRecallConfigCommonCache error,exception is:" + e.getMessage(), e); 59 RECALL_NEW_LOGGER.error("loadRecallConfigCommonCache error,exception is:" + e.getMessage(), e);
58 } 60 }
@@ -36,6 +36,8 @@ class RecallConfigProductService { @@ -36,6 +36,8 @@ class RecallConfigProductService {
36 36
37 private void loadRecallSknCountConfigCache() { 37 private void loadRecallSknCountConfigCache() {
38 try { 38 try {
  39 + RECALL_NEW_LOGGER.info("loadRecallSknCountConfigCache begin ........");
  40 + long begin = System.currentTimeMillis();
39 List<CsRecallConfigProduct> configList = csRecallConfigProductIndexBaseService.queryAll(); 41 List<CsRecallConfigProduct> configList = csRecallConfigProductIndexBaseService.queryAll();
40 Map<String, Map<Integer, ConfigSknCount>> tempCache = new HashMap<>(); 42 Map<String, Map<Integer, ConfigSknCount>> tempCache = new HashMap<>();
41 for (CsRecallConfigProduct productConfig : configList) { 43 for (CsRecallConfigProduct productConfig : configList) {
@@ -57,7 +59,7 @@ class RecallConfigProductService { @@ -57,7 +59,7 @@ class RecallConfigProductService {
57 tempCache.get(configKey).put(pageId, configSknCount); 59 tempCache.get(configKey).put(pageId, configSknCount);
58 } 60 }
59 recallSknCountConfigCache = tempCache; 61 recallSknCountConfigCache = tempCache;
60 - RECALL_NEW_LOGGER.info("loadRecallSknCountConfigCache success,recallSknCountConfigCache size is[{}]", MapSizeUtils.getMapElementMapCount(recallSknCountConfigCache)); 62 + RECALL_NEW_LOGGER.info("loadRecallSknCountConfigCache success,recallSknCountConfigCache size is[{}],cost is[{}]", MapSizeUtils.getMapElementMapCount(recallSknCountConfigCache),System.currentTimeMillis()-begin);
61 } catch (Exception e) { 63 } catch (Exception e) {
62 RECALL_NEW_LOGGER.error("loadRecallSknCountConfigCache error,exception is:" + e.getMessage(), e); 64 RECALL_NEW_LOGGER.error("loadRecallSknCountConfigCache error,exception is:" + e.getMessage(), e);
63 } 65 }
@@ -33,11 +33,13 @@ class RecallConfigSortBrandService { @@ -33,11 +33,13 @@ class RecallConfigSortBrandService {
33 33
34 @PostConstruct 34 @PostConstruct
35 void init() { 35 void init() {
36 - schedule.scheduleAtFixedRate(() -> loadConfigSortBrands(), 0, 1, TimeUnit.MINUTES); 36 + schedule.scheduleAtFixedRate(() -> loadConfigSortBrandsCache(), 0, 1, TimeUnit.MINUTES);
37 } 37 }
38 38
39 - private void loadConfigSortBrands() { 39 + private void loadConfigSortBrandsCache() {
40 try { 40 try {
  41 + RECALL_NEW_LOGGER.info("loadConfigSortBrandsCache begin ........");
  42 + long begin = System.currentTimeMillis();
41 List<SortBrand> tempCache = new ArrayList<>(); 43 List<SortBrand> tempCache = new ArrayList<>();
42 List<CsRecallConfigSortBrand> csRecallConfigSortBrands = csRecallConfigSortBrandIndexBaseService.queryAll(); 44 List<CsRecallConfigSortBrand> csRecallConfigSortBrands = csRecallConfigSortBrandIndexBaseService.queryAll();
43 for (CsRecallConfigSortBrand csRecallConfigSortBrand : csRecallConfigSortBrands) { 45 for (CsRecallConfigSortBrand csRecallConfigSortBrand : csRecallConfigSortBrands) {
@@ -48,9 +50,9 @@ class RecallConfigSortBrandService { @@ -48,9 +50,9 @@ class RecallConfigSortBrandService {
48 } 50 }
49 } 51 }
50 configSortBrandsCache = tempCache; 52 configSortBrandsCache = tempCache;
51 - RECALL_NEW_LOGGER.info("loadConfigSortBrands success,configSortBrandsCache size is[{}]", configSortBrandsCache.size()); 53 + RECALL_NEW_LOGGER.info("loadConfigSortBrandsCache success,configSortBrandsCache size is[{}], cost is[{}] ", configSortBrandsCache.size(), System.currentTimeMillis() - begin);
52 } catch (Exception e) { 54 } catch (Exception e) {
53 - RECALL_NEW_LOGGER.error("loadConfigSortBrands error,exception is:" + e.getMessage(), e); 55 + RECALL_NEW_LOGGER.error("loadConfigSortBrandsCache error,exception is:" + e.getMessage(), e);
54 } 56 }
55 } 57 }
56 58