Authored by hugufei

fix召回缓存日志

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