[
https://issues.apache.org/jira/browse/SLIDER-1079?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15134286#comment-15134286
]
Jonathan Maron commented on SLIDER-1079:
----------------------------------------
Looks pretty good. Can you:
1) Create a method that encompasses the logic for obtaining the metainfo, e.g.
{code}
Metainfo getMetainfo (FileSystem fileSystem, String appDef) {
Metainfo metaInfo = metaInfoMap.get(appDef);
if (metaInfo == null) {
try {
metaInfo = AgentUtils.getApplicationMetainfo(fileSystem, appDef, false);
metaInfoMap.put(appDef, metaInfo);
} catch (IOException e) {
log.error("Error retrieving metainfo from {}", appDef, e);
throw new SliderException("Error retrieving metainfo", e);
}
return metainfo;
}
{code}
2) it may be appropriate to leverage a concurrent map for the metainfo map
3) Can you see about adding some unit tests to validate functionality (add a
test method to TestAgentClientProvider)?
> Cache MetaInfo for AgentClientProvider
> --------------------------------------
>
> Key: SLIDER-1079
> URL: https://issues.apache.org/jira/browse/SLIDER-1079
> Project: Slider
> Issue Type: Bug
> Components: client
> Affects Versions: Slider 0.81, Slider 0.90.2
> Reporter: shanyu zhao
> Assignee: shanyu zhao
> Attachments: SLIDER-1079.patch
>
>
> During app creation, the slider client calls
> AgentUtils.getApplicationMetainfo() 3 times. Each time this function actually
> download the whole app package from HDFS. If the app package is big, this is
> rather inefficient.
> The 3 places are:
> 1) SliderClient.actionBuild() ->
> AgentClientProvider.validateInstanceDefinition()
> 2) AgentClientProvider.getApplicagionTags()
> 3) AgentClientProvider.validateInstanceDefinition()
> We should cache the metainfo object in AgentClientProvider.
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)